How can I start charging a user the user immediately for a PayPal billing agreement?
Here's what I've got so far.
This all seems to work, but I want to charge the user right now and every month in the future. If I set start_date
to now in step 3 I get an error, it must be in the future. If I set it in the future the user is not charged.
Do I need to 'Set outstanding agreement amounts' then 'Bill outstanding agreement amounts' for the initial payment?
Also, what about monthly payments, do they require some action or do they just happen as specified in the Billing Plan?
Update
I'm testing this around 2014-09-16T20:06:30+0000
If I send start_date
as the current UTC time it get an error at step 2 telling me it must be in the future.
If I send the current date +30 secs or +2 hours I get through to step 5 which returns a 400 response: UNKNOWN_ERROR "An unknown error has occurred"
If I send the current date +4 hours it all works. The current UTC time is 8pm so adding 4 hours means the start_date
is tomorrow.
Does this mean I can't charge the user today? Does the start_date
have to be in next day or even the next business day?
To get started with the PayPal REST API, first create a developer account on the Developer Dashboard. From there you can generate your credentials, authentication token and sandbox accounts.
Finding the PayPal billing IDLog in to PayPal. In the top right corner, click the gear icon. Click PAYMENTS. Click Manage automatic payments.
I used this date format working.
$time = time();
$startDate = date('Y-m-d\\TH:i:s\\Z', $time);
I've talked to a PayPal rep and found that start_date
must be tomorrow or later. They are going to add this to the docs.
If you want to start monthly billing immediately you might be able to do it by setting the start date to be in one months time and charging a setup fee to cover the first month. I haven't tested this as it's not what I want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With