Airwallex logo
Airwallex logoAirwallex logo

Customers

Copy for LLMView as Markdown

Customer is an API resource for you to save your customer's information, which is required by the PaymentMethod and PaymentConsent APIs.

Endpoints
POST /api/v1/pa/customers/create
GET /api/v1/pa/customers/{id}
POST /api/v1/pa/customers/{id}/update
GET /api/v1/pa/customers/{id}/generate_client_secret
GET /api/v1/pa/customers

Create a customer

POST /api/v1/pa/customers/create

Create a Customer object. We require the Customer unique identifier in the merchant's system as a mandatory field.

Request body
addressobject

Address of the customer

address.citystring

City of the address. Maximum of 100 characters.

address.country_coderequiredstring

The two-letter country code in ISO 3166-1 alpha-2 format.

address.postcodestring

Postcode of the address. Maximum of 10 characters.

address.statestring

State or province of the address. Maximum of 100 characters.

address.streetstring

Street of the address. Maximum of 1000 characters.

business_namestring

Business name of the customer. Maximum length is 128.

emailstring

Email address of the customer. Maximum length is 256.

first_namestring

First name of the customer. Maximum length is 128.

last_namestring

Last name of the customer. Maximum length is 128.

merchant_customer_idrequiredstring

Unique identifier of this customer in merchant's system. Maximum length is 64.

metadataobject

A set of key-value pairs that you can attach to this customer. You can specify up to 50 keys with key names up to 50 characters long and values up to 500 characters long.

phone_numberstring

Phone number of the customer

request_idrequiredstring

Unique request identifier specified by the merchant. Maximum length is 64.

Response body - 201 Created
addressobject

Address of the customer

address.citystring

City of the address. Maximum of 100 characters.

address.country_codestring

The two-letter country code in ISO 3166-1 alpha-2 format.

address.postcodestring

Postcode of the address. Maximum of 10 characters.

address.statestring

State or province of the address. Maximum of 100 characters.

address.streetstring

Street of the address. Maximum of 1000 characters.

business_namestring

Business name of the customer

client_secretstring

Customer's client secret for browser or app. Only returned by Customer create API.

The provided client_secret is valid for 60 minutes

created_atstring

Time at which the Customer was created

emailstring

Email address of the Customer

first_namestring

First name of the Customer

idstring

Unique identifier for the Customer

last_namestring

Last name of the Customer

merchant_customer_idstring

Unique identifier of the Customer in merchant's system. Maximum length is 64.

metadataobject

A set of key-value pairs that you can attach to the Customer. You can specify up to 50 keys with key names up to 50 characters long and values up to 500 characters long.

phone_numberstring

Phone number of the Customer

request_idstring

Unique request identifier specified by the merchant in the last operation

updated_atstring

Last time at which the customer was updated or operated on

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error, duplicate_request, resource_already_exists

401

Unauthorized. Possible error codes: unauthorized

403

Forbidden

404

Not Found. Possible error codes: not_found(invalid url)

500

Server Error. Possible error codes: internal_error

POST /api/v1/pa/customers/create
$curl --request POST \
> --url 'https://api-demo.airwallex.com/api/v1/pa/customers/create' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "request_id": "2ed2d823-f8b3-416e-86db-ced8770ce217",
> "first_name": "John",
> "last_name": "Doe",
> "email": "[email protected]",
> "phone_number": "+1 1234567890",
> "merchant_customer_id": "9fafc2fb-4262-4ff8-a205-d60fb4781cb0"
>}'
Response (201 Created)
1{
2 "id": "cus_hkpdh1d0d298uf1",
3 "request_id": "2ed2d823-f8b3-416e-86db-ced8770ce217",
4 "merchant_customer_id": "9fafc2fb-4262-4ff8-a205-d60fb4781cb0",
5 "first_name": "John",
6 "last_name": "Doe",
7 "email": "[email protected]",
8 "phone_number": "+1 1234567890",
9 "client_secret": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NDQwMTQ3MTAsImV4cCI6MTc0NDAxODMxMCwidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiSEsiLCJhY2NvdW50X2lkIjoiYjlkMmU0NTctOGEwNC00MDMzLWI3MTktZTJkOGNiZmQyZDY1IiwiY3VzdG9tZXJfaWQiOiJDVVMyMDI1MDMyMTAwMDEifQ.vonr_tnn7kA3GE3t9WCJoi5TjVnBu1rGnrwPeTTjU_I",
10 "created_at": "2021-01-31T06:57:10+00:00",
11 "updated_at": "2021-01-31T06:59:10+00:00"
12}
Was this section helpful?

Retrieve a customer

GET /api/v1/pa/customers/{id}

Retrieve a Customer by unique identifier. This unique identifier is first returned when creating a new Customer.

Parameters
idrequiredstring

Customer unique identifier

Response body - 200 OK
addressobject

Address of the customer

address.citystring

City of the address. Maximum of 100 characters.

address.country_codestring

The two-letter country code in ISO 3166-1 alpha-2 format.

address.postcodestring

Postcode of the address. Maximum of 10 characters.

address.statestring

State or province of the address. Maximum of 100 characters.

address.streetstring

Street of the address. Maximum of 1000 characters.

business_namestring

Business name of the customer

client_secretstring

Customer's client secret for browser or app. Only returned by Customer create API.

The provided client_secret is valid for 60 minutes

created_atstring

Time at which the Customer was created

emailstring

Email address of the Customer

first_namestring

First name of the Customer

idstring

Unique identifier for the Customer

last_namestring

Last name of the Customer

merchant_customer_idstring

Unique identifier of the Customer in merchant's system. Maximum length is 64.

metadataobject

A set of key-value pairs that you can attach to the Customer. You can specify up to 50 keys with key names up to 50 characters long and values up to 500 characters long.

phone_numberstring

Phone number of the Customer

request_idstring

Unique request identifier specified by the merchant in the last operation

updated_atstring

Last time at which the customer was updated or operated on

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error

401

Unauthorized. Possible error codes: unauthorized

403

Forbidden

404

Not Found. Possible error codes: not_found(invalid url), resource_not_found

500

Server Error. Possible error codes: internal_error

GET /api/v1/pa/customers/{id}
$curl --request GET \
> --url 'https://api-demo.airwallex.com/api/v1/pa/customers/cus_hkpdh1d0d298uf1' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "id": "cus_hkpdh1d0d298uf1",
3 "merchant_customer_id": "9fafc2fb-4262-4ff8-a205-d60fb4781cb0",
4 "first_name": "John",
5 "last_name": "Doe",
6 "email": "[email protected]",
7 "phone_number": "+1 1234567890",
8 "client_secret": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NDQwMTQ3MTAsImV4cCI6MTc0NDAxODMxMCwidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiSEsiLCJhY2NvdW50X2lkIjoiYjlkMmU0NTctOGEwNC00MDMzLWI3MTktZTJkOGNiZmQyZDY1IiwiY3VzdG9tZXJfaWQiOiJDVVMyMDI1MDMyMTAwMDEifQ.vonr_tnn7kA3GE3t9WCJoi5TjVnBu1rGnrwPeTTjU_I",
9 "created_at": "2021-01-31T06:57:10+00:00",
10 "updated_at": "2021-01-31T06:59:10+00:00"
11}
Was this section helpful?

Update a customer

POST /api/v1/pa/customers/{id}/update

Update customer's personal information. Use the PaymentMethods API to update details of the attached PaymentMethods.

Parameters
idrequiredstring

Customer unique identifier

Request body
addressobject

Address of the customer

address.citystring

City of the address. Maximum of 100 characters.

address.country_coderequiredstring

The two-letter country code in ISO 3166-1 alpha-2 format.

address.postcodestring

Postcode of the address. Maximum of 10 characters.

address.statestring

State or province of the address. Maximum of 100 characters.

address.streetstring

Street of the address. Maximum of 1000 characters.

business_namestring

Business name of the customer. Maximum length is 128.

emailstring

Email address of the customer. Maximum length is 256.

first_namestring

First name of the customer. Maximum length is 128.

last_namestring

Last name of the customer. Maximum length is 128.

merchant_customer_idstring

Unique identifier of this customer in merchant's system. Maximum length is 64.

metadataobject

A set of key-value pairs that you can attach to this customer. You can specify up to 50 keys with key names up to 50 characters long and values up to 500 characters long.

phone_numberstring

Phone number of the customer

request_idrequiredstring

Unique request identifier specified by the merchant. Maximum length is 64.

Response body - 200 OK
addressobject

Address of the customer

address.citystring

City of the address. Maximum of 100 characters.

address.country_codestring

The two-letter country code in ISO 3166-1 alpha-2 format.

address.postcodestring

Postcode of the address. Maximum of 10 characters.

address.statestring

State or province of the address. Maximum of 100 characters.

address.streetstring

Street of the address. Maximum of 1000 characters.

business_namestring

Business name of the customer

client_secretstring

Customer's client secret for browser or app. Only returned by Customer create API.

The provided client_secret is valid for 60 minutes

created_atstring

Time at which the Customer was created

emailstring

Email address of the Customer

first_namestring

First name of the Customer

idstring

Unique identifier for the Customer

last_namestring

Last name of the Customer

merchant_customer_idstring

Unique identifier of the Customer in merchant's system. Maximum length is 64.

metadataobject

A set of key-value pairs that you can attach to the Customer. You can specify up to 50 keys with key names up to 50 characters long and values up to 500 characters long.

phone_numberstring

Phone number of the Customer

request_idstring

Unique request identifier specified by the merchant in the last operation

updated_atstring

Last time at which the customer was updated or operated on

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error, duplicate_request

401

Unauthorized. Possible error codes: unauthorized

403

Forbidden

404

Not Found. Possible error codes: not_found(invalid url), resource_not_found

500

Server Error. Possible error codes: internal_error

POST /api/v1/pa/customers/{id}/update
$curl --request POST \
> --url 'https://api-demo.airwallex.com/api/v1/pa/customers/cus_hkpdh1d0d298uf1/update' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json' \
> --data '{
> "request_id": "48dd845a-b4aa-4c7c-a4af-ea3ccfe1839e",
> "first_name": "John",
> "last_name": "Doe",
> "email": "[email protected]",
> "phone_number": "+1 1234567890",
> "merchant_customer_id": "9fafc2fb-4262-4ff8-a205-d60fb4781cb0"
>}'
Response (200 OK)
1{
2 "id": "cus_hkpdh1d0d298uf1",
3 "request_id": "48dd845a-b4aa-4c7c-a4af-ea3ccfe1839e",
4 "merchant_customer_id": "9fafc2fb-4262-4ff8-a205-d60fb4781cb0",
5 "first_name": "John",
6 "last_name": "Doe",
7 "email": "[email protected]",
8 "phone_number": "+1 1234567890",
9 "client_secret": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NDQwMTQ3MTAsImV4cCI6MTc0NDAxODMxMCwidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiSEsiLCJhY2NvdW50X2lkIjoiYjlkMmU0NTctOGEwNC00MDMzLWI3MTktZTJkOGNiZmQyZDY1IiwiY3VzdG9tZXJfaWQiOiJDVVMyMDI1MDMyMTAwMDEifQ.vonr_tnn7kA3GE3t9WCJoi5TjVnBu1rGnrwPeTTjU_I",
10 "created_at": "2021-01-31T06:57:10+00:00",
11 "updated_at": "2021-01-31T06:59:10+00:00"
12}
Was this section helpful?

Generate a client secret for a customer

GET /api/v1/pa/customers/{id}/generate_client_secret

Generate a client secret for a Customer so that the client secret can be used as HTTP header client-secret from client-side to create a PaymentMethod or list PaymentMethod.

Parameters
idrequiredstring

Customer unique identifier

Response body - 200 OK
client_secretstring

Customer's client secret for browser or app. Only returned by Customer create API.

The provided client_secret is valid for 60 minutes

expired_timestring

Time at when the client secret expires

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error

401

Unauthorized. Possible error codes: unauthorized

403

Forbidden

404

Not Found. Possible error codes: not_found(invalid url), resource_not_found

500

Server Error. Possible error codes: internal_error

GET /api/v1/pa/customers/{id}/generate_client_secret
$curl --request GET \
> --url 'https://api-demo.airwallex.com/api/v1/pa/customers/customer_id/generate_client_secret' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "client_secret": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NTk0OTM1NzUsImV4cCI6MTY1OTQ5NzE3NSwidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiU0ciLCJhY2NvdW50X2lkIjoiMGFjZTdkY2EtMzUzOC00NGUwLWI2OGEtYjQwYjY1MWIzMDE5IiwiaW50ZW50X2lkIjoiaW50X3Nnc3RiOXRic2djOG90bndlMGoiLCJidXNpbmVzc19uYW1lIjoiV2lzaGNvbSBTaGFuZ2hhaSJ9.rqKdwFjF4ba8h2hsbppBxkmAhCcPbSdl_YhC7J_i8so",
3 "expired_time": "2019-09-18T03:11:00+00:00"
4}
Was this section helpful?

Get list of customers

GET /api/v1/pa/customers

Retrieve list of Customers.

Parameters
from_created_atstring

The start time of created_at in ISO8601 format. The timestamp must include an explicit timezone (e.g. Z or -04:00).

merchant_customer_idstring

The customer unique identifier on merchant side

page_numinteger

Page number starting from 0

page_sizeinteger

Number of Customers to be listed per page. Default value is 10. Maximum is 1000. The value greater than the maximum will be capped to the maximum.

to_created_atstring

The end time of created_at in ISO8601 format. The timestamp must include an explicit timezone (e.g. Z or -04:00).

Response body - 200 OK
has_moreboolean

A flag which identifies whether there are more results.

itemsarray

List items

items.addressobject

Address of the customer

items.address.citystring

City of the address. Maximum of 100 characters.

items.address.country_codestring

The two-letter country code in ISO 3166-1 alpha-2 format.

items.address.postcodestring

Postcode of the address. Maximum of 10 characters.

items.address.statestring

State or province of the address. Maximum of 100 characters.

items.address.streetstring

Street of the address. Maximum of 1000 characters.

items.business_namestring

Business name of the customer

items.client_secretstring

Customer's client secret for browser or app. Only returned by Customer create API.

The provided client_secret is valid for 60 minutes

items.created_atstring

Time at which the Customer was created

items.emailstring

Email address of the Customer

items.first_namestring

First name of the Customer

items.idstring

Unique identifier for the Customer

items.last_namestring

Last name of the Customer

items.merchant_customer_idstring

Unique identifier of the Customer in merchant's system. Maximum length is 64.

items.metadataobject

A set of key-value pairs that you can attach to the Customer. You can specify up to 50 keys with key names up to 50 characters long and values up to 500 characters long.

items.phone_numberstring

Phone number of the Customer

items.request_idstring

Unique request identifier specified by the merchant in the last operation

items.updated_atstring

Last time at which the customer was updated or operated on

Errors
Error statusDescription
400

Bad Request. Possible error codes: validation_error

401

Unauthorized. Possible error codes: unauthorized

403

Forbidden

404

Not Found. Possible error codes: not_found(invalid url)

500

Server Error. Possible error codes: internal_error

GET /api/v1/pa/customers
$curl --request GET \
> --url 'https://api-demo.airwallex.com/api/v1/pa/customers' \
> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
> --header 'Content-Type: application/json'
Response (200 OK)
1{
2 "has_more": false,
3 "items": [
4 {
5 "id": "cus_hkpdh1d0d298uf1",
6 "merchant_customer_id": "9fafc2fb-4262-4ff8-a205-d60fb4781cb0",
7 "first_name": "John",
8 "last_name": "Doe",
9 "email": "[email protected]",
10 "phone_number": "+1 1234567890",
11 "client_secret": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NDQwMTQ3MTAsImV4cCI6MTc0NDAxODMxMCwidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiSEsiLCJhY2NvdW50X2lkIjoiYjlkMmU0NTctOGEwNC00MDMzLWI3MTktZTJkOGNiZmQyZDY1IiwiY3VzdG9tZXJfaWQiOiJDVVMyMDI1MDMyMTAwMDEifQ.vonr_tnn7kA3GE3t9WCJoi5TjVnBu1rGnrwPeTTjU_I",
12 "created_at": "2021-01-31T06:57:10+00:00",
13 "updated_at": "2021-01-31T06:59:10+00:00"
14 }
15 ]
16}
Was this section helpful?