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
A BYOT transaction can be created using Transaction: Sale with the required network token parameters. The required parameters differ based on the type of BYOT transaction being created.
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
When creating a customer initiated transaction (CIT) or the first in a recurring series, a network-issued cryptogram is required.
- Ruby
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.success? # See result.transaction for details # result.transaction.processed_with_network_token? == true else # Handle errors endMerchant 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
- Ruby
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 => "123456789012345" } ) if result.success? # See result.transaction for details # result.transaction.processed_with_network_token? == true else # Handle errors end