PayPal API - Update payment details on capture
PayPal API - Update payment details on capture
I've integrated the PayPal Express-Checkout in my application and added the authorize and capture flow. At the beginning of the process (authorization) I don't know the final price that will be captured later on, so I always set an initial price and add taxes in the amount details like in this example:
...
"transactions": [
"amount":
"total": "5.50",
"currency": "USD",
"details":
"subtotal": "4.45",
"tax": "1.05"
]
...
"item_list":
"items": [
"name": "foo",
"description": "bar",
"quantity": "1",
"price": "4.45",
"tax": "1.05",
"currency": "USD"
]
...
So far, everything works as expected.
But later when I try to update the amount with it's details (subtotal and tax) and call capture, the PayPal API throws an error, telling me that it is not possible to update the details at this point (even if the total amount is less than the old total amount).
However, if I only change the amount total without details (subtotal and tax) it works.
The only hint I've found so far is in the PayPal API docs:
Important: If you want to update any details of the purchase that change the original authorization amount, PayPal requires that you obtain consent from the buyer at the time of purchase or at the time of capture.
Does this mean I have to create a complete new authorization and redirect the customer to the PayPal Page again to authorize the updated payment?
My process requires to lock a specific amount of the customers PayPal account as a kind of deposit in order to use the service.
– xvzwx
Aug 22 at 5:38
I don't know of a way to lock in a deposit or amend a paid amount after the payment has been set up. Instead, I think I would change the process to take a deposit payment and then, at the time of actual purchase, take the final payment and also refund the initial deposit (or, if the final payment is less than the deposit then just refund the difference between the two without taking another payment). Is that feasible for you?
– Sam Williams
Aug 23 at 6:44
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
If I've understood the problem correctly then it sounds like you just shouldn't start the auth/capture flow until you've got a definite final amount. Is there a reason why you don't know the amount that will be captured later on and is there a reason why you can't start the auth/capture flow at that point?
– Sam Williams
Aug 21 at 22:37