Reply
Member
Posts: 1
Registered: ‎10-19-2019

Accept.js Saving Payment Method

I have been trying to integrate Accept.js and the CIM into my website and so far it has been rather straight forward but I have run into a bit of a road block as far as payment workflow.

 

How my workflow works is pretty similar to a lot of checkout processes.  I gather the address and card information, I use Accept.js to tokenize the card and then send that and the address back to my server.  At that point I think I want to run the sale, and then if the transaction is accepted, and the customer checked the box to save the payment method then I use the Create Customer With Transaction ID API endpoint.  From what I can tell that is really the only way to handle this when using Accept.js because once I use the nonce to run the sale I can't reuse it to create a payment profile on a customer account.

 

The issue that I have been having is that I'm not sure how to handle this when the customer already has one saved payment profile and they want to save another one.  If I run the sale first I have used up the nonce so I can't save it to the customerID that I already have.  Would I have to use the same Create Customer With Transaction ID endpoint and hope that the CIM duplicate detection is perfect?  So far in testing the problem with this is that if the transaction triggers the fraud detection it won't save the profile, even if we discover that the transaction wasn't fraudulent.

The other option is that I could save the payment profile to the customer, and then charge that payment profile through the API, but I'm unsure if I should be sending those 2 operations through the API that quickly since in the sandbox sometimes things aren't quite updated that fast.

 

Am I missing something obvious?