Flow
1
Initialize
Create the payment on your server. Keep
data.accessCode and data.reference.2
Prepare a card session
From the browser (or your checkout backend that holds the access code):
hostedCard.provider is cybersource or mpgs:3
Mount hosted fields
CyberSource: load
hostedCard.scriptUrl, create new Flex(hostedCard.captureContext).microform(), mount number and CVV only, keep expiry as your own inputs, then createToken({ expirationMonth, expirationYear }). Send that JWT on charge.MPGS: load hostedCard.scriptUrl and mount Mastercard hosted fields against the session id.4
Charge
transientToken is accepted as an alias of sessionId for CyberSource. If you omit both, we use the token stored at session create.5
Handle data.status
Branch on
data.status:3-D Secure after fingerprinting
Only call this when charge returneddata.status fingerprint_required. No session id is needed; it is already stored.
success, failed, or 3ds_required plus threeDsHtml on data.
When the issuer challenges, the iframe posts back to our 3-D Secure callback (not your callbackUrl). The callback page notifies the parent with:
checkout.completed as a fallback.
Constraints
- Card number and CVV go to hosted fields, not to Vestrapay.
- Run the 3-D Secure challenge in an on-page iframe, not
window.open. - Keep the top window on your checkout origin during 3-D Secure.
- Call authenticate only when charge returned
fingerprint_required.
Test cards
On the mock card processor (test):4111111111111111 and 4242424242424242 succeed. Any other number is rejected. Live CyberSource / MPGS use the processor’s own test PANs.