Card details
Your cardholder sometimes needs to see the full card number, the expiry date and the security code, for example to pay online. NAS never returns these as API data. You show them in a secure display that NAS hosts, and the details never pass through your servers.
Why card data never comes back as API data
- There is no call that returns it. No call returns a full card number, an expiry date or a security code, and no call reads a PIN. A guess at a path that might is refused with
NB40303. - Your systems stay out of scope. A full card number in your database, logs or a crash report makes that system subject to strict card-data security rules. A secure display keeps your servers out of that scope.
- A stolen key cannot read cards. Even if someone gets your access token, there is no call they can use to list card numbers.
Card lists and summaries show only the last four digits (cardLastFour).
How the secure display works
- Your backend asks NAS for a card access token for one card.
- Your backend gives the token to your page or app.
- Your page loads the secure display with the token. The display fetches the details from NAS and shows them to the cardholder.
The token is for one card, works once, and expires after five minutes. A token that has been used cannot be used again, so ask for a new one each time the cardholder opens the card.
Step 1 — Get the access token
curl "https://sandbox-api.nas.cards/open-api/v3/cards/<card-id>/private-info/access-token?accountId=$ACCOUNT_ID" \
-H "x-access-token: $ACCESS_TOKEN"
{
"code": "000000",
"message": "success",
"data": {
"accessToken": "0f44c35ee86e8e5633e0ea3b43f9d05c95f82e82922e4e1de54b5aaa4aa5859e"
}
}
Call this from your backend only. Check on your side that the signed-in customer owns the card before you ask for the token.
Do not store the card access token, and do not put it in logs. It is single-use, but treat it like a secret while it is live.
Step 2 — Show the details
NAS gives you the secure display library and its integration notes when it registers your site. The display only loads on web addresses that NAS has registered for your client, so send NAS the domains of the pages where you will show card details before you test. Mobile apps can use the same display inside a web view.
The page passes the access token from step 1 to the library, and the library draws the number, expiry date and security code inside a frame that NAS hosts. Your page controls the layout around it. It cannot read the values inside the frame.
Rules for the display
- Show details only to the cardholder who owns the card, after you have signed them in.
- Never copy the details into your own storage or send them by email or chat.
- Card data in the display cannot be exported in bulk. It can be viewed one card at a time, on your registered pages.
- Ask for a fresh token each time. Do not reuse an old one.
Errors
| Code | HTTP status | What happened |
|---|---|---|
NB40302 | 403 | The card is not yours. |
NB40001 | 400 | The accountId is missing. |
| other | 400 | A validation message, for example that the card cannot be found. |
See Errors.