Overview
Through Bring Your Own Token (BYOT), merchants who tokenize cards with another Payment Service Provider (PSP) or who vault Network Tokens themselves can use their existing Network Tokens with Braintree.
Creating transactions
Creating a transaction with a network token is a two-step process. First, a network token single-use payment method must be created using the tokenizeNetworkToken mutation. The response will contain the single-use payment method ID which will then be used with the authorizeCreditCard or chargeCreditCard mutation to create the transaction. The required parameters differ based on whether a customer initiated transaction (CIT) or a merchant initiated transaction (MIT) is being created.
Customer initiated transactions
This flow is used for all CIT transactions including the first in a recurring series.
Step 1: Create single-use payment method
The tokenizeNetworkToken mutation is used to create a single-use payment method. The response will contain the single-use payment method ID which will then be used to create a transaction.
Required parameters
-
Network token
expirationMonthandexpirationYear - Network token
number cryptogramorigin= "NETWORK_TOKEN"sourceCardLast4Refer to NetworkTokenInput for additional detail.- Mutation
mutation TokenizeNetworkToken($input: TokenizeNetworkTokenInput!) { tokenizeNetworkToken(input: $input) { paymentMethod { id usage } } }- Variables
{ "input": { "clientMutationId": "abc123", "networkToken": { "expirationYear": 2024, "expirationMonth": 12, "cryptogram": "/wAAAAAAAcb8AlGUF/1JQEkAAAA=", "number": 4111111111111111, "originDetails": { "origin": "NETWORK_TOKEN", "sourceCardLast4": "1234" } } } }- Response
{ "data": { "tokenizeNetworkToken": { "paymentMethod": { "id": "id_of_payment_method", "usage": "SINGLE_USE" } } }, "extensions": { "requestId": "a-uuid-for-the-request" } }
Step 2: create transaction
The authorizeCreditCard or chargeCreditCard mutation is then used to create the
transaction providing the paymentMethodIdobtained in step 1.
- Mutation
mutation ChargeCreditCard($input: ChargeCreditCardInput!) {
chargeCreditCard(input: $input) {
transaction {
id
status
paymentMethodSnapshot {
__typename
... on CreditCardTransactionDetails {
processedWithCardOnFileNetworkToken
}
}
}
}
}- Variables
{ "input": { "paymentMethodId": "id_of_payment_method", "transaction": { "amount": "10.00" } } }- Response
{ "data": { "chargeCreditCard": { "transaction": { "id": "id_of_transaction", "status": "SUBMITTED_FOR_SETTLEMENT", "paymentMethodSnapshot": { "__typename": "CreditCardTransactionDetails", "processedWithCardOnFileNetworkToken": true } } } }, "extensions": { "requestId": "a-uuid-for-the-request" } }Merchant initiated transactions
This flow is to be used for all MIT transactions including subsequent transactions in a recurring series.
Step 1: Create single-use payment method
The tokenizeNetworkToken mutation is used to create a
single-use payment method. The response will contain the single-use payment method ID which will then be used to
create a transaction.
A cryptogram is not required for the MIT flow.
Required parameters
-
Network token
expirationMonthandexpirationYear - Network token
number origin= "NETWORK_TOKEN"sourceCardLast4Refer to NetworkTokenInput for additional detail.
- Mutation
mutation TokenizeNetworkToken($input: TokenizeNetworkTokenInput!) {
tokenizeNetworkToken(input: $input) {
paymentMethod {
id
usage
}
}
}- Variables
{ "input": { "clientMutationId": "abc123", "networkToken": { "expirationYear": 2024, "expirationMonth": 12, "number": 4111111111111111, "originDetails": { "origin": "NETWORK_TOKEN", "sourceCardLast4": "1234" } } } }- Response
{ "data": { "tokenizeNetworkToken": { "paymentMethod": { "id": "id_of_payment_method", "usage": "SINGLE_USE" } } }, "extensions": { "requestId": "a-uuid-for-the-request" } }Step 2: create transaction
The authorizeCreditCard or
chargeCreditCard mutation is then used to create the
transaction providing the paymentMethodId obtained in step 1.
As a cryptogram is not provided in the MIT flow, additional parameters are required including a network transaction (NTI) using verifyingNetworkTransactionId.
Required parameters
paymentInitiator= "RECURRING", "UNSCHEDULED", or "INSTALLMENT"externalVault.status= "VAULTED"externalVault.verifyingNetworkTransactionId- Mutation
mutation ChargeCreditCard($input: ChargeCreditCardInput!) { chargeCreditCard(input: $input) { transaction { id status paymentMethodSnapshot { __typename ... on CreditCardTransactionDetails { processedWithCardOnFileNetworkToken } } } } }- Variables
{ "input": { "paymentMethodId": "id_of_payment_method", "transaction": { "amount": "10.00", "paymentInitiator": "RECURRING" }, "options": { "externalVault": { "status": "VAULTED", "verifyingNetworkTransactionId": "123456789012345" } } } }- Response
{ "data": { "chargeCreditCard": { "transaction": { "id": "id_of_transaction", "status": "SUBMITTED_FOR_SETTLEMENT", "paymentMethodSnapshot": { "__typename": "CreditCardTransactionDetails", "processedWithCardOnFileNetworkToken": true } } } }, "extensions": { "requestId": "a-uuid-for-the-request" } }