Customers
Customer is an API resource for you to save your customer's information, which is required by the PaymentMethod and PaymentConsent APIs.
POST /api/v1/pa/customers/createGET /api/v1/pa/customers/{id}POST /api/v1/pa/customers/{id}/updateGET /api/v1/pa/customers/{id}/generate_client_secretGET /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.
Address of the customer
City of the address. Maximum of 100 characters.
The two-letter country code in ISO 3166-1 alpha-2 format.
Postcode of the address. Maximum of 10 characters.
State or province of the address. Maximum of 100 characters.
Street of the address. Maximum of 1000 characters.
Business name of the customer. Maximum length is 128.
Email address of the customer. Maximum length is 256.
First name of the customer. Maximum length is 128.
Last name of the customer. Maximum length is 128.
Unique identifier of this customer in merchant's system. Maximum length is 64.
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 number of the customer
Unique request identifier specified by the merchant. Maximum length is 64.
Address of the customer
City of the address. Maximum of 100 characters.
The two-letter country code in ISO 3166-1 alpha-2 format.
Postcode of the address. Maximum of 10 characters.
State or province of the address. Maximum of 100 characters.
Street of the address. Maximum of 1000 characters.
Business name of the customer
Customer's client secret for browser or app. Only returned by Customer create API.
The provided client_secret is valid for 60 minutes
Time at which the Customer was created
Email address of the Customer
First name of the Customer
Unique identifier for the Customer
Last name of the Customer
Unique identifier of the Customer in merchant's system. Maximum length is 64.
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 number of the Customer
Unique request identifier specified by the merchant in the last operation
Last time at which the customer was updated or operated on
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 403 | Forbidden |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$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">}'
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}
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.
Customer unique identifier
Address of the customer
City of the address. Maximum of 100 characters.
The two-letter country code in ISO 3166-1 alpha-2 format.
Postcode of the address. Maximum of 10 characters.
State or province of the address. Maximum of 100 characters.
Street of the address. Maximum of 1000 characters.
Business name of the customer
Customer's client secret for browser or app. Only returned by Customer create API.
The provided client_secret is valid for 60 minutes
Time at which the Customer was created
Email address of the Customer
First name of the Customer
Unique identifier for the Customer
Last name of the Customer
Unique identifier of the Customer in merchant's system. Maximum length is 64.
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 number of the Customer
Unique request identifier specified by the merchant in the last operation
Last time at which the customer was updated or operated on
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 403 | Forbidden |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$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'
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}
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.
Customer unique identifier
Address of the customer
City of the address. Maximum of 100 characters.
The two-letter country code in ISO 3166-1 alpha-2 format.
Postcode of the address. Maximum of 10 characters.
State or province of the address. Maximum of 100 characters.
Street of the address. Maximum of 1000 characters.
Business name of the customer. Maximum length is 128.
Email address of the customer. Maximum length is 256.
First name of the customer. Maximum length is 128.
Last name of the customer. Maximum length is 128.
Unique identifier of this customer in merchant's system. Maximum length is 64.
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 number of the customer
Unique request identifier specified by the merchant. Maximum length is 64.
Address of the customer
City of the address. Maximum of 100 characters.
The two-letter country code in ISO 3166-1 alpha-2 format.
Postcode of the address. Maximum of 10 characters.
State or province of the address. Maximum of 100 characters.
Street of the address. Maximum of 1000 characters.
Business name of the customer
Customer's client secret for browser or app. Only returned by Customer create API.
The provided client_secret is valid for 60 minutes
Time at which the Customer was created
Email address of the Customer
First name of the Customer
Unique identifier for the Customer
Last name of the Customer
Unique identifier of the Customer in merchant's system. Maximum length is 64.
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 number of the Customer
Unique request identifier specified by the merchant in the last operation
Last time at which the customer was updated or operated on
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 403 | Forbidden |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$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">}'
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}
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.
Customer unique identifier
Customer's client secret for browser or app. Only returned by Customer create API.
The provided client_secret is valid for 60 minutes
Time at when the client secret expires
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 403 | Forbidden |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$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'
1{2 "client_secret": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2NTk0OTM1NzUsImV4cCI6MTY1OTQ5NzE3NSwidHlwZSI6ImNsaWVudC1zZWNyZXQiLCJwYWRjIjoiU0ciLCJhY2NvdW50X2lkIjoiMGFjZTdkY2EtMzUzOC00NGUwLWI2OGEtYjQwYjY1MWIzMDE5IiwiaW50ZW50X2lkIjoiaW50X3Nnc3RiOXRic2djOG90bndlMGoiLCJidXNpbmVzc19uYW1lIjoiV2lzaGNvbSBTaGFuZ2hhaSJ9.rqKdwFjF4ba8h2hsbppBxkmAhCcPbSdl_YhC7J_i8so",3 "expired_time": "2019-09-18T03:11:00+00:00"4}
Get list of customers
GET /api/v1/pa/customers
Retrieve list of Customers.
The start time of created_at in ISO8601 format. The timestamp must include an explicit timezone (e.g. Z or -04:00).
The customer unique identifier on merchant side
Page number starting from 0
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.
The end time of created_at in ISO8601 format. The timestamp must include an explicit timezone (e.g. Z or -04:00).
A flag which identifies whether there are more results.
List items
Address of the customer
City of the address. Maximum of 100 characters.
The two-letter country code in ISO 3166-1 alpha-2 format.
Postcode of the address. Maximum of 10 characters.
State or province of the address. Maximum of 100 characters.
Street of the address. Maximum of 1000 characters.
Business name of the customer
Customer's client secret for browser or app. Only returned by Customer create API.
The provided client_secret is valid for 60 minutes
Time at which the Customer was created
Email address of the Customer
First name of the Customer
Unique identifier for the Customer
Last name of the Customer
Unique identifier of the Customer in merchant's system. Maximum length is 64.
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 number of the Customer
Unique request identifier specified by the merchant in the last operation
Last time at which the customer was updated or operated on
| Error status | Description |
|---|---|
| 400 | Bad Request. Possible error codes: |
| 401 | Unauthorized. Possible error codes: |
| 403 | Forbidden |
| 404 | Not Found. Possible error codes: |
| 500 | Server Error. Possible error codes: |
$curl --request GET \> --url 'https://api-demo.airwallex.com/api/v1/pa/customers' \> --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \> --header 'Content-Type: application/json'
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}