Create a customer
Create a customer of you business. Use it to [Payment Token](/api/api_references/payment-tokens) or [Recurring Payment](/api/api_references/recurring-payments), track payments from [Payment Link](/api/api_references/create-an-order).
Create a customer
POST /svc/payment/api/v1/openapi/customers
Create a customer of you business. Use it to Payment Token or Recurring Payment, track payments from Payment Link.
- Notice: the API will be update customer profile if the
refernece_numberalready exists.
Request
- application/json
Body
customer objectrequired
your side customer unique id
name stringrequired
The customer's name
Possible values:<= 255 characters
Example: <Your Customer's name>
email string
The customer's email
Possible values:<= 255 characters
Example: abc@def.com
dial_code string
The customer's mobile phone country code
Possible values:<= 6 characters
Example: +852
phone stringrequired
Possible values:<= 255 characters
Example: 12345678
company_name string
The customer's company name
Possible values:<= 255 characters
Example: Universal Group Limited
default_payment_method string
Possible values: [Credit Card, Alipay, Wechat Pay]
Example: Credit Card
default_payment_token string<uuid>
Set a default payment token of this customer
Example: 1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed
reference_number stringrequired
Your side unique number
Possible values:<= 255 characters
Example: <Your side the customer unique id>
Responses
- 200
Response Headers
-
application/json
-
Schema
-
Example (auto)
-
Example
Schema
code number
message string
data objectrequired
customer objectrequired
name string
The customer's name
email string
The customer's email
dial_code stringrequired
The customer mobile phone country code
Example: +852
phone string
The customer's mobile phone
reference_number stringrequired
Your side unique number
default_payment_method string
The customer's default payment method
uuid stringrequired
Wonder side unique id
default_payment_token object
If the customer set a default payment token
token_type stringrequired
The token type
Possible values: [CreditCard, WechatPayAutoDebit, AlipayAutoDebit]
Example: CreditCard
token stringrequired
The token value
state stringrequired
default booleanrequired
If it's default token
error_code string
if bind card failed, will return the specific error code
error_msg string
if bind card failed, will return the specific error message
credit_card object
if token_type is CreditCard
number string
exp_month string
exp_year string
holder_name string
brand string
billing_currency string
{
"code": 0,
"message": "string",
"data": {
"customer": {
"name": "string",
"email": "string",
"dial_code": "+852",
"phone": "string",
"reference_number": "string",
"default_payment_method": "string",
"uuid": "string",
"default_payment_token": {
"token_type": "CreditCard",
"token": "string",
"state": "string",
"default": true,
"error_code": "string",
"error_msg": "string",
"credit_card": {
"number": "string",
"exp_month": "string",
"exp_year": "string",
"holder_name": "string",
"brand": "string",
"billing_currency": "string"
}
}
}
}
}{
"code": 200,
"message": "success",
"data": {
"customer": {
"name": "禚雨欣",
"email": "i8lv9r_gxn26@gmail.com",
"dial_code": "+852",
"phone": "013 9957 0539",
"reference_number": "35",
"default_payment_method": "Credit Card",
"uuid": "feac5c50-010a-4582-a84a-673357245ffb",
"default_payment_token": {
"token_type": "CreditCard",
"token": "culpa magna",
"state": "success",
"default": false,
"credit_card": {
"number": "39",
"exp_month": "十月",
"exp_year": "2026",
"holder_name": "有超栋",
"brand": "Visa",
"billing_currency": "HKD"
}
}
}
}
}-
csharp
-
curl
-
dart
-
go
-
http
-
java
-
javascript
-
kotlin
-
c
-
nodejs
-
objective-c
-
ocaml
-
php
-
powershell
-
python
-
r
-
ruby
-
rust
-
shell
-
swift
-
HTTPCLIENT
-
RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://developer.wonder.today/svc/payment/api/v1/openapi/customers");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"customer\": {\n \"name\": \"<Your Customer's name>\",\n \"email\": \"abc@def.com\",\n \"dial_code\": \"+852\",\n \"phone\": \"12345678\",\n \"company_name\": \"Universal Group Limited\",\n \"default_payment_method\": \"Credit Card\",\n \"default_payment_token\": \"1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed\",\n \"reference_number\": \"<Your side the customer unique id>\"\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());Request Collapse all
Body
- Example (from schema)
- Example
{
"customer": {
"name": "<Your Customer's name>",
"email": "abc@def.com",
"dial_code": "+852",
"phone": "12345678",
"company_name": "Universal Group Limited",
"default_payment_method": "Credit Card",
"default_payment_token": "1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed",
"reference_number": "<Your side the customer unique id>"
}
}