Send payment nonce, chargeVerificationToken and storeVerificationToken to api for payment
API
Call payments API with sourceId=nonce and chargeVerificationToken (this works)
Create customer (unless they already exist, then use existing id)
Call createCard with sourceId=[payment.id from previous request] and storeVerificationToken(this is where it fails)
This flow works for cards without SCA challenges but always returns this error CARD_DECLINED_VERIFICATION_REQUIRED for SCA enabled test cards when saving the card (the payment still goes through).
I’ve also managed to save a card if I skip the payment part and use the payment nonce and storeVerificationToken, so it seems the verificationTokens are both valid, but breaks when trying to save a card with the payment id. As far as I’m aware you can’t use the card nonce twice if it’s already been used for the charge.
Questions:
Should I be calling verifyBuyer twice, once with CHARGE and once with STORE one after the other?
Thanks for your reply @Bryan-Square. I’ve just tried swapping the requests round and I now get an error Invalid verification_token when I attempt to charge the card (the card is now saved). I assume this is because the verification token was generated with the card details and not the newly saved card id?
Just to provide an update on this. The above flow seems to work - making two separate requests from the frontend and calling verifyBuyer twice - first with the tokenised card and STORE then again with the returned card id and CHARGE.
Just want to check two things:
That this is how it is meant to work and there isn’t a more streamlined approach
if anyone knows if the live version is likely to ask for a verification code twice like the test cards do, or if banks will authenticate in the background the second time?