Bring Your Own Token
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
Required parameters
The following parameters are always required:
- amount
- credit_card.number (token)
- credit_card.expiration_date (token)
- credit_card.network_tokenization_attributes.cryptogram
For more information on what should be passed in the cryptogram field, see the "Customer Initiated Transactions" and "Merchant Initiated Transactions" fields below.
Optional parameters
The following parameters are always optional:
- credit_card.network_tokenization_attributes.ecommerce_indicator
- credit_card.network_tokenization_attributes.token_requestor_id
Customer initiated transactions
- Python
result = gateway.transaction.sale({
"amount": "10.00",
"credit_card": {
"number": "4111111111111111",
"expiration_date": "05/2027",
"network_tokenization_attributes": {
"cryptogram": "/wAAAAAAAcb8AlGUF/1JQEkAAAA=",
"token_requestor_id": "45310020105",
"ecommerce-indicator": "05"
}
}
})
if result.is_success:
# See result.transaction for details
# result.transaction.processed_with_network_token = True
else:
# Handle errorsMerchant initiated transactions
When creating a merchant initiated transaction (MIT) or subsequent transaction, a network transaction identifier (NTI) and related parameters are required. The cryptogram must still be present, but a static cryptogram value of "STATIC_RECURRING" should be included in place of a network-issued cryptogram.
Required parameters
- transaction_source
=
recurring,unscheduled, orinstallment - external_vault.status
=
vaulted - external_vault.previous_network_transaction_id
- credit_card.network_tokenization_attributes.cryptogram
- Python
result = gateway.transaction.sale({
"amount": "10.00",
"transaction_source": "recurring",
"credit_card": {
"number": "4111111111111111",
"expiration_date": "05/2027",
"network_tokenization_attributes": {
"token_requestor_id": "45310020105",
"ecommerce-indicator": "05",
"cryptogram": "STATIC_RECURRING"
}
},
"external_vault": {
"status": "vaulted",
"previous_network_transaction_id": "45310020105"
}
})
if result.is_success:
# See result.transaction for details
# result.transaction.processed_with_network_token = True
else:
# Handle errors