What is a simple, minimal example of determining PayPal payment for JSON?

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. He needs a simple parameter for a specific date for payment and the ability to repeat this date on that date annually. I tried the following, but it does not allow the payment date or is repeated. What do you need to add?

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." }] }; 

thanks

+5
source share
2 answers

There is no such parameter to control whether the payment is repeated or will be charged or charged later in the future.

To achieve what is possible with Stripe, you need to work differently.

For repeated billing ,

For later capture ,

  • create authorization payment type
  • save capture URL returned in response.

    Please note that this capture URL is alive for a certain period of time. This capture URL can only be updated once by re-authorizing the payment if the payment is not charged within this time period.

    Unfortunately, Paypal does not provide an API to automatically capture payments later, when you can specify how Stripe does it. You are responsible for this.

    However, there are integration services that extend Paypal to provide this functionality; see Braintree Storage for Paypal ).

+1
source

You can find decent examples with Json in the official Paypal documentation .

Below is an example based on the official PayPal page.

 curl -v -X POST https://api.sandbox.paypal.com/v1/payments/payment \ -H "Content-Type:application/json" \ -H "Authorization: Bearer Access-Token" \ -d '{ "intent": "sale", "payer": { "payment_method": "paypal" }, "transactions": [ { "amount": { "total": "30.11", "currency": "USD", "details": { "subtotal": "30.00", "tax": "0.07", "shipping": "0.03", "handling_fee": "1.00", "shipping_discount": "-1.00", "insurance": "0.01" } }, "description": "This is the payment transaction description.", "custom": "EBAY_EMS_SOMENUMBER", "invoice_number": "INV000001", "payment_options": { "allowed_payment_method": "INSTANT_FUNDING_SOURCE" }, "soft_descriptor": "ECHI5786786", "item_list": { "items": [ { "name": "dontation", "description": "dontation", "quantity": "1", "price": "10", "tax": "0.00", "sku": "1", "currency": "USD" } ] } } ], "note_to_payer": "Thankyour for your donation.", "redirect_urls": { "return_url": "https://example.com", "cancel_url": "https://example.com" } } 
0
source

Source: https://habr.com/ru/post/1272219/


All Articles