Selling PINs
Add to phone wallets
Get the links your customer opens to add a PIN to Google Wallet or Apple Wallet. The pass shows the brand, the card art, the PIN code with a QR code for the till, the balance and the expiry date, and it updates by itself.
HMAC-signed request with a unique Idempotency-Key header. Authentication
$afropin->reseller->pins->walletLinks($params)afropin.reseller.pins.walletLinks(params)afropin.reseller.pins.wallet_links(params)afropin.reseller().pins().walletLinks(params)Body parameters
The PIN pin_id. It must belong to your account and to the mode of your API key, and be active.
The PIN's current code, with or without dashes. We only keep a fingerprint of codes, so you send it to prove you hold the PIN and so the pass can show it. A code that has been replaced fails with pin_code_replaced.
Response fields
The PIN.
The code the pass shows, with its middle digits hidden.
The "Add to Google Wallet" link, for Android phones. It opens Google Wallet, or a web page elsewhere. You can ask for it again at any time. Null if Google Wallet could not be reached.
The "Add to Apple Wallet" link, for iPhones: opened in Safari it shows the pass with an Add button. Each call makes a new link. Null if Apple Wallet is not available.
What keeps the pass up to date
Show your customer both links, or pick one from their phone: an iPhone gets apple_wallet_url, any other phone google_wallet_url. Use the official "Add to Apple Wallet" and "Add to Google Wallet" badges as the buttons.
"wallet_links": true to Sell a PIN or a printed card activation to get google_wallet_url and apple_wallet_url in the same response, without a second call.Request
{
"pin_id": "e83f72e0-997c-4ca8-aee8-04a7423a1bd4",
"pin_code": "2923-5810-4476-1441"
}
Response 200
{
"ok": true,
"data": {
"pin_id": "e83f72e0-997c-4ca8-aee8-04a7423a1bd4",
"pin_mask": "2923-****-****-1441",
"google_wallet_url": "https://pay.google.com/gp/v/save/eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3Mi...",
"apple_wallet_url": "https://afropin.com/api/wallet/apple/add/0fbdf173-db9d-4efa-837b-42e621e8af98/SFkz3ZWoF6Ph0d0cZi_JVv3fyl3UU5hkvbPrvqxwcsw"
}
}
Errors
Failed requests return a stable code with a translated message. Branch on code, never on the message.
validation_error
Some fields are missing or invalid
wrong_account_type
Your account type cannot use this endpoint
rate_limited
Too many requests. Wait a moment and try again
pin_not_found
No PIN has this id
pin_blocked
This PIN is blocked
pin_expired
This PIN has expired
pin_checksum_failed
This is not a valid PIN code: its check digit is wrong
pin_code_unknown
No PIN has this code
pin_code_replaced
This code has been replaced by a newer one; ask the customer for their latest code
wallet_unavailable
Wallet passes are not available right now. Try again later
internal_error
Something went wrong on our side. Try again; if it keeps happening, contact support
{
"ok": false,
"error": {
"code": "pin_not_found",
"message": "No PIN has this id",
"fields": null
}
}
All error codes →