Client API
The Client API is an HTTP API for handling different types of payment methods in a unified way. It accepts details for different payment method types and returns transactable payment method nonces. The Braintree iOS, Android, and JavaScript SDKs use the Client API to tokenize, vault, and retrieve supported payment methods.Requests
All requests are authenticated with an
authorization fingerprint that
grants limited authorization safe for use on an untrusted client. Requests may be either GET or POST
depending on endpoint, and should have an Accept: application/json
header. GET params
should be URL-encoded. POST requests must send JSON with a
Content-Type: application/json
header.
- bash
curl -X POST https://api.braintreegateway.com/merchants/MERCHANT_ID/client_api/v1/payment_methods/credit_cards \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"authorizationFingerprint": AUTHORIZATION_FINGERPRINT,
"creditCard": {
"number": "4111111111111111",
"expirationDate": "01/19"
}
}'
Responses
The client API returns JSON (or a JavaScript function invocation, in the case of
JSONP).
- JSON
{
"creditCards": [
{
"type": "CreditCard",
"nonce": "A_PAYMENT_METHOD_NONCE",
"description": "ending in 11",
"details": {
"cardType": "Visa",
"lastTwo": "11"
}
}
]
}
## Errors
Errors are indicated via HTTP status codes and error object responses.
Validation and authorization errors are returned with developer-facing information about what went wrong. The basic format is:
`fieldErrors` is a nested structure that may contain field-level errors: