Card Metadata
Card metadata is information that describes a card, including its Bank Identification Number (BIN), network (such as Visa or Mastercard), funding type (credit, debit, or prepaid), and issuing bank and country. You can use this information to calculate transaction pricing or apply your own risk assessment rules.
There are two ways to retrieve card metadata:
- Before processing a transaction: perform a BIN lookup using a BIN, an encrypted card number, or an encrypted wallet token.
- After processing a transaction: read the
cardobject on the related transaction object (such asCardTransaction), including within theinitiateTransactionresponse.
Before processing a transaction
Use the REST BIN lookup endpoint when you need card metadata without initiating a payment. You can supply a BIN directly, an encrypted card number from Stitch Secure Fields, or an encrypted Apple Pay, Google Pay, or Samsung Pay token.
All three options use the same endpoint for both test and live clients:
POST https://api.stitch.money/v2/bin-lookups
Authentication
Follow the client token guide to obtain a client access token with the client_binlookup scope. Send requests from your backend with these headers:
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
Keep your client credentials and access token on your server. Replace YOUR_ACCESS_TOKEN in the examples below with your client access token.
Choose a lookup input
Send one of the following fields in the JSON request body:
| Field | Type | Description |
|---|---|---|
bin | string | The first 6–8 digits of a card number. Use a string containing digits only. |
cardNumber | string | The encrypted card number returned by Stitch Secure Fields, starting with ev:. |
encryptedWalletToken | object | The wallet provider and its base64-encoded encrypted payment token. See wallet token lookups. |
Look up a BIN
Pass the BIN as a string. The endpoint accepts 6, 7, or 8 digits; do not send a full card number in this field.
curl -X POST 'https://api.stitch.money/v2/bin-lookups' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"bin": "424242"
}'
Look up an encrypted card number
Collect card details with Stitch Secure Fields and forward the encrypted card number to your backend. Send that value unchanged as cardNumber:
curl -X POST 'https://api.stitch.money/v2/bin-lookups' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"cardNumber": "ev:Tk9D:9QcRf9/EWSKp0R20:Am3ca5q/pdKvbCXhvcwAgeMMyCfBIE1Y/xmIJ77jUFy0:kh8FdcoXWTUKrY8tgQ3kUriOCr6JPgZTI8ErtSHtADc=:$"
}'
Use the encrypted card number from Secure Fields: card.number on Web or card.encryptedNumber on the mobile typed APIs. Do not send a plaintext card number or base64-encode the encrypted value. The API extracts the BIN, so you do not need to supply bin, expiry, or CVC for this lookup.
Look up an encrypted wallet token
Set encryptedWalletToken.type to the wallet provider and encryptedWalletToken.value to the base64-encoded encrypted payment payload:
curl -X POST 'https://api.stitch.money/v2/bin-lookups' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"encryptedWalletToken": {
"type": "apple_pay",
"value": "eyJkYXRhIjoiMnBLdUtjbFE0QkVoc0d0NW9zenRWSjlUc0Y1NVY5UUVPSXpITFI1aS8xenovMVUraEpXKy95b2FHV0Q4MU9QN2pCR1lablpkRENNaG9sRGZ2a29nSDQ0bnBWVEFUenZjVU9HbEcyWHhxK1pHakhuV3lFaDZUWXl6NzdOT29KcnZRUGtYcW5Nc3doRGVDOVhmUThRNTlxMyt1UVRHL3Q4UW1semgyYytGSDI1dS9XMEJrZFp2S3FpTjZGbGR3bFpUdDlJM2UrY2pCaXY1dTlWemlJREEydmtMYW5YazV5WGRIOStPRkQxUFU1NHJrWEtJM3ZUY2hENU5Hay93dVdrMlNMNzRPSDhZZGpnUmtqVnpOSzd2aVQvb0ZIZlEvbEtBdndLNXVRN1huYzFQbDloWThvLy9OUm5NUFdPOFNXbVRZdmFnUnBmK2U5bUJMUGVOLzZESzFnbVJFYVpJMnhZaXl5SkZyeUtaZkZ4cTRZU2dpajBkaG9UTUg2Z3FlcVR2TndycUQ3aTlFelQxcmhNKyIsInNpZ25hdHVyZSI6Ik1JQUdDU3FHU0liM0RRRUhBcUNBTUlBQ0FRRXhEVEFMQmdsZ2hrZ0JaUU1FQWdFd2dBWUpLb1pJaHZjTkFRY0JBQUNnZ0RDQ0ErTXdnZ09Jb0FNQ0FRSUNDQlpqVElzT01GY1hNQW9HQ0NxR1NNNDlCQU1DTUhveExqQXNCZ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yJ9LCJ2ZXJzaW9uIjoiRUNfdjEifQ=="
}
}'
Use the appropriate provider and payload:
type | Payload to base64-encode |
|---|---|
apple_pay | The JSON representation of the Apple Pay token's paymentData object, containing data, header, signature, and version. |
google_pay | The encrypted token string in paymentMethodData.tokenizationData.token, containing the signed Google Pay token JSON. |
samsung_pay | The JSON representation of the Samsung Pay 3DS credential object, containing data, version, and type. |
Encode the payment payload itself, rather than the full wallet callback response. If your SDK already returns this payload as base64, forward it unchanged instead of encoding it again. For live Apple Pay and Google Pay lookups, your Stitch client must have the corresponding wallet merchant identifier configured.
For example, prepare an Apple Pay payload on a Node.js backend as follows. Here, paymentData is the token's encrypted payment data object:
const requestBody = {
encryptedWalletToken: {
type: 'apple_pay',
value: Buffer.from(JSON.stringify(paymentData), 'utf8').toString('base64'),
},
};
For Google Pay, the token is already a JSON string, so encode it directly without calling JSON.stringify on it:
const requestBody = {
encryptedWalletToken: {
type: 'google_pay',
value: Buffer.from(paymentData.paymentMethodData.tokenizationData.token, 'utf8').toString(
'base64'
),
},
};
See the wallet integration guide for collecting wallet tokens. A wallet lookup uses the card number contained in the wallet token, which may be a network token number with a different BIN from the underlying physical card.
Response
All three input types return 201 Created with card metadata in the following fields. The values below are illustrative; metadata depends on the BIN:
{
"bin": "424242",
"network": "visa",
"fundingType": "credit",
"issuer": {
"name": "Example Bank",
"country": "ZA"
}
}
| Field | Description |
|---|---|
bin | The BIN supplied in the request or extracted from the encrypted card number or wallet token. |
network | visa, mastercard, amex, diners, or discover. May be null if unavailable or unrecognised. |
fundingType | credit, debit, or prepaid. May be null if unavailable or unrecognised. |
issuer.name | The issuer's name. |
issuer.country | The issuer's country code, for example ZA. |
The response contains BIN metadata and does not return the full card number or decrypted wallet payload.
After processing a transaction
Card metadata is available on the card object of a GraphQL CardTransaction. For example, include the following card fields when calling initiateTransaction to receive the metadata with the transaction response:
mutation InitiateCardTransaction($input: TransactionInitiateInput!) {
initiateTransaction(input: $input) {
... on CardTransaction {
id
card {
bin
network
type
issuer {
name
country
}
}
}
}
}
Send this mutation to https://api.stitch.money/graphql with a client access token containing the transaction_initiate scope. Supply your card payment details in input; see once-off card payments with Secure Fields for a complete input example.
The same card object is also available when you fetch an existing CardTransaction, so you can retrieve its metadata later.