> For the complete documentation index, see [llms.txt](https://docs.verygoodsecurity.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verygoodsecurity.com/cmp/developer-resources/api/wallet-decryption.md). Agents can also search and read this documentation through its [MCP server](https://docs.verygoodsecurity.com/~gitbook/mcp).

# Wallet Decryption

## Create a card

> The Create Card allows clients to register a digital wallet credential in the Credential Management Platform (CMP) using an encrypted wallet payment token. Supported wallet types are Apple Pay and Google Pay. \`encrypted\_payment\_data.wallet\_type\` selects the wallet: \`apple\_pay\` (the default when it is omitted) or \`google\_pay\`.\
> \
> The request accepts the encrypted wallet payload, which is securely decrypted by VGS to extract the underlying credential details and create a card linked to a specific account.\
> \
> The \`payment\_method\` object (\`display\_name\`, \`network\`, \`type\`) is optional in the request. If these fields are provided, their values will be echoed back in the response. If they are not included in the request, they will not be returned.\
> \
> The \`pan\` field is returned only to callers with the \`cards:read-pci\` scope.\
> \
> \## Apple Pay\
> \
> Send the Apple Pay payment token fields under \`encrypted\_payment\_data\`. Each request results in the creation of a new card and returns a 201 response with a new Card ID, even if the same DPAN or MPAN is submitted multiple times. Duplicate detection and deduplication logic are not supported for Apple Pay cards.\
> \
> \## Google Pay\
> \
> Send the Google Pay ECv2 token fields (\`protocolVersion\`, \`signature\`, \`intermediateSigningKey\`, \`signedMessage\`) directly under \`encrypted\_payment\_data\`, exactly as received from Google Pay, with \`wallet\_type\` set to \`google\_pay\`.\
> \
> \*\*Setup.\*\* VGS enables Google Pay decryption for your account and provides your Gateway Merchant ID. The Gateway Merchant ID is generated when Google Pay decryption is first enabled and does not change. In your Google Pay integration, request \`PAYMENT\_GATEWAY\` tokenization with \`gateway\` set to \`verygoodsecurity\` and \`gatewayMerchantId\` set to your Gateway Merchant ID. Do not send the Gateway Merchant ID to VGS as a request field: Google includes it inside the encrypted token.\
> \
> \*\*Checks.\*\* For each request, VGS:\
> \- checks that Google Pay decryption is enabled for the account (otherwise \`403 google-pay-decryption-disabled\`);\
> \- verifies Google's signatures and the intermediate signing key, including its expiry, decrypts the payload, and checks that the payload has not expired (any failure returns \`422 decryption-failed\`);\
> \- checks that the Gateway Merchant ID inside the token is the account's Gateway Merchant ID (otherwise \`403 gateway-merchant-id-mismatch\`);\
> \- validates the decrypted card: the card number length, and that the card is not more than 12 months past its expiry date (otherwise \`422 validation-failed\`).\
> \
> \*\*DPAN and FPAN.\*\* A token with \`authMethod\` \`CRYPTOGRAM\_3DS\` contains a device PAN (DPAN) and creates a card with \`token\_type\` \`dpan\`. The response includes the single-use \`cryptogram\` and the token's \`message\_id\` in \`wallet\_details\`. A token with \`authMethod\` \`PAN\_ONLY\` contains the funding PAN (FPAN) and creates a card with \`token\_type\` \`pan\`. The response includes \`message\_id\` and no cryptogram.\
> \
> \*\*Duplicate Card Detection.\*\* Duplicate card detection is not supported for encrypted Google Pay tokens. Each Create Card request creates a new card object with a unique \`card\_id\`, even if the same card was previously stored.\
> \
> \*\*Request handling.\*\* Properties that are not part of the request schema are ignored. Numbers sent for string fields are accepted and converted to strings. Field size limits are listed in the request schema: \`signature\` up to 256 characters, \`intermediateSigningKey.signedKey\` up to 4,096 characters, \`intermediateSigningKey.signatures\` up to 10 items of up to 256 characters each, and the \`encryptedMessage\` value inside \`signedMessage\` up to 40,000 characters. Requests that exceed these limits are rejected with \`422 validation-failed\`.<br>

```json
{"openapi":"3.1.0","info":{"title":"VGS Card Management Platform (CMP) API - POST /cards (encrypted only)","version":"doc version 2.3.0 | API version 1.0.0"},"tags":[{"name":"Wallet Decryption"}],"servers":[{"url":"https://sandbox.vgsapi.com","description":"Sandbox environment server used for integration and testing. Uses network sandboxes in addition to mocked data sources."},{"url":"https://vgsapi.com","description":"Live environment server used for production workloads."}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"EncryptedCardResourceRequest":{"type":"object","additionalProperties":false,"required":["data"],"properties":{"data":{"type":"object","additionalProperties":false,"required":["attributes"],"properties":{"attributes":{"$ref":"#/components/schemas/EncryptedCardAttributes"}}}}},"EncryptedCardAttributes":{"type":"object","additionalProperties":false,"required":["encrypted_payment_data"],"properties":{"encrypted_payment_data":{"description":"The encrypted wallet payment token. `wallet_type` selects the shape: `apple_pay` (the default when `wallet_type` is omitted) or `google_pay`.\n","oneOf":[{"$ref":"#/components/schemas/EncryptedPaymentData"},{"$ref":"#/components/schemas/GooglePayEncryptedPaymentData"}]}}},"EncryptedPaymentData":{"type":"object","title":"Apple Pay","additionalProperties":false,"required":["encrypted_payload_text","public_key","key_hash"],"properties":{"digital_signature":{"type":"string","minLength":10,"maxLength":8192,"description":"Base64-encoded wallet signature."},"encrypted_payload_text":{"type":"string","minLength":20,"maxLength":20000,"description":"Base64-encoded encrypted wallet payload."},"key_hash":{"type":"string","minLength":44,"maxLength":44,"description":"Base64-encoded SHA-256 hash of the wallet public key. Apple Pay only."},"public_key":{"type":"string","minLength":20,"maxLength":2048,"description":"Base64-encoded ephemeral public key."},"version":{"$ref":"#/components/schemas/EncryptedPaymentDataVersion","default":"EC_v1"},"wallet_type":{"$ref":"#/components/schemas/WalletType","default":"apple_pay"},"wallet_transaction_id":{"type":"string","description":"transaction identifier","minLength":1,"maxLength":255},"payment_method":{"$ref":"#/components/schemas/WalletPaymentMethod"}}},"EncryptedPaymentDataVersion":{"type":"string","description":"The version of the encrypted payment data format used for the card request.","enum":["EC_v1"]},"WalletType":{"type":"string","description":"The digital wallet from which the card request originated.","enum":["apple_pay","google_pay"]},"WalletPaymentMethod":{"type":"object","description":"Details about the payment method used","additionalProperties":false,"properties":{"display_name":{"type":"string","maxLength":255,"minLength":1,"description":"Human-readable payment method description"},"network":{"type":"string","maxLength":255,"minLength":1,"description":"Payment card network"},"type":{"type":"string","maxLength":255,"minLength":1,"description":"Card type"}}},"GooglePayEncryptedPaymentData":{"type":"object","title":"Google Pay","description":"Google Pay ECv2 token fields, sent directly under `encrypted_payment_data` exactly as received from Google Pay. Properties that are not listed here are ignored.\n","required":["wallet_type","protocolVersion","signature","intermediateSigningKey","signedMessage"],"properties":{"wallet_type":{"type":"string","enum":["google_pay"],"description":"Must be `google_pay` for a Google Pay token."},"protocolVersion":{"type":"string","enum":["ECv2"],"description":"Google Pay token protocol version. Only `ECv2` is supported."},"signature":{"type":"string","minLength":1,"maxLength":256,"description":"Base64-encoded signature of `signedMessage`, created by the intermediate signing key. Send it exactly as received from Google Pay. Must pass signature verification."},"intermediateSigningKey":{"$ref":"#/components/schemas/GooglePayIntermediateSigningKey"},"signedMessage":{"type":"string","minLength":1,"description":"Serialized JSON string containing `encryptedMessage`, `ephemeralPublicKey` and `tag`, each non-empty. Send it exactly as received from Google Pay. The `encryptedMessage` value must not exceed 40,000 characters; no other maximum applies to `signedMessage`."},"payment_method":{"$ref":"#/components/schemas/GooglePayWalletPaymentMethod"}}},"GooglePayIntermediateSigningKey":{"type":"object","description":"The intermediate signing key that Google used to sign `signedMessage`. Its expiry is checked.","required":["signedKey","signatures"],"properties":{"signedKey":{"type":"string","minLength":1,"maxLength":4096,"description":"Serialized JSON string containing `keyValue` and `keyExpiration`. Send it exactly as received from Google Pay."},"signatures":{"type":"array","minItems":1,"maxItems":10,"description":"Base64-encoded signatures of `signedKey`, created by Google's root signing keys. Send each value exactly as received from Google Pay. At least one must pass verification.","items":{"type":"string","minLength":1,"maxLength":256}}}},"GooglePayWalletPaymentMethod":{"type":"object","description":"Optional details about the card, taken from the Google Pay `paymentMethodData`. If provided, all three fields are required, and the values are returned in the Create Card and GET Card responses.\n","required":["display_name","network","type"],"properties":{"display_name":{"type":"string","minLength":1,"maxLength":255,"description":"Human-readable card description."},"network":{"type":"string","minLength":1,"maxLength":255,"description":"Card network."},"type":{"type":"string","enum":["UNKNOWN","CREDIT","DEBIT","PREPAID"],"description":"Card type."}}},"CardResourceResponse":{"title":"CardResourceResponse","type":"object","properties":{"data":{"properties":{"id":{"type":"string","title":"id","description":"Resource ID"},"type":{"type":"string","title":"Type","default":"cards"},"attributes":{"$ref":"#/components/schemas/CardResourceAttributes"}},"type":"object","required":["id","type","attributes"]},"metadata":{"$ref":"#/components/schemas/MetadataResponse"}},"additionalProperties":false,"required":["data","metadata"]},"CardResourceAttributes":{"type":"object","title":"CardResourceAttributes","description":"Full card information with extra fields like bin, last4, capabilities etc","properties":{"pan":{"type":"string","maxLength":19,"minLength":14,"title":"Primary Account Number","description":"The primary account number of the card. This field is omitted from non-PCI scope payload responses."},"cvc_status":{"type":"string","maxLength":10,"minLength":3,"title":"CVC Status","description":"The is an indicator that CVC was present during Create Card. Returned only to callers with the `cards:read-pci` scope. Wallet cards return `not-set`.\n"},"exp_month":{"type":"integer","maximum":12,"minimum":1,"title":"Expiration Month","description":"The expiration month of the card, as an integer between 1 and 12, where 1 is January, and 12 is December.\n"},"exp_year":{"type":"integer","maximum":99,"minimum":0,"title":"Expiration Year","description":"The expiration year of the card, as a 1-2 digit integer representing the decade portion of the year.\n"},"cardholder":{"$ref":"#/components/schemas/Cardholder","description":"Information about the cardholder, including name, email, address, and phone number. To achieve a high success rate with Amex Network Tokens, include card holder phone number and email address.\n"},"token_type":{"$ref":"#/components/schemas/TokenType"},"wallet_type":{"$ref":"#/components/schemas/WalletType"},"pan_alias":{"type":"string","title":"PAN Alias","description":"The PAN alias is a reference identifier that stores or securely holds the actual PAN value.\n"},"cvc_alias":{"type":"string","maxLength":35,"minLength":30,"title":"CVC Alias","description":"The CVC Alias is a reference identifier that stores or securely holds the actual CVC value.\n"},"bin":{"type":"string","minLength":6,"maxLength":8,"description":"The leading six or eight digits of the related card are the issuer identification number (IIN) sometimes referred to as the bank identification number (BIN)."},"first8":{"type":"string","minLength":8,"maxLength":8,"description":"8 character Bank Identification Number (BIN). The first8 field will be returned in the card object only for Visa and Mastercard cards."},"last4":{"type":"string","minLength":4,"maxLength":4,"description":"Last 4 characters of the primary account number (pan/fpan)"},"card_fingerprint":{"type":"string","description":"Card Fingerprint"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"card_brand":{"type":"string","description":"The name of the card brand. Returned when card enrichment provides it."},"card_type":{"type":"string","description":"The card type (credit, debit or prepaid). Returned when card enrichment provides it."},"enrollment_source":{"$ref":"#/components/schemas/EnrollmentSource"},"enriched_attributes":{"$ref":"#/components/schemas/EnrichedCardAttributes","description":"Enriched card attributes containing additional metadata about the card. This data provides detailed information about the card's capabilities, issuer details, and transaction support features."},"wallet_details":{"$ref":"#/components/schemas/WalletDetails","description":"Details about the digital wallet associated with the card."}},"required":["exp_month","exp_year","token_type","wallet_type","pan_alias","bin","first8","last4","card_fingerprint","created_at","updated_at","wallet_details"]},"Cardholder":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"The cardholder name."},"company":{"type":"string","maxLength":255,"title":"Company","description":"Company name."},"phone":{"type":"string","maxLength":16,"title":"Phone","description":"The phone number related to the card."},"email":{"type":"string","format":"email","description":"Email address of the account holder."},"address":{"$ref":"#/components/schemas/Address"}},"description":"Information about the cardholder, including name, email, address, and phone number. To achieve a high success rate with Amex Network Tokens, include card holder phone number and email address.\n"},"Address":{"properties":{"address1":{"type":"string","maxLength":255,"description":"The first line of the address related to the card."},"address2":{"type":"string","maxLength":255,"description":"The second line of the address related to the card."},"address3":{"type":"string","maxLength":255,"description":"The third line of the address related to the card."},"address4":{"type":"string","maxLength":255,"description":"The fourth line of the address related to the card."},"city":{"type":"string","maxLength":255,"description":"The city of the address related to the card."},"region":{"type":"string","maxLength":255,"description":"The region of the address related to the card."},"postal_code":{"type":"string","maxLength":10,"description":"The postal code of the address related to the card."},"country":{"type":"string","maxLength":3,"minLength":2,"description":"The country of the address related to the card. This must be the ISO 3166-1 alpha-2 or the ISO 3166-1 alpha-3 code. (ISO 3166-1)[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3]\n"}},"type":"object","title":"Address"},"TokenType":{"type":"string","description":"The type of token being used for the card.\n- `dpan`: device PAN. Apple Pay DPAN, or a Google Pay token with `authMethod` `CRYPTOGRAM_3DS`.\n- `mpan`: Apple Pay merchant token.\n- `pan`: funding PAN. A Google Pay token with `authMethod` `PAN_ONLY`.\n","enum":["dpan","mpan","pan"]},"EnrollmentSource":{"type":"string","description":"Indicates whether the card was loaded from an existing backbook portfolio\nor newly tokenized. Set by the server based on the `processing` query\nparameter at card creation time and is read-only.\n","enum":["backbook","frontbook"]},"EnrichedCardAttributes":{"type":"object","description":"Enriched card attributes from the card-attributes service","properties":{"card_properties":{"type":"object","properties":{"card_number_length":{"type":"integer","description":"The length of the Primary Account Number (PAN) printed on the front of the card. Available only for Card Attributes service subscribers.\n"},"card_segment_type":{"type":"string","description":"Indicator of Business, Consumer, Commercial, Government BINs. Available only for Card Attributes service subscribers."},"level_2":{"type":"boolean","description":"Indicator of Level 2 interchange rate eligibility.\n"},"level_3":{"type":"boolean","description":"Indicator of Level 3 interchange rate eligibility.\n"},"virtual_card":{"type":"boolean","description":"Indicates if the given BIN range supports virtual card creation. Available only for Card Attributes service subscribers.\n"},"prepaid_card":{"type":"boolean","description":"Indicates a fixed funding source for a card but not necessarily associated with the consumer's checking account. Available only for Card Attributes service subscribers.\n"},"product_name":{"type":"string","description":"The card product name according to the card brand (e.g., Visa Signature, Visa Infinite, Visa Classic). Available only for Card Attributes service subscribers.\n"},"issuer_bin":{"type":"string","description":"Bank Identification Number (BIN) of the issuer of the account. Available only for Card Attributes service subscribers."},"country_letter_code":{"type":"string","description":"ISO country letters that is associated with an ISO 3166-1 alpha-2 code."},"country_name":{"type":"string","description":"Name of the issuing country. Available only for Card Attributes service subscribers."},"country_numeric":{"type":"integer","description":"ISO 3166 numeric country code of the issuing country. Available only for Card Attributes service subscribers."}}},"card_capabilities":{"type":"object","properties":{"reloadable":{"type":"boolean","description":"Indicator of reloadable or non-reloadable prepaid. Available only for Card Attributes service subscribers."},"hsa":{"type":"boolean","description":"Indicates a card attached to a Health Savings Account. Available only for Card Attributes service subscribers."},"fsa":{"type":"boolean","description":"Indicates a card attached to Flexible Spending Account. Available only for Card Attributes service subscribers."},"ebt":{"type":"boolean","description":"Indicates the BIN has Electronic Benefits Transfer (EBT) capabilities. Available only for Card Attributes service subscribers."}}},"bank":{"type":"object","properties":{"issuer_name":{"type":"string","description":"Name of the issuing organization/bank."},"issuer_phone_number":{"type":"string","description":"Phone number of the issuing organization/bank. Available only for Card Attributes service subscribers."},"issuer_website":{"type":"string","description":"Website of the issuing organization/bank. Available only for Card Attributes service subscribers."}}},"additional_card_brands":{"type":"array","description":"Additional card brands, if any, associated with the card. Available only for Card Attributes service subscribers.","items":{"type":"object","required":["card_brand"],"properties":{"card_brand":{"type":"string","description":"The name of the additional card brand. Available only for Card Attributes service subscribers."}}}},"interchange":{"type":"object","properties":{"regulated":{"type":"string","description":"Indicator of the presence of an interchange regulation on a BIN. Available only for Card Attributes service subscribers."}}}}},"WalletDetails":{"type":"object","properties":{"currency_code":{"type":"string","maxLength":3,"minLength":3,"description":"ISO 4217 alpha 3 currency code for the transaction"},"amount":{"type":"integer","description":"Transaction amount in the given currency code's minor unit (e.g. cents for USD)","minimum":0},"device_manufacturer_identifier":{"type":"string","description":"Device manufacturer identifier for the card in the wallet."},"payment_data_type":{"$ref":"#/components/schemas/PaymentDataType"},"auth_method":{"$ref":"#/components/schemas/GooglePayAuthMethod"},"message_id":{"type":"string","description":"Google Pay only. The `messageId` of the Google Pay token used in this request."},"cryptogram":{"$ref":"#/components/schemas/CryptogramAttributes","description":"Single-use payment cryptogram. Returned only in the Create Card response, for an Apple Pay DPAN or a Google Pay `CRYPTOGRAM_3DS` token. Not stored and not returned by GET Card."},"merchant_token_identifier":{"type":"string","description":"Identifier for the merchant token associated with the wallet transaction"},"payment_method":{"$ref":"#/components/schemas/WalletPaymentMethod"},"transaction_id":{"type":"string","description":"Identifier for the wallet transaction"}}},"PaymentDataType":{"type":"string","description":"Type of the payment data encoding. Apple Pay: `3DSecure` or `MerchantToken`. Google Pay: `3DSecure` for a `CRYPTOGRAM_3DS` token, `PAN_ONLY` for a `PAN_ONLY` token.\n","enum":["3DSecure","MerchantToken","PAN_ONLY"]},"GooglePayAuthMethod":{"type":"string","description":"Google Pay only. The `authMethod` of the Google Pay token.","enum":["CRYPTOGRAM_3DS","PAN_ONLY"]},"CryptogramAttributes":{"type":"object","properties":{"type":{"type":"string","enum":["TAVV","DTVV"],"description":"Cryptogram type (defaults to TAVV)\n\nTAVV (Token Authentication Verification Value) and DTVV (Dynamic Token Verification Value) are cryptograms used to authenticate transactions and prevent fraud.\n\nCustomers can initiate transactions using VGS Network Tokens by generating a unique cryptogram.\n\n* TAVV: This cryptogram is specific to the network token and can be up to 32 characters long. When submitting transactions, networks may require merchants to specify the transaction type explicitly during cryptogram generation.\n* DTVV: Unlike TAVV, DTVV is a 3-characters long cryptogram that is currently supported only for Visa Network Tokens which can increase compatibility with some PSPs. To use DTVV, VGS must be enabled on a case-by-case basis. Merchants interested in enabling DTVV can reach out to support@verygoodsecurity.com for assistance.\n\nTo avoid declines, merchants and acquirers must ensure that:\n- TAVV and DTVV are new and unique for each authorization request\n- TAVV and DTVV are one-time use and not stored beyond the authorization request\n- The TAVV, DTVV, and electronic commerce indicator values provided by the token requester are unchanged when submitted for an authorization request\n"},"value":{"type":"string"},"eci":{"type":"string","description":"An Electronic Commerce Indicator (ECI) is a code that indicates the type of electronic transaction and the result of authentication for a payment.\n"}}},"MetadataResponse":{"type":"object","title":"MetadataResponse","properties":{"observability":{"$ref":"#/components/schemas/Observability"}},"required":["observability"]},"Observability":{"type":"object","title":"Observability","properties":{"trace_id":{"type":"string"},"client_id":{"type":"string"},"vault_id":{"type":"string"},"account_id":{"type":"string"},"fingerprint":{"type":"string"}},"required":["trace_id","client_id","vault_id","account_id","fingerprint"]},"ErrorResponse":{"properties":{"errors":{"items":{"properties":{"path":{"type":"string","title":"Path"},"summary":{"type":"string","title":"Summary"},"detail":{"type":"string","title":"Detail"},"error_code":{"type":"string","title":"Error Code"}},"type":"object","title":"Error"},"type":"array","title":"Errors","description":"A list of errors","required":["detail","error_code"]},"meta":{"$ref":"#/components/schemas/MetadataResponse","title":"Meta"}},"type":"object","title":"ErrorResponse","required":["errors","meta"]}}},"paths":{"/cards":{"post":{"tags":["Wallet Decryption"],"summary":"Create a card","description":"The Create Card allows clients to register a digital wallet credential in the Credential Management Platform (CMP) using an encrypted wallet payment token. Supported wallet types are Apple Pay and Google Pay. `encrypted_payment_data.wallet_type` selects the wallet: `apple_pay` (the default when it is omitted) or `google_pay`.\n\nThe request accepts the encrypted wallet payload, which is securely decrypted by VGS to extract the underlying credential details and create a card linked to a specific account.\n\nThe `payment_method` object (`display_name`, `network`, `type`) is optional in the request. If these fields are provided, their values will be echoed back in the response. If they are not included in the request, they will not be returned.\n\nThe `pan` field is returned only to callers with the `cards:read-pci` scope.\n\n## Apple Pay\n\nSend the Apple Pay payment token fields under `encrypted_payment_data`. Each request results in the creation of a new card and returns a 201 response with a new Card ID, even if the same DPAN or MPAN is submitted multiple times. Duplicate detection and deduplication logic are not supported for Apple Pay cards.\n\n## Google Pay\n\nSend the Google Pay ECv2 token fields (`protocolVersion`, `signature`, `intermediateSigningKey`, `signedMessage`) directly under `encrypted_payment_data`, exactly as received from Google Pay, with `wallet_type` set to `google_pay`.\n\n**Setup.** VGS enables Google Pay decryption for your account and provides your Gateway Merchant ID. The Gateway Merchant ID is generated when Google Pay decryption is first enabled and does not change. In your Google Pay integration, request `PAYMENT_GATEWAY` tokenization with `gateway` set to `verygoodsecurity` and `gatewayMerchantId` set to your Gateway Merchant ID. Do not send the Gateway Merchant ID to VGS as a request field: Google includes it inside the encrypted token.\n\n**Checks.** For each request, VGS:\n- checks that Google Pay decryption is enabled for the account (otherwise `403 google-pay-decryption-disabled`);\n- verifies Google's signatures and the intermediate signing key, including its expiry, decrypts the payload, and checks that the payload has not expired (any failure returns `422 decryption-failed`);\n- checks that the Gateway Merchant ID inside the token is the account's Gateway Merchant ID (otherwise `403 gateway-merchant-id-mismatch`);\n- validates the decrypted card: the card number length, and that the card is not more than 12 months past its expiry date (otherwise `422 validation-failed`).\n\n**DPAN and FPAN.** A token with `authMethod` `CRYPTOGRAM_3DS` contains a device PAN (DPAN) and creates a card with `token_type` `dpan`. The response includes the single-use `cryptogram` and the token's `message_id` in `wallet_details`. A token with `authMethod` `PAN_ONLY` contains the funding PAN (FPAN) and creates a card with `token_type` `pan`. The response includes `message_id` and no cryptogram.\n\n**Duplicate Card Detection.** Duplicate card detection is not supported for encrypted Google Pay tokens. Each Create Card request creates a new card object with a unique `card_id`, even if the same card was previously stored.\n\n**Request handling.** Properties that are not part of the request schema are ignored. Numbers sent for string fields are accepted and converted to strings. Field size limits are listed in the request schema: `signature` up to 256 characters, `intermediateSigningKey.signedKey` up to 4,096 characters, `intermediateSigningKey.signatures` up to 10 items of up to 256 characters each, and the `encryptedMessage` value inside `signedMessage` up to 40,000 characters. Requests that exceed these limits are rejected with `422 validation-failed`.\n","requestBody":{"required":true,"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/EncryptedCardResourceRequest"}}}},"responses":{"201":{"description":"Card created","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/CardResourceResponse"}}}},"400":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"The request was invalid: the body is not valid JSON, or a field has a value its type does not allow. For Google Pay this includes a `protocolVersion` other than `ECv2`, a `payment_method.type` other than `UNKNOWN`, `CREDIT`, `DEBIT` or `PREPAID`, and a `wallet_type` other than `apple_pay` or `google_pay`. These errors are returned with `error_code` `validation-failed`.\n"},"401":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"No credentials were provided, or the provided credentials were expired."},"403":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Valid credentials were provided, but they do not permit access to this resource.\n\nFor Google Pay, also returned when Google Pay decryption is not enabled for the account (`google-pay-decryption-disabled`), or when the Gateway Merchant ID inside the decrypted token is not the account's Gateway Merchant ID (`gateway-merchant-id-mismatch`).\n"},"404":{"description":"The account could not be found.","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"The server was unable to process the request because it contains invalid data.\n\nFor Google Pay:\n- `decryption-failed` covers every problem with the token itself: an invalid signature or intermediate signing key, an expired intermediate signing key, a payload that cannot be decrypted, an expired payload, and a decrypted payload with missing or invalid fields. Decryption errors have no `summary`.\n- `validation-failed` is returned when a required request field is missing, when a field exceeds its maximum size (see the request schema), when the decrypted card number has an invalid length, or when the decrypted card is more than 12 months past its expiry date. A card that expired more recently is accepted.\n"},"429":{"description":"Google Pay only. The wallet decryption service did not respond in time. Retry after the number of seconds in the `Retry-After` header. This is not a per-client rate limit.\n","headers":{"Retry-After":{"description":"Number of seconds to wait before retrying.","schema":{"type":"integer"}}},"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error. For Google Pay, also returned when the wallet decryption service times out on its side, or when the account's Gateway Merchant ID cannot be read.\n","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable. A service the request depends on is temporarily unavailable; retry later. For Google Pay, this includes the wallet decryption service and its decryption keys, and a token whose integrity (MAC) check fails during decryption.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get a card

> The Get API allows clients to retrieve details for a specific digital wallet credential using its unique cardID.\
> \
> The response returns the stored card attributes derived from the decrypted wallet payload, including last four digits, expiration details, and any request-level attributes persisted at creation (such as \`payment\_method\`, if provided). If \`payment\_method\` fields were included during creation, they will be returned in the response. If not provided, they will not be present.\
> \
> \`cryptogram\`, \`currencyCode\`, \`transactionId\`, and \`amount\` are not returned in the GET response, as these are single-use wallet artifacts and are not persisted.\
> \
> For Google Pay cards, \`wallet\_details\` contains \`payment\_data\_type\`, \`auth\_method\`, \`message\_id\` and, if it was provided, \`payment\_method\`. \`message\_id\` is the \`messageId\` of the Google Pay token stored for the card. The single-use \`cryptogram\` is returned only in the Create Card response.\
> \
> The \`pan\` field is returned only to callers with the \`cards:read-pci\` scope.<br>

```json
{"openapi":"3.1.0","info":{"title":"VGS Card Management Platform (CMP) API - POST /cards (encrypted only)","version":"doc version 2.3.0 | API version 1.0.0"},"tags":[{"name":"Wallet Decryption"}],"servers":[{"url":"https://sandbox.vgsapi.com","description":"Sandbox environment server used for integration and testing. Uses network sandboxes in addition to mocked data sources."},{"url":"https://vgsapi.com","description":"Live environment server used for production workloads."}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CardResourceResponseGet":{"title":"CardResourceResponseGet","type":"object","properties":{"data":{"properties":{"id":{"type":"string","title":"id","description":"Resource ID"},"type":{"type":"string","title":"Type","default":"cards"},"attributes":{"$ref":"#/components/schemas/CardResourceAttributesGet"}},"type":"object","required":["id","type","attributes"]},"metadata":{"$ref":"#/components/schemas/MetadataResponse"}},"additionalProperties":false,"required":["data","metadata"]},"CardResourceAttributesGet":{"type":"object","title":"CardResourceAttributesGet","description":"Full card information with extra fields like bin, last4, capabilities etc","properties":{"pan":{"type":"string","maxLength":19,"minLength":14,"title":"Primary Account Number","description":"The primary account number of the card. This field is omitted from non-PCI scope payload responses."},"cvc_status":{"type":"string","maxLength":10,"minLength":3,"title":"CVC Status","description":"The is an indicator that CVC was present during Create Card. Returned only to callers with the `cards:read-pci` scope. Wallet cards return `not-set`.\n"},"exp_month":{"type":"integer","maximum":12,"minimum":1,"title":"Expiration Month","description":"The expiration month of the card, as an integer between 1 and 12, where 1 is January, and 12 is December.\n"},"exp_year":{"type":"integer","maximum":99,"minimum":0,"title":"Expiration Year","description":"The expiration year of the card, as a 1-2 digit integer representing the decade portion of the year.\n"},"cardholder":{"$ref":"#/components/schemas/Cardholder","description":"Information about the cardholder, including name, email, address, and phone number. To achieve a high success rate with Amex Network Tokens, include card holder phone number and email address.\n"},"token_type":{"$ref":"#/components/schemas/TokenType"},"wallet_type":{"$ref":"#/components/schemas/WalletType"},"pan_alias":{"type":"string","title":"PAN Alias","description":"The PAN alias is a reference identifier that stores or securely holds the actual PAN value.\n"},"cvc_alias":{"type":"string","maxLength":35,"minLength":30,"title":"CVC Alias","description":"The CVC Alias is a reference identifier that stores or securely holds the actual CVC value.\n"},"bin":{"type":"string","minLength":6,"maxLength":8,"description":"The leading six or eight digits of the related card are the issuer identification number (IIN) sometimes referred to as the bank identification number (BIN)."},"first8":{"type":"string","minLength":8,"maxLength":8,"description":"8 character Bank Identification Number (BIN). The first8 field will be returned in the card object only for Visa and Mastercard cards."},"last4":{"type":"string","minLength":4,"maxLength":4,"description":"Last 4 characters of the primary account number (pan/fpan)"},"card_fingerprint":{"type":"string","description":"Card Fingerprint"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"card_brand":{"type":"string","description":"The name of the card brand. Returned when card enrichment provides it."},"card_type":{"type":"string","description":"The card type (credit, debit or prepaid). Returned when card enrichment provides it."},"enrollment_source":{"$ref":"#/components/schemas/EnrollmentSource"},"enriched_attributes":{"$ref":"#/components/schemas/EnrichedCardAttributes","description":"Enriched card attributes containing additional metadata about the card. This data provides detailed information about the card's capabilities, issuer details, and transaction support features."},"wallet_details":{"$ref":"#/components/schemas/WalletDetailsGet","description":"Details about the digital wallet associated with the card."}},"required":["exp_month","exp_year","token_type","wallet_type","pan_alias","bin","first8","last4","card_fingerprint","created_at","updated_at","wallet_details"]},"Cardholder":{"type":"object","properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name","description":"The cardholder name."},"company":{"type":"string","maxLength":255,"title":"Company","description":"Company name."},"phone":{"type":"string","maxLength":16,"title":"Phone","description":"The phone number related to the card."},"email":{"type":"string","format":"email","description":"Email address of the account holder."},"address":{"$ref":"#/components/schemas/Address"}},"description":"Information about the cardholder, including name, email, address, and phone number. To achieve a high success rate with Amex Network Tokens, include card holder phone number and email address.\n"},"Address":{"properties":{"address1":{"type":"string","maxLength":255,"description":"The first line of the address related to the card."},"address2":{"type":"string","maxLength":255,"description":"The second line of the address related to the card."},"address3":{"type":"string","maxLength":255,"description":"The third line of the address related to the card."},"address4":{"type":"string","maxLength":255,"description":"The fourth line of the address related to the card."},"city":{"type":"string","maxLength":255,"description":"The city of the address related to the card."},"region":{"type":"string","maxLength":255,"description":"The region of the address related to the card."},"postal_code":{"type":"string","maxLength":10,"description":"The postal code of the address related to the card."},"country":{"type":"string","maxLength":3,"minLength":2,"description":"The country of the address related to the card. This must be the ISO 3166-1 alpha-2 or the ISO 3166-1 alpha-3 code. (ISO 3166-1)[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3]\n"}},"type":"object","title":"Address"},"TokenType":{"type":"string","description":"The type of token being used for the card.\n- `dpan`: device PAN. Apple Pay DPAN, or a Google Pay token with `authMethod` `CRYPTOGRAM_3DS`.\n- `mpan`: Apple Pay merchant token.\n- `pan`: funding PAN. A Google Pay token with `authMethod` `PAN_ONLY`.\n","enum":["dpan","mpan","pan"]},"WalletType":{"type":"string","description":"The digital wallet from which the card request originated.","enum":["apple_pay","google_pay"]},"EnrollmentSource":{"type":"string","description":"Indicates whether the card was loaded from an existing backbook portfolio\nor newly tokenized. Set by the server based on the `processing` query\nparameter at card creation time and is read-only.\n","enum":["backbook","frontbook"]},"EnrichedCardAttributes":{"type":"object","description":"Enriched card attributes from the card-attributes service","properties":{"card_properties":{"type":"object","properties":{"card_number_length":{"type":"integer","description":"The length of the Primary Account Number (PAN) printed on the front of the card. Available only for Card Attributes service subscribers.\n"},"card_segment_type":{"type":"string","description":"Indicator of Business, Consumer, Commercial, Government BINs. Available only for Card Attributes service subscribers."},"level_2":{"type":"boolean","description":"Indicator of Level 2 interchange rate eligibility.\n"},"level_3":{"type":"boolean","description":"Indicator of Level 3 interchange rate eligibility.\n"},"virtual_card":{"type":"boolean","description":"Indicates if the given BIN range supports virtual card creation. Available only for Card Attributes service subscribers.\n"},"prepaid_card":{"type":"boolean","description":"Indicates a fixed funding source for a card but not necessarily associated with the consumer's checking account. Available only for Card Attributes service subscribers.\n"},"product_name":{"type":"string","description":"The card product name according to the card brand (e.g., Visa Signature, Visa Infinite, Visa Classic). Available only for Card Attributes service subscribers.\n"},"issuer_bin":{"type":"string","description":"Bank Identification Number (BIN) of the issuer of the account. Available only for Card Attributes service subscribers."},"country_letter_code":{"type":"string","description":"ISO country letters that is associated with an ISO 3166-1 alpha-2 code."},"country_name":{"type":"string","description":"Name of the issuing country. Available only for Card Attributes service subscribers."},"country_numeric":{"type":"integer","description":"ISO 3166 numeric country code of the issuing country. Available only for Card Attributes service subscribers."}}},"card_capabilities":{"type":"object","properties":{"reloadable":{"type":"boolean","description":"Indicator of reloadable or non-reloadable prepaid. Available only for Card Attributes service subscribers."},"hsa":{"type":"boolean","description":"Indicates a card attached to a Health Savings Account. Available only for Card Attributes service subscribers."},"fsa":{"type":"boolean","description":"Indicates a card attached to Flexible Spending Account. Available only for Card Attributes service subscribers."},"ebt":{"type":"boolean","description":"Indicates the BIN has Electronic Benefits Transfer (EBT) capabilities. Available only for Card Attributes service subscribers."}}},"bank":{"type":"object","properties":{"issuer_name":{"type":"string","description":"Name of the issuing organization/bank."},"issuer_phone_number":{"type":"string","description":"Phone number of the issuing organization/bank. Available only for Card Attributes service subscribers."},"issuer_website":{"type":"string","description":"Website of the issuing organization/bank. Available only for Card Attributes service subscribers."}}},"additional_card_brands":{"type":"array","description":"Additional card brands, if any, associated with the card. Available only for Card Attributes service subscribers.","items":{"type":"object","required":["card_brand"],"properties":{"card_brand":{"type":"string","description":"The name of the additional card brand. Available only for Card Attributes service subscribers."}}}},"interchange":{"type":"object","properties":{"regulated":{"type":"string","description":"Indicator of the presence of an interchange regulation on a BIN. Available only for Card Attributes service subscribers."}}}}},"WalletDetailsGet":{"type":"object","properties":{"device_manufacturer_identifier":{"type":"string","description":"Device manufacturer identifier for the card in the wallet."},"payment_data_type":{"$ref":"#/components/schemas/PaymentDataType"},"auth_method":{"$ref":"#/components/schemas/GooglePayAuthMethod"},"message_id":{"type":"string","description":"Google Pay only. The `messageId` of the Google Pay token stored for the card."},"merchant_token_identifier":{"type":"string","description":"Identifier for the merchant token associated with the wallet transaction"},"payment_method":{"$ref":"#/components/schemas/WalletPaymentMethod"}},"additionalProperties":false},"PaymentDataType":{"type":"string","description":"Type of the payment data encoding. Apple Pay: `3DSecure` or `MerchantToken`. Google Pay: `3DSecure` for a `CRYPTOGRAM_3DS` token, `PAN_ONLY` for a `PAN_ONLY` token.\n","enum":["3DSecure","MerchantToken","PAN_ONLY"]},"GooglePayAuthMethod":{"type":"string","description":"Google Pay only. The `authMethod` of the Google Pay token.","enum":["CRYPTOGRAM_3DS","PAN_ONLY"]},"WalletPaymentMethod":{"type":"object","description":"Details about the payment method used","additionalProperties":false,"properties":{"display_name":{"type":"string","maxLength":255,"minLength":1,"description":"Human-readable payment method description"},"network":{"type":"string","maxLength":255,"minLength":1,"description":"Payment card network"},"type":{"type":"string","maxLength":255,"minLength":1,"description":"Card type"}}},"MetadataResponse":{"type":"object","title":"MetadataResponse","properties":{"observability":{"$ref":"#/components/schemas/Observability"}},"required":["observability"]},"Observability":{"type":"object","title":"Observability","properties":{"trace_id":{"type":"string"},"client_id":{"type":"string"},"vault_id":{"type":"string"},"account_id":{"type":"string"},"fingerprint":{"type":"string"}},"required":["trace_id","client_id","vault_id","account_id","fingerprint"]},"ErrorResponse":{"properties":{"errors":{"items":{"properties":{"path":{"type":"string","title":"Path"},"summary":{"type":"string","title":"Summary"},"detail":{"type":"string","title":"Detail"},"error_code":{"type":"string","title":"Error Code"}},"type":"object","title":"Error"},"type":"array","title":"Errors","description":"A list of errors","required":["detail","error_code"]},"meta":{"$ref":"#/components/schemas/MetadataResponse","title":"Meta"}},"type":"object","title":"ErrorResponse","required":["errors","meta"]}}},"paths":{"/cards/{card_id}":{"get":{"tags":["Wallet Decryption"],"summary":"Get a card","description":"The Get API allows clients to retrieve details for a specific digital wallet credential using its unique cardID.\n\nThe response returns the stored card attributes derived from the decrypted wallet payload, including last four digits, expiration details, and any request-level attributes persisted at creation (such as `payment_method`, if provided). If `payment_method` fields were included during creation, they will be returned in the response. If not provided, they will not be present.\n\n`cryptogram`, `currencyCode`, `transactionId`, and `amount` are not returned in the GET response, as these are single-use wallet artifacts and are not persisted.\n\nFor Google Pay cards, `wallet_details` contains `payment_data_type`, `auth_method`, `message_id` and, if it was provided, `payment_method`. `message_id` is the `messageId` of the Google Pay token stored for the card. The single-use `cryptogram` is returned only in the Create Card response.\n\nThe `pan` field is returned only to callers with the `cards:read-pci` scope.\n","parameters":[{"name":"card_id","in":"path","required":true,"schema":{"type":"string","title":"Card Id"}}],"responses":{"200":{"description":"Item requested by ID","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/CardResourceResponseGet"}}}},"401":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"No credentials were provided, or the provided credentials were expired."},"403":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Valid credentials were provided, but they do not permit access to this resource."},"404":{"content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Resource not found."},"500":{"description":"Internal Server Error","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"503":{"description":"Service Unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.verygoodsecurity.com/cmp/developer-resources/api/wallet-decryption.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
