I am looking for a simple JSON example of a paypal definition for a donation. This does not seem to be covered in PayPal docs. It needs a simple parameter for a specific date for the payment to be made, and a option for it to be recurring on this date annually. I have tried the following , but it does not allow for a payment date or recurring. What needs adding?
var create_payment_json = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://return.url",
"cancel_url": "http://cancel.url"
},
"transactions": [{
"item_list": {
"items": [{
"name": "item",
"sku": "item",
"price": "1.00",
"currency": "USD",
"quantity": 1
}]
},
"amount": {
"currency": "USD",
"total": "1.00"
},
"description": "This is the payment description."
}]
};
Thank you
There is no such parameter to control whether a payment is recurring or will be captured or charged at a later time in the future that way.
In order to achieve semblance of what's possible in Stripe, you need to work different.
For recurring billing,
For later capture,
store the capture URL returned in the response.
Note that this capture URL is live for a certain period of time. This capture url can be refreshed just one time by re-authorizing payment if the payment isn't captured within that period of time.
Sadly, Paypal doesn't provide an API to automatically capture payment at a later time you can specify like Stripe does it. You have the responsibility to ensure that.
However, there are service integrations that extend Paypal to provide this functionality, see Braintree Vault for Paypal).
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