I am having an issue with ExecutePayment call failing randomly - this results in the payment not going through.
Here is the process flow:
User Clicks to Pay via PayPal
User is redirected to PayPal after creating a 'approval_url' by calling payment.Create(apiContext);
User confirms with payment with PayPal and is redirected back to our site.
We then process the order after validating the PaymentID passed back by PayPal matches the original PaymentID and then call 'payment.Execute(apiContext, paymentExecution);' This call also let's us update the invoice # and etc.
The issue is on some random occasions the payment.Execute() call will throw an error of "The remote server returned an error: (400) Bad Request."
When this error occurs, the payment.Execute() call never goes through which then causes the payment not to go through. but since we have already processed the order based on the initial approval and are using payment.Execute to update the order invoice#, it results in the transaction not going through but the order being processed, we then have to reverse the order.
I am wondering what are some best practice tips for dealing with this situation.
The reason I am doing the second call of payment.Execute() is it seems like that's the only way to do it, how can I have the first call finalize the payment without relying on the second call and use the second call just for updating the invoice number and description.
Here are some Debug ID's: 87a80d2969ede, b7480c0696509
... View more