Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info

This section does not apply to Affiliates. If you are an affiliate please skip to

xxxxxx

Creating Orders (Affiliates).


Prerequisites

As mentioned earlier, you must have a Braintree Gateway in order to safely and securely store and charge credit/debit cards. Before attempting to

utilize the /wiki/spaces/API/pages/4129298 please

charge credit cards please ensure that Ticket Evolution has completed your Braintree Gateway setup.

Testing Credit Cards in Sandbox

Test

Card Numbers

Cards

The Ticket Evolution API Sandbox connects to Braintree’s Sandbox environment so that you can test creating credit cards and purchases without having to use a real credit card or worry about incurring any charges. The Braintree Sandbox only accepts test credit card numbers, nonces, and tokens and they provide a list of different cards, nonces, and tokens that do and do not results in errors.

Link: Braintree Sandbox test credit card numbers

Test Amounts

The Braintree Sandbox utilizes different test amounts to allow you to test various scenarios such as successful and unsuccessful charges. Please review their list of test amounts to ensure you are submitting the correct order total to match your desired test situation.

Link: Braintree Sandbox test amounts

Test CVV/CID Numbers

The Braintree Sandbox utilizes different CVV/CID values in order to test different scenarios.

Link: Braintree Sandbox test CVV/CID numbers

Testing the Address Verification System

Lastly, you can test different error and success situations with the Address Verification System (AVS) by using different street addresses and zip codes for the billing address of a card.

Link: Braintree Sandbox test AVS test values

Creating a Credit Card

If your Client is using a new credit card that is not yet stored in the Braintree Vault it is recommended that you create the credit card before submitting the order. This allows you to programmatically review the response to ensure that the card is valid and that the CVV/CID response and AVS response are in line with your settings. To ensure that only valid cards are stored in your Secure Vault, a $1.00 authorization will be made and then immediately voided, as is standard practice.

Since we have already created a Client, as well as some addresses and phone numbers for that Client in the previous step we will utilize those as the billing address and phone number for the credit card we will create. We will use client_id 168188, address_id 645334, and phone_number_id 294725.

Code Block
languagejs
themeMidnight
titleCreate a credit card using cURL
linenumberstrue
curl -i \ -X POST \ -H "X-Signature: 0zJ/cvUflNrvnoAfa2Rva6eIF2FPdKThch6W1r4wRJ4=" \ -H "X-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json" \ -d '{ "credit_cards": [ { "label": "Chase Sapphire Reserve", "name": "Ned Flanders", "number": "4111111111111111", "expiration_month": "12", "expiration_year": "2021

We recommend using the methods Braintree provides such as their Drop-in UI or Hosted Fields to retrieve either a reusable token or a single-use nonce and pass to use in way that does not require sending other credit card information through our API. The token or nonce can be include in the payments portion of the Orders / Create body.

Single-use Nonce

Code Block
languagejson
"payments": [
  {
    "payment_method_nonce": "AvgRPFtHJPHpQVdNiBX5n1G8eASTrjbk",
    
"
verification_code
type": "
789", "address_id": 645334, "phone_number_id": 294725, "ip_address": "37.235.140.72
credit_card"
  
}
] }' \ --url 'https://api.sandbox.ticketevolution.com/v9/clients/168188/credit_cards?' Code Block
languagephp
themeMidnight
titleCreate a credit card using ticketevolution-php
linenumberstrue
// Values from previous requests $client_id = 168188; $address_id = 645334; $phone_number_id = 294725; // Create a Credit Card $credit_card = new stdClass(); $credit_card->label = 'work'; $credit_card->label = 'Chase Sapphire Reserve'; $credit_card->name = 'Ned Flanders'; $credit_card->number = '4111111111111111'; $credit_card->expiration_month = '12'; $credit_card->expiration_year = '2021'; $credit_card->verification_code = '789'; $credit_card->address_id = $address_id; $credit_card->phone_number_id = $phone_number_id; $credit_card->ip_address = '37.235.140.72'; $response = $client->createClientCreditCards([ 'client_id' => $client_id, 'credit_cards' => [$credit_card] ]);
],

Reusable Token

Code Block
language
jsthemeMidnighttitleResponse from creating the credit card abovelinenumberstrue{ "credit_cards
json
"payments": [
  
{
    
"id": 22566, "expiration_month": "12", "last_digits
"payment_method_token": "
1111
7R5kLg83",
"phone_number": {

    
"phone_number
"
: { "id": 294725, "callable_id": 168188, "callable_type": "Client", "country_code": "1", "number": "5550573", "extension": null, "label": "cell", "created_at": "2017-12-19T19:43:44Z", "updated_at": "2017-12-19T21:06:48Z", "legacy_id": null, "imported_filename": null, "imported_at": null, "deleted_at": null, "area_code": null, "raw_num": "5550573", "is_primary": true } }, "primary": false, "card_company": "Visa", "expiration_year": "21", "name": "Ned Flanders", "label": "Chase Sapphire Reserve", "association": { "name": "Ned Flanders", "id": 168188, "url": "/clients/168188", "phone_numbers": [ { "label": "cell", "extension": null, "number": "5550573", "id": "294725", "country_code": "1", "primary": false }, { "label": "work", "extension": "5", "number": "555-0987", "id": "294724", "country_code": "1", "primary": false }, { "label": "home", "extension": null, "number": "555-0123", "id": "294723", "country_code": "1", "primary": false } ], "email_addresses": [ { "address": "theleftorium@example.com", "label": "work", "id": "208224", "primary": true }, { "address": "nedflanders@example.com", "label": "home", "id": "208223", "primary": false } ] }, "address": { "po_box": false, "label": "home", "country_code": "US", "extended_address": null, "longitude": null, "region": "OR", "primary": false, "latitude": null, "locality": "Springfield", "name": "Ned Flanders", "postal_code": "97475", "id": 645334, "street_address": "742 Evergreen Terrace" }, "url": "/clients/168188/credit_cards/22566" } ] }

Previous: XXX

Next: YYY
type": "credit_card"
  }
],