Auto-Populate Card Details From a Photo
Auto-Populate Card Details From a Photo
Overview
Instead of asking a customer to manually type in their card number, expiration date, and CVV, you can let them take a photo of their physical card. Coinflow extracts the card details from the image, stores them as a token in Coinflow’s PCI-compliant vault, and returns the token so you can complete the purchase.
The flow is two steps:
- Extract the card — send the photo to
POST /tokenize/extract-card. The endpoint responds with a307redirect to Coinflow’s PCI-compliant vault proxy, so the card photo is processed there and never touches Coinflow’s servers. Following the redirect returns atokenalong with non-sensitive metadata (firstSix,lastFour,expirationMonth,expirationYear, and whether a CVV was captured). - Charge the card — pass the returned
tokentoPOST /checkout/token/{merchantId}(Saved Card Checkout) to complete the purchase.
Access to POST /tokenize/extract-card requires that your company holds a
PCI-DSS certification. Provide your certification to your Coinflow
Integrations Representative to have the endpoint enabled for your account.
Step 1: Extract the card from the image
Send a base64-encoded photo of the card in the image field. Optionally set
mimeType (defaults to image/jpeg). Authenticate with a merchant API key that
has the ADMIN scope.
The endpoint responds with a 307 Temporary Redirect. Your HTTP client must
follow the redirect and re-send the request body to the redirect location
(fetch does this automatically; for curl use --location-trusted).
The response contains the token you will use for checkout, plus metadata you
can use to pre-fill and confirm the card in your UI. cvvCaptured tells you
whether the CVV was readable from the photo — if it is false, prompt the
customer to enter their CVV manually before charging. When a CVV is captured,
cvvHash contains its SHA-256 hash, so you can verify the extracted value
matches the CVV your customer expects without handling the raw value.
Step 2: Charge the card with the returned token
Use the token from Step 1 as the token field of the Saved Card Checkout
request. This is the same endpoint used for any saved-card (tokenized)
purchase.
Putting it together
If cvvCaptured is false, collect the CVV from the customer and associate
it with the token before charging so the transaction can be authorized with a
CVV.

