Reputation: 13
TL;DR Version
According to the Express Checkout NVP Api docs I can set my own transaction ID with the PAYMENTREQUEST_n_TRANSACTIONID field. This never works for me - the response from the 'DoExpressCheckoutPayment' always returns a different transaction ID. The docs don't say if it needs to be unique (I presume that it does) or how to generate an ID that is guaranteed to be accepted as valid on Paypal's side. How do I do this?
Full Version (Read above first)
I don't really need to create my own transaction ID. If I could be sure that the my call to 'DoExpressCheckoutPayment' finishes before Paypal issues the IPN - that would be fine. This is so I could update my records from the 'PAYMENTINFO_n_TRANSACTIONID' field before the IPN is issued and then use the 'txn_id' from the IPN call to update my records.
At the moment setting a custom transaction ID at the 'SetExpressCheckout' stage is never returned at the IPN stage.
I'm using API version 98.
Upvotes: 0
Views: 239
Reputation: 26036
You can't create your own transaction ID. What you're seeing in the documentation is that the response would return the transaction ID.
DoExpressCheckoutPayment will always finish before the IPN triggers. In fact, DECP is what triggers the IPN.
If you want to pass your own custom value of some sort you'll need to use the actual CUSTOM parameter in the DoExpressCheckoutPayment request. If you include CUSTOM in SEC but not DECP, it will not be included in the final payment details, and would not be returned in IPN.
Upvotes: 2