Update a row each day in PostgreSQL - postgresql

I'm doing a database for a tickets sell. Each user can sell and buy a ticket. If the seller doesn't send the ticket within 24 hour the sell is cancelled. I wanted to use Triggers but there's no date trigger in it. So, how can do something after a time ? I would like to reset a limitation of sell each month too for each user.

Related

Is it possible extend PayPal subscriptions as a gift?

Is there a way we can extend one customer's subscription duration as a gift? Let's say I have a subscription plan which has 1 billing cycle repeated infinite times. During a promotional event I would like to gift certain users an additional 30 days of subscription period. Their subscription should continue normally from the next billing cycle once the 30 day period is over. In their documentation to update an existing subscription, the patch object doesn't allow to change the billing_cycle or any other field related to it.
Not sure whether it's best, but the possibility that occurs to me is suspension and reactivation 30 days later.

Change paypal next payment date in existing and executed billing agreement?

I used PayPal SDK to create and execute a billing agreement that was supposed to charge the client every 3 months.
However, I used the setup_fee to charge the customer immediately and set the start date to be 1 month in the future instead of 3.
I can see on the customer's profile that the customer next payment due date is in one month and I am not capable of changing the next payment date.
I've already tried using the billing agreement update method, but it doesn't let me change the start_date or next_payment_date.
Any idea how I can change the next payment date for the existing billing agreement that have already been executed?
The answer is not great, but the somewhat solution I found was to suspend the plans.
To give more context, my problem was the following:
User subscribed to quarterly paid plan on September 15th and paid setup_fee
Next payment was incorrectly configured to be on October 15th - because I added a month to the start date*
The actual next payment date should be 3 months after, on December 15h
My "solution":
I paused the subscriptions for those users before October 15th, more specifically on October 10th.
I restarted the solution 2 days after the incorrect next_payment_date, on October 17th.
Once the plan was restarted the next_payment_date was set to 3 months later, so it was set to January 15th.
So as you can observe, I was not able to actually fix it, but rather I accepted to "lose" a month.
Note: Paypal support was LESS than useful. At first their recommendation was to cancel the plan and ask the users to buy again. Then I sugggested the approach of suspending and they INCORRECTLY confirmed to me that the next payment date would be the correct one, and that was not true, it was ONE month later. So be aware of what their support says.

PayPal Subscribe Button invoice over Opencart

I have to set subscibe button - this is easy but I will need my Opencart shop to create 3 invoice for every month after the paypal transaction is done.
Example
Subscibe button - 3 months x 10 EUR
So Opencart can create invoice for 30 EUR on fisrt transaction, but I want to create 3x10... or 2x10 if user doesnt pay the last one?
And to be secure...
Any ideas? or something to read about this?
Normally this should be solved as easy as possible - if the customer wants a 3 months subscription he has to pay these 3 months in advance against just one invoice. If he doesn't pay, decline the subscription.
If you want to have recurring subscription so that user orders 1 month recurring each next month until canceled then you would need to create some cron job that will run each month renewing those recurring subscriptions and also creating invoices for them...

Paypal recurring billing with a trial and discount code

I have a membership website where membership costs $19.99/month. I'd like to give my users 2 weeks trial period AND a discunt for the first month of payment after that. That is:
User purchases a membership which costs $19.99/month
I give the user 2 weeks free trial and after that 2 weeks I charge the user $9.99 and every other payment after that should be $19.99.
Any ideas on how to achieve that?
Set the start date of the profile to 2 weeks from the current date. Then set the trial amount to 9.99 and have it run for 1 month, and then set the regular amount to 19.99/mo.
This will create an active profile immediately, but nothing will be charged at all until the start date that was set. At that point it'll charge whatever you set for the trial amount, and then it would charge the regular amount after that.

Paypal subscription auto payments on a specific day?

I am offering an annual program and want to automatically withdraw payments from my clients via PayPal. I see how to create a subscription to do this.
However, it charges them one month after they pay the first installment. I really want to bill all of my clients on the 1st of the month for 12 months, to simply the accounting for myself and them.
Is there a way to create an automatic payment on the 1st of every month without asking all of my clients to pay on that specific day?
I called Paypal and they said it would require html coding, but couldn't tell me HOW that might be accomplished for someone like me who doesn't write code.
If you're using the Recurring Payments API you can specify the PROFILESTARTDATE and set it to whatever future date you want. The profile will be become active immediatly, but it won't start until that date, which is when the first payment would be made.
Just keep in mind if somebody signs up on the 2nd of the month you'll basically be giving them a free month.