Showing results for 
Search instead for 
Did you mean: 

Smart Payment Buttons Integration: How to include idempotency in actions.order.create() call

Posted on

Hello Everyone,


Doing my first PayPal integration using the Smart Payment Buttons Integration. I am wondering if there is any way to include idempotency in the order creation call from the Javascript SDK (i.e. the actions.order.create() call). I am facing the issue that actions.order.create() happily creates multiple orders with multiple order ids. Order capture will then capture each and every one of these orders, even when the same Paypal-Request-Id is passed to all of the capture requests. This can easily cause accidential double charges, exactly the thing that idempotency is tryng to protect against. Is this a bug in the PayPal process? To capture, I am calling the REST Order API directly from my server (not using actions.order.capture()) and I can therefore include the Paypal-Request-Id header in the capture request. I've tried to do order creation through the REST API, there it does honour idempotency and is returning the same order id in all requests with Paypal-Request-Id set to the same string. How do I access the same behaviour when creating orders through the actions.order.create() call in the JS SDK? Only tried all of the above on the Sandbox so far.




Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.