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.

RequestsAnchorIcon

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.
  1. 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"
        }
    }'

ResponsesAnchorIcon

The client API returns JSON (or a JavaScript function invocation, in the case of JSONP).
  1. JSON
{
  "creditCards": [
    {
      "type": "CreditCard",
      "nonce": "A_PAYMENT_METHOD_NONCE",
      "description": "ending in 11",
      "details": {
        "cardType": "Visa",
        "lastTwo": "11"
      }
    }
  ]
}
```json
## 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:

If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more