Description
Retrieve a Braintree Client Token for use with their Drop-In UI or Hosted Fields for securely tokenizing a customer’s credit card.
Requires Braintree Gateway Integration
You must have an active account with our Braintree Gateway which allows storage and handling of credit cards in a PCI Compliant manner utilizing Braintree's Secure Vault.
Braintree also has extensive documentation for testing credit cards in Sandbox which details how you can use different card numbers and amounts to simulate various scenarios.
Parameters
Name | Description | Type | Presence | Location | Limitations |
---|---|---|---|---|---|
| The ID of the Office for the Braintree Gateway account you wish to use | Integer | Required | URI | |
| A label with which one can refer to this card. | String | Optional | Body | 20 characters max. |
| Name of the card holder. | String | Required | Body | |
| Full credit card number. | String | Required | Body | Numbers only |
| The 2-digit card expiration month | String | Required | Body | |
| The 4-digit card expiration Year | String | Required | Body | |
| 3 or 4 digit verification code | String | Optional | Body | |
| ID of an Address belonging to the Client that is the billing address for this credit card | Integer | Required | Body | |
| Integer | Required | Body | ||
| Customer's IPv4 address | String | Optional | Body |
Examples
Request | Response |
---|---|
| |
Create a single credit card using a phone number and an address that was previously created for this Client. { "credit_cards": [ { "label": "Chase Sapphire Reserve", "name": "Ned Flanders", "number": "4111111111111111", "expiration_month": "12", "expiration_year": "2021", "verification_code": "789", "address_id": 645263, "phone_number_id": 294655, "ip_address": "37.235.140.72" } ] } | { "credit_cards": [ { "id": 22528, "expiration_month": "12", "last_digits": "1111", "phone_number": { "phone_number": { "id": 294655, "callable_id": 168019, "callable_type": "Client", "country_code": "1", "number": "5550123", "extension": null, "label": "home", "created_at": "2017-12-15T00:12:21Z", "updated_at": "2017-12-15T00:20:56Z", "legacy_id": null, "imported_filename": null, "imported_at": null, "deleted_at": null, "area_code": null, "raw_num": "5550123", "is_primary": false } }, "primary": false, "card_company": "Visa", "expiration_year": "21", "name": "Ned Flanders", "label": "Chase Sapphire Reserve", "association": { "name": "Ned Flanders", "id": 168019, "url": "/clients/168019", "phone_numbers": [ { "label": "cell", "extension": null, "number": "555-0573", "id": "294657", "country_code": "1", "primary": false }, { "label": "work", "extension": "5", "number": "555-0987", "id": "294656", "country_code": "1", "primary": false }, { "label": "home", "extension": null, "number": "5550123", "id": "294655", "country_code": "1", "primary": false } ], "email_addresses": [] }, "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": 645263, "street_address": "742 Evergreen Terrace" }, "url": "/clients/168019/credit_cards/22528" } ] } |
Create a multiple credit cards using phone numbers and addresses that were previously created for this Client. { "credit_cards": [ { "label": "Chase Sapphire Reserve", "name": "Ned Flanders", "number": "4111111111111111", "expiration_month": "12", "expiration_year": "2021", "verification_code": "789", "address_id": 645263, "phone_number_id": 294655, "ip_address": "37.235.140.72" }, { "label": "AmEx Centurion", "name": "Ned Flanders", "number": "378282246310005", "expiration_month": "12", "expiration_year": "2021", "verification_code": "7809", "address_id": 645263, "phone_number_id": 294655, "ip_address": "37.235.140.72" } ] } | { "credit_cards": [ { "id": 22530, "expiration_month": "12", "last_digits": "1111", "phone_number": { "phone_number": { "id": 294655, "callable_id": 168019, "callable_type": "Client", "country_code": "1", "number": "5550123", "extension": null, "label": "home", "created_at": "2017-12-15T00:12:21Z", "updated_at": "2017-12-15T00:20:56Z", "legacy_id": null, "imported_filename": null, "imported_at": null, "deleted_at": null, "area_code": null, "raw_num": "5550123", "is_primary": false } }, "primary": false, "card_company": "Visa", "expiration_year": "21", "name": "Ned Flanders", "label": "Chase Sapphire Reserve", "association": { "name": "Ned Flanders", "id": 168019, "url": "/clients/168019", "phone_numbers": [ { "label": "cell", "extension": null, "number": "555-0573", "id": "294657", "country_code": "1", "primary": true }, { "label": "work", "extension": "5", "number": "555-0987", "id": "294656", "country_code": "1", "primary": false }, { "label": "home", "extension": null, "number": "5550123", "id": "294655", "country_code": "1", "primary": false } ], "email_addresses": [] }, "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": 645263, "street_address": "742 Evergreen Terrace" }, "url": "/clients/168019/credit_cards/22530" }, { "id": 22531, "expiration_month": "12", "last_digits": "0005", "phone_number": { "phone_number": { "id": 294655, "callable_id": 168019, "callable_type": "Client", "country_code": "1", "number": "5550123", "extension": null, "label": "home", "created_at": "2017-12-15T00:12:21Z", "updated_at": "2017-12-15T00:20:56Z", "legacy_id": null, "imported_filename": null, "imported_at": null, "deleted_at": null, "area_code": null, "raw_num": "5550123", "is_primary": false } }, "primary": false, "card_company": "AMEX", "expiration_year": "21", "name": "Ned Flanders", "label": "AmEx Centurion", "association": { "name": "Ned Flanders", "id": 168019, "url": "/clients/168019", "phone_numbers": [ { "label": "cell", "extension": null, "number": "555-0573", "id": "294657", "country_code": "1", "primary": true }, { "label": "work", "extension": "5", "number": "555-0987", "id": "294656", "country_code": "1", "primary": false }, { "label": "home", "extension": null, "number": "5550123", "id": "294655", "country_code": "1", "primary": false } ], "email_addresses": [] }, "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": 645263, "street_address": "742 Evergreen Terrace" }, "url": "/clients/168019/credit_cards/22531" } ] } |