Braintree Integration

This document provides partners to ability to integrate with Braintree for payments.

Creating a Braintree token

If You Have An Existing Braintree Integration

Partners who use Braintree can use the Braintree Grant API to share access to a payment method with Ticketmaster. To share info, Ticketmaster will need access to the partner’s OAuth application to consent to receiving a granted payment method. You can send the link to your application to partnersupport@ticketmaster.com.

If You Do Not Have An Existing Braintree Integration:

Partners who don’t use Braintree have two options to create a Braintree token:

Option 1: Client-side Tokenization using Braintree Client SDK

Partners can use the Braintree Client SDK to collect payment information from users at no additional cost. Braintree provides a client SDK for Android, iOS, and JavaScript.

The client SDK requires authorization for payment method tokenization. Ticketmaster uses a client token for authorization. Your application can request a client token from the Payment Initialization API, which provides initialization information for the client SDK and authenticates your application to communicate directly to Braintree. A new client token should be generated for each request your application sends to Braintree. Client tokens should not be reused.

Once the client SDK is initialized and the customer has submitted payment information, the SDK communicates that information to Braintree and returns a payment token. You can use the payment token as the payment method for the order.

Steps to generate a payment token:

  1. Your app requests a client token from the Payment Initialization API to initialize the client SDK (see Payment Initialization [POST]example below)
  2. The client SDK communicates the client token and payment information to Braintree to generate a payment token
  3. Follow the process outlined in the payment method flow to add the Braintree token as the method of payment for the order

Option 2: Server-side Tokenization using Braintree GraphQL API

You can make a server-side call with the Braintree GraphQL API to generate a Braintree token. You will need to obtain a tokenization key from Ticketmaster to authorize your application to create a payment token. Your application may reuse the tokenization key with each request to generate a Braintree token. You do not need to generate a new key for each request. Send an email to partnersupport@ticketmaster.com to request a tokenization key.

Steps to generate a payment tokens:

  1. Obtain Braintree tokenization key from Ticketmaster
  2. Your app makes a server-side call with the Braintree GraphQL API to generate a payment token (see GraphQL request example below)
  3. Follow the process outlined in the payment method flow to add the Braintree token as the method of payment for the order

Payment Initialization [POST]

partners/v1/payment/token?apikey={apikey}

Polling: No

Parameters

Parameter Description Type Example Required
apikey Your API key string “GkB8Z037ZfqbLCNtZViAgrEegbsrZ6Ne” Yes
cart_id Card identifier. Must be url encoded string “bzJVZURoNit1UkhQQ25pcE5KSHh1K09SVE9lQ0k2RktwSEZFdnAwTlNJYS82ZE5WWldiREtSTQo%3D” Optional *Note: cart_id is optional for US/CA but required for countries outside of US/CA

*Note: If “includeADA” is not specified, then the response will return non-ADA only.

Initialization Response structure:

  • ` initialization ` (array) - Initialization.
    • provider_id (string) - Provider Id
    • client_token (string) - Token

Request Response

https://app.ticketmaster.com/partners/v1/payment/token?apikey=GkB8Z037ZfqbLCNtZViAgrEegbsrZ6Ne
Status 200
{
  "initialization": [
    {
      "provider_id": "BRAINTREE",
      "client_token": "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiJmYTZjNzVkZGI1OTUyNWNlMjcxY2FiMmJiZWI1NjdlYWNhZGQ5MDVkNTc2NzExN2VkZjYzYTg4ZGY2MTkyYTAyfGNyZWF0ZWRfYXQ9MjAxOS0wMy0wNVQyMzowNzo0Ni4yNDM2OTA4ODUrMDAwMFx1MDAyNm1lcmNoYW50X2lkPXc0amd6c3B0N243ejQ2eHNcdTAwMjZwdWJsaWNfa2V5PTk0cG5yaDlteG5taDc1bXgiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvdzRqZ3pzcHQ3bjd6NDZ4cy9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJncmFwaFFMIjp7InVybCI6Imh0dHBzOi8vcGF5bWVudHMuc2FuZGJveC5icmFpbnRyZWUtYXBpLmNvbS9ncmFwaHFsIiwiZGF0ZSI6IjIwMTgtMDUtMDgifSwiY2hhbGxlbmdlcyI6WyJjdnYiXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzL3c0amd6c3B0N243ejQ2eHMvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dH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oib2ZmIiwiYXBwbGVQYXkiOnsic3RhdHVzIjoibW9jayIsImNvdW50cnlDb2RlIjoiVVMiLCJjdXJyZW5jeUNvZGUiOiJVU0QiLCJtZXJjaGFudElkZW50aWZpZXIiOiJtZXJjaGFudC5QYXlzeXNBcHBsZVBheVNhbmRib3giLCJzdXBwb3J0ZWROZXR3b3JrcyI6WyJ2aXNhIiwibWFzdGVyY2FyZCIsImFtZXgiLCJkaXNjb3ZlciJdfX0="
    }
  ]
}

GraphQL request

This will return a Braintree payment token that you can use as the payment method for the order.

curl \

 -H "Content-Type: application/json" \

 -H "Braintree-Version: 2019-01-28" \

 -H "Authorization: Bearer THE_TOKENIZATION_KEY" \

 -X POST https://payments.sandbox.braintree-api.com/graphql \

 -d '{"query": "mutation tokenizeCreditCard($input: TokenizeCreditCardInput!) {tokenizeCreditCard(input: $input) {paymentMethod {id details{__typename ...on CreditCardDetails{last4}}}}}",
  "variables": {
	"input": {
  	"creditCard": {
    	"number": "CARD_NUMBER",
    	"expirationMonth": "02",
    	"expirationYear": "2020",
    	"cvv": "123" // Optional, but recommended
  	}
	}
  }
}'