Customers API

Create a customer

Request

To create a Customer you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Valid request

Request endpoint details

name
value
description

path

v2/customers

This path is used for create action

method

POST

We are creating resource, hence POST method

Request body:

field
length
type
required
description

merchant_customer_id

1-100

String

NO

Merchant's customer id

description

1-200

String

NO

The Customer description

email

1-200

String

NO

Customer’s email address.

name

1-50

String

NO

Customer’s full name or business name.

phone

1-30

String

NO

Customer's phone

metadata

predefined

Dictionary

NO

Set of key-value pairs. Useful for storing additional data about the object

zip_code

1-9

String

NO

Customer's ZIP or postal code.

city

3-30

String

NO

Customer's city, district, suburb, town, or village.

address

3-100

String

NO

Customer's address

country

2

String

NO

Two-letter country code, see ISO 3166-1 alpha-2

Response

field
length
type
description

status

enum

String

approved, invalid-request or error

uuid

predefined

String

Customer's uuid - use this value for operations with customer

merchant_customer_id

100

String

Merchant's customer id

description

1-200

String

The Customer description

email

1-200

String

Customer’s email address.

name

1-50

String

Customer’s full name

phone

1-30

String

Customer's phone

metadata

predefined

Dictionary

Set of key-value pairs. Useful for storing additional data about the object

zip_code

1-9

String

Customer's ZIP or postal code.

city

3-30

String

Customer's city

address

3-100

String

Customer's address

country

2

String

Two-letter country code, see ISO 3166-1 alpha-2

deleted

predefined

Boolean

True if customer is deleted

created_at

predefined

DateTime

Created at

updated_at

predefined

DateTime

Created at

deleted_at

predefined

DateTime

Nullable, set if customer is deleted

Example of response:

{
  "uuid": "4b281da4-d145-4233-b957-2018cf9aa0fb",
  "merchant_customer_id": "customer-id-1234",
  "description": "Customer",
  "email": "email@email.com",
  "name": "Test",
  "phone": null,
  "status": "approved",
  "deleted": false,
  "city": null,
  "country": "BA",
  "zip_code": "71000",
  "address": null,
  "metadata": {
    "key": "value"
  },
  "created_at": "2019-02-12T11:22:33Z",
  "updated_at": "2019-02-12T11:22:33Z",
  "deleted_at": null
}

Retrieve a customer

To retrieve previously created customer you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Create resource beforehand

  • Provide valid resource uuid

Request

name
value
description

path

/v2/customers/:uuid

uuid of previously created resource

method

GET

Response

Response is the same as the one for create


Retrieve a customer via merchant_customer_id

To retrieve previously created customer you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Create resource beforehand

  • Provide valid merchant_customer_id

Request

name
value
description

path

/v2/merchants/customers/:merchant_customer_id

merchant_customer_id of previously created resource

method

GET

Response

Response is the same as the one for create

Update a customer

To update previously created customer you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Create resource beforehand

  • Provide valid resource uuid

Request

name
value
description

path

/v2/customers/:uuid

uuid of previously created resource

method

POST

We are updating resource, hence POST method

Request body:

  • Updates the specified customer by setting the values of the parameters passed.

  • Any parameters not provided will be left unchanged.

  • Fields available for create are also available for update.

  • Setting key to null in metadata will unset value for that key.

Response

Response is the same as the one for create


Delete a customer

To delete previously created customer you'll need to provide:

  • Valid Authorization header (see above how to create one)

  • Create resource beforehand

  • Provide valid resource uuid

Request

name
value
description

path

/v2/customers/:uuid

uuid of previously created resource

method

DELETE

Response

field
length
type
description

status

enum

String

approved, invalid-request or error

id

20

String

Customer's id

deleted

predefined

Boolean

True if customer is deleted

Example of response:

{
  "status": "approved",
  "id": "4b281da4-d145-4233-b957-2018cf9aa0fb",
  "deleted": true
}

List all customers

To list previously created customers you'll need to provide:

  • Valid Authorization header (see above how to create one)

Request

name
value
description

path

/v2/customers

uuid of previously created resource

method

GET

We are retrieving resources, thus GET

query

limit

Limit number of objects listed, default limit is 50. Must be valid number.

query

offset

If you need to skip values set offset to non 0 value, objects are sorted by created_at DESC. Must be valid number.

Response

|field| length | type |description| |status| enum | String |approved, invalid-request or error| |data|20 |Array<Dictionary> | An array of customers |

{
  "status": "approved",
  "data": [
    {
      "id": "4b281da4-d145-4233-b957-2018cf9aa0fb",
      "description": "Customer",
      "email": "email@email.com",
      "name": "Test",
      "phone": null,
      "status": "approved",
      "deleted": false,
      "city": null,
      "country": "BA",
      "zip_code": "71000",
      "address": null,
      "metadata": {
        "key": "value"
      },
      "created_at": "2019-02-12T11:22:33Z",
      "updated_at": "2019-02-12T11:22:33Z",
      "deleted_at": null
    }
  ]
}

List all payment methods

To list previously created customers you'll need to provide:

  • Valid Authorization header (see above how to create one)

Request

name
value
description

path

/v2/customers/:uuid/payment-methods

uuid of previously created resource

method

GET

We are retrieving resources, thus GET

query

limit

Limit number of objects listed, default limit is 50. Must be valid number.

query

offset

If you need to skip values set offset to non 0 value, objects are sorted by created_at DESC. Must be valid number.

Response

field
length
type
description

status

enum

String

approved, invalid-request or error

data

20

Array<Dictionary>

An array of customers

{
  "status": "approved",
  "data": [
    {
      "status": "approved",
      "id": "00c1eb1a4a0b61d1c2921c8d3a3f4570801da3f3f087c280e832cb4876a5e633",
      "masked_pan": "405840******0005",
      "expiration_date": "2025-12-31",
      "keep_until": "2024-12-31T23:00:00Z",
      "created_at": "2019-02-12T11:22:33Z",
      "updated_at": "2019-02-12T11:22:33Z",
      "customer_uuid": "4b281da4-d145-4233-b957-2018cf9aa0fb",
      "token": "00c1eb1a4a0b61d1c2921c8d3a3f4570801da3f3f087c280e832cb4876a5e633",
      "expired": false
    }
  ]
}

Last updated