Create a transaction
Directly make a transaction without any UI.
Create a transaction
POST /svc/payment/api/v1/openapi/open_payments
Directly make a transaction without any UI. If you already Create an order, then just simply pass the reference number. else allows you pass the order object to create order when make payment.
After payment completed(successful or failure), we will send Webhook to your server.
Whether to create the order in advance is only related to your system process, and there is no difference whatsoever.
Request
- application/json
Body
payment objectrequired
uuid string
unique payment id
payment_token object
amount payment total (string)required
token stringrequired
if you already has card token
consume_mode stringrequired
Possible values: [sales, pre_authorize]
entry_type stringrequired
Possible values: [mit]
wechatpay object
amount stringrequired
merchant_presented_qr_code object
payinfo stringrequired
alipay object
amount stringrequired
merchant_presented_qr_code object
payinfo stringrequired
consumer_presented_qr_code object
amount stringrequired
code_type stringrequired
Code Type: fixed as qrcode
Possible values: [qrcode]
Example: qrcode
content stringrequired
Code Content
reference_number order reference number (string)
order reference number
order object
charge_fee charge fee (string)required
The amount you charge your customers
Example: 1.00
tips tips (string)
Additional tips to be paid by customers
Example: 1.00
currency currency code (string)required
currency code, eg HKD
reference_number your side unique number (string)required
your side unique number
due_date due date (string)
If this date is exceeded, the order will be automatically voided
Example: 2024-01-01
note note (string)
Note information for the order, needs to be less than 255 characters
line_items object[]
If you wish to display additional line item information
Array [
uuid uuid (string)
UUID V4
purchasable_type PurchasableType (string)required
Possible values: [RearTips, Charge, Listing, Rounding, SurchargeFee]
purchasable_id string
just for purchaseable_type = Listing
price stringrequired
quantity stringrequired
total stringrequired
label Product Name (string)
Product Name
Possible values:<= 255 characters
]
callback_url callback url (string)
The address of the backend webhook
Example: https://your.domain/foo/bar
redirect_url redirect_url (string)
The redirection address after the payment link is completed
Example: https://your.domain/foo/bar
is_only_pre_auth boolean
Default value: false
timeout object
The timeout logic only can be used by creating payment link
timer numberrequired
url string
save_this_card boolean
A flag that determines whether to offer tokenize card choise. This function is only triggered when set to true and customer is specified
Responses
- 200
Response Headers
-
application/json
-
Schema
-
Example (auto)
Schema
code error code (integer)required
message error message (string)required
data objectrequired
order objectrequired
source Transaction source (string)required
Transaction source
type Order type (string)required
Order type
number Wonder unique id (string)required
Wonder unique id
reference_number Your Side unique id (string)required
your side unique id
due_date due date (string)nullablerequired
due date
Example: 2024-01-01
initial_total Order total (number)required
Order total
initial_tips Order tips (number)required
Order tips
subtotal numberrequired
paid_total Order Paid total (string)required
sum of successful transaction amount
unpaid_total Order unpaid total (string)required
initial_total - paid_total
state Order state (string)required
Order state
correspondence_state Order payment state (string)required
Order payment state
Possible values: [unpaid, partial_paid, paid, over_paid]
currency Currency (string)required
return_url frontend return url (string)
for payment link, when payment finished redirect to this url
notify_url Webhook url (string)
if you fill it, wonder will callback your this url after state changed
created_at string
updated_at string
line_items object[]nullable
Array [
uuid string
purchasable_type PurchasableType (string)required
Possible values: [RearTips, Charge, Listing, Rounding, SurchargeFee]
purchase_id integer
price numberrequired
quantity integerrequired
total numberrequired
label string
]
transactions object[]
Array [
type Transaction Type (string)required
Possible values: [Sales, Authorization, Refund, Capture]
Example: Sales
uuid Wonder transaction uuid (string)required
Wonder transaction uuid
currency transaction currency (string)required
transaction currency
amount transaction amount (number)required
transaction amount
success success (boolean)required
if transaction successful
is_pending booleanrequired
for async payment,if transaction still pending
captured booleanrequired
for card pure-auth,if transaction captured
allow_void booleanrequired
if transaction allowed to void
allow_refund booleanrequired
if transaction allowed to refund
void_is_pending booleanrequired
if void still pending
payment_method stringrequired
which payment method
note stringnullable
transaction remark
payment_data objectrequired
related to payment method
acquirer_name stringrequired
acquirer_type stringrequired
auth_code string
brn stringrequired
card_number_len integer
card_read_mode string
credit_card_type string
first_6_digits string
last_4_digits string
merchant_id string
new_gateway_txn_id stringrequired
payment_method stringrequired
receipt_id stringrequired
rrn string
transaction_state stringrequired
token string
When payment_method equals payment_token, the token returns data
holder_name string
exp_month string
exp_year string
resp_code string
resp_msg string
error_code stringdeprecated
not recommend
error_desc stringdeprecated
not recommend
consumer_country_code string
original_transaction_uuid original transacation uuid (string)nullable
original transacation uuid
reference_id string
original_transaction_reference_id string
device_sn string
original_device_sn string
]
{
"code": 0,
"message": "string",
"data": {
"order": {
"source": "string",
"type": "string",
"number": "string",
"reference_number": "string",
"due_date": "2024-01-01",
"initial_total": 0,
"initial_tips": 0,
"subtotal": 0,
"paid_total": "string",
"unpaid_total": "string",
"state": "string",
"correspondence_state": "unpaid",
"currency": "string",
"return_url": "string",
"notify_url": "string",
"created_at": "string",
"updated_at": "string",
"line_items": [\
{\
"uuid": "string",\
"purchasable_type": "RearTips",\
"purchase_id": 0,\
"price": 0,\
"quantity": 0,\
"total": 0,\
"label": "string"\
}\
],
"transactions": [\
{\
"type": "Sales",\
"uuid": "string",\
"currency": "string",\
"amount": 0,\
"success": true,\
"is_pending": true,\
"captured": true,\
"allow_void": true,\
"allow_refund": true,\
"void_is_pending": true,\
"payment_method": "string",\
"note": "string",\
"payment_data": {\
"acquirer_name": "string",\
"acquirer_type": "string",\
"auth_code": "string",\
"brn": "string",\
"card_number_len": 0,\
"card_read_mode": "string",\
"credit_card_type": "string",\
"first_6_digits": "string",\
"last_4_digits": "string",\
"merchant_id": "string",\
"new_gateway_txn_id": "string",\
"payment_method": "string",\
"receipt_id": "string",\
"rrn": "string",\
"transaction_state": "string",\
"token": "string",\
"holder_name": "string",\
"exp_month": "string",\
"exp_year": "string",\
"resp_code": "string",\
"resp_msg": "string",\
"consumer_country_code": "string"\
},\
"original_transaction_uuid": "string",\
"reference_id": "string",\
"original_transaction_reference_id": "string",\
"device_sn": "string",\
"original_device_sn": "string"\
}\
]
}
}
}-
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/open_payments");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"payment\": {\n \"uuid\": \"string\",\n \"payment_token\": {\n \"amount\": \"string\",\n \"token\": \"string\",\n \"consume_mode\": \"sales\",\n \"entry_type\": \"mit\"\n },\n \"wechatpay\": {\n \"amount\": \"string\",\n \"merchant_presented_qr_code\": {\n \"payinfo\": \"string\"\n }\n },\n \"alipay\": {\n \"amount\": \"string\",\n \"merchant_presented_qr_code\": {\n \"payinfo\": \"string\"\n }\n },\n \"consumer_presented_qr_code\": {\n \"amount\": \"string\",\n \"code_type\": \"qrcode\",\n \"content\": \"string\"\n }\n },\n \"reference_number\": \"string\",\n \"order\": {\n \"charge_fee\": \"1.00\",\n \"tips\": \"1.00\",\n \"currency\": \"string\",\n \"reference_number\": \"string\",\n \"due_date\": \"2024-01-01\",\n \"note\": \"string\",\n \"line_items\": [\n {\n \"uuid\": \"string\",\n \"purchasable_type\": \"RearTips\",\n \"purchasable_id\": \"string\",\n \"price\": \"string\",\n \"quantity\": \"string\",\n \"total\": \"string\",\n \"label\": \"string\"\n }\n ],\n \"callback_url\": \"https://your.domain/foo/bar\",\n \"redirect_url\": \"https://your.domain/foo/bar\",\n \"is_only_pre_auth\": false,\n \"timeout\": {\n \"timer\": 0,\n \"url\": \"string\"\n },\n \"save_this_card\": true\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
{
"payment": {
"uuid": "string",
"payment_token": {
"amount": "string",
"token": "string",
"consume_mode": "sales",
"entry_type": "mit"
},
"wechatpay": {
"amount": "string",
"merchant_presented_qr_code": {
"payinfo": "string"
}
},
"alipay": {
"amount": "string",
"merchant_presented_qr_code": {
"payinfo": "string"
}
},
"consumer_presented_qr_code": {
"amount": "string",
"code_type": "qrcode",
"content": "string"
}
},
"reference_number": "string",
"order": {
"charge_fee": "1.00",
"tips": "1.00",
"currency": "string",
"reference_number": "string",
"due_date": "2024-01-01",
"note": "string",
"line_items": [\
{\
"uuid": "string",\
"purchasable_type": "RearTips",\
"purchasable_id": "string",\
"price": "string",\
"quantity": "string",\
"total": "string",\
"label": "string"\
}\
],
"callback_url": "https://your.domain/foo/bar",
"redirect_url": "https://your.domain/foo/bar",
"is_only_pre_auth": false,
"timeout": {
"timer": 0,
"url": "string"
},
"save_this_card": true
}
}