Customers

Create a customer

Store a customer's details in a customer object to reuse in future payments. When creating a customer, you can link payment instruments – the customer id returned can be passed as a source when making a payment.

NOTE: Specify a default instrument, otherwise the instruments array will not be saved on creation.

Body·
required
application/json

Create a customer

  • email
    Type: string
    max length:  
    255
    Format: email
    required

    The customer's email address

  • name
    Type: string
    max length:  
    255

    The customer's name

  • phone
    Type: object ·

    The customer's phone number

  • metadata
    Type: object

    Allows you to store additional information about a customer. You can include a maximum of 10 key-value pairs. Each key and value can be up to 100 characters long.

  • default
    Type: string

    The ID of the instrument you want to set as this customer's default instrument

Responses
  • application/json
  • 401

    Unauthorized

  • application/json
  • application/json
  • 500

    Internal Error

Request Example for post/customers
curl 'https://{prefix}.api.sandbox.checkout.com/customers' \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "email": "brucewayne@gmail.com",
  "name": "Bruce Wayne",
  "phone": {
    "country_code": "+1",
    "number": "415 555 2671"
  },
  "metadata": {
    "coupon_code": "NY2018",
    "partner_id": 123989
  },
  "default": "src_wmlfc3zyhqzehihu7giusaaawu"
}'
{
  "id": "cus_y3oqhf46pyzuxjbcn2giaqnb44"
}

Get customer details

Returns the details of a customer and their payment instruments.

Path Parameters
  • identifier
    required

    The customer's ID or email

    • Type: string · Customer IDPattern: ^(cus)_(\w{26})$
Responses
  • application/json
  • 401

    Unauthorized

  • 404

    Customer not found

Request Example for get/customers/{identifier}
curl 'https://{prefix}.api.sandbox.checkout.com/customers/{identifier}' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
{
  "id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
  "email": "brucewayne@gmail.com",
  "name": "Bruce Wayne",
  "instruments": [
    {
      "type": "bank_account",
      "id": "src_wmlfc3zyhqzehihu7giusaaawu",
      "fingerprint": "vnsdrvikkvre3dtrjjvlm5du4q",
      "account_number": "13654567455",
      "bank_code": "123-456",
      "currency": "GBP",
      "country": "GB"
    }
  ]
}

Update customer details

Update the details of a customer and link payment instruments to them.

Path Parameters
  • identifier
    Type: string Pattern: ^(cus)_(\w{26})$
    required

    The customer's ID

Body·
required
application/json

The customer's details

  • email
    Type: string
    max length:  
    255
    Format: email

    The email address of the customer

  • name
    Type: string
    max length:  
    255

    The name of the customer

  • phone
    Type: object ·

    The customer's phone number

  • metadata
    Type: object

    Allows you to store additional information about a customer. You can include a maximum of 10 key-value pairs. Each key and value can be up to 100 characters long. Providing metadata in this request will replace any existing stored for this customer.

  • default
    Type: string

    The ID of this customer's default instrument

Responses
  • 204

    Customer updated successfully

  • 401

    Unauthorized

  • 404

    Customer not found

  • application/json
  • application/json
Request Example for patch/customers/{identifier}
curl 'https://{prefix}.api.sandbox.checkout.com/customers/{identifier}' \
  --request PATCH \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
  --data '{
  "email": "brucewayne@gmail.com",
  "name": "Bruce Wayne",
  "phone": {
    "country_code": "+1",
    "number": "415 555 2671"
  },
  "metadata": {
    "coupon_code": "NY2018",
    "partner_id": 123989
  },
  "default": "src_wmlfc3zyhqzehihu7giusaaawu"
}'
No Body

Delete a customer

Delete a customer and all of their linked payment instruments.

Path Parameters
  • identifier
    Type: string Pattern: ^(cus)_(\w{26})$
    required

    The customer's ID

Responses
  • 204

    Customer deleted successfully

  • 401

    Unauthorized

  • 404

    Customer not found or not associated with client

  • application/json
Request Example for delete/customers/{identifier}
curl 'https://{prefix}.api.sandbox.checkout.com/customers/{identifier}' \
  --request DELETE \
  --header 'Authorization: Bearer YOUR_SECRET_TOKEN'
No Body