Skip to main content

API Reference

Create Order API

Use the Create Order API to generate a Payment Link, which will provide an HTML URL for completing the payment via a browser.

API Description

Request URL

https://gateway.wonder.app/api/galaxy/payment-link

Request Method

POST

Request Parameters

VariableTypeRequiredDescription
business_idstring(36)Y[header] Business ID
total_amountfloatNTransaction amount items
pre_authbooleanNInstructions for conducting pre authorization transactions only
charge_feefloatNCharge fee
tipsfloatNTips amount
currencystring(3)YCurrency (e.g., HKD, USD)
reference_numberstring(32)NUnique internal order number in the merchant system
remarkstring(255)NRemark for the order
line_itemsobject arrayNInformation about the products
--idintegerYSKU ID
--labelstring(255)YSKU name
--quantityintegerYSKU quantity
--pricefloatYSKU unit price
--totalfloatYSKU total amount
--discount_totalfloatYSKU discount amount
customer_idstring(32)NCustomer ID
redirect_urlstring(255)NURL to redirect after successful payment
callback_urlstring(255)NURL for backend notification after state change
Request Example

Header:

{
"x-app-slug": "3pDZ5B",
"x-app-key": "deb512b8-00b3-4cb9-a1b8-45d564a5fb81",
"authorization": "Bearer XXXXXXXXXXXXXXXX",
"x-p-business-id": "c3cc84fe-b1c3-11ec-a3d9-42010aaa001d"
}

Body (JSON):

without line items:

{
"charge_fee": 2,
"tips": 0,
"currency": "HKD",
"reference_number": "abc123456",
"remark": "Test Payment Link",
"redirect_url": "https://www.domain.com/redirect",
"callback_url": "https://www.domain.com/callback"
}

with line items:

{
"total_amount": 12,
"charge_fee": 2,
"tips": 1,
"currency": "HKD",
"reference_number": "abc1234567",
"remark": "Test Payment Link",
"redirect_url": "https://www.domain.com/redirect",
"callback_url": "https://www.domain.com/callback",
"line_items": [
{
"id": 1,
"label": "Test Item",
"quantity": 1,
"price": 10,
"total": 10,
"discount_total": 0
}
]
}
Link TypeTagDescription
Sales Payment Linkpre_auth = false or undefinedCollect one-time sales payment for your sales invoices. Suitable for e-commerce purposes.
Pre-auth Payment Linkpre_auth = trueCollect your customer's card/wallet information, to later charge the customer. Suitable for future payment collection, after goods/services have been delivered/provided.

Response Parameters

VariableTypeRequiredDescription
urlstring(255)YPayment URL
Response Example

Body (JSON):

{
"code": 200,
"message": "successful",
"data": {
"url": "https://s-stg.wonder.app/2SiNH4"
}
}

Void Order API

Void the order before the order is paid.

API Description

Request URL

https://gateway.wonder.app/api/oms/b2b/open/payment/orders/reference/{reference_number}/void

Request Method

POST

Request Parameters

VariableTypeRequiredDescription
business_idstring(36)Y[header] Business ID
reference_numberstring(32)Y[path] Unique internal order number in the merchant system

Request Example

Header:

{
"x-app-slug": "3pDZ5B",
"x-app-key": "deb512b8-00b3-4cb9-a1b8-45d564a5fb81",
"authorization": "Bearer XXXXXXXXXXXXXXXX",
"x-p-business-id": "c3cc84fe-b1c3-11ec-a3d9-42010aaa001d"
}

Body (JSON):

{}

Response Parameters

Response Example

Body (JSON):

{
"code": 200,
"message": "successful",
"data": null
}

Refund Order API

Refund for the paid order.

API Description

Request URL

https://gateway.wonder.app/api/oms/b2b/open/payment/orders/reference/{reference_number}/refund

Request Method

POST

Request Parameters

VariableTypeRequiredDescription
business_idstring(36)Y[header] Business ID
reference_numberstring(32)Y[path] Unique internal order number in the merchant system
refund_reasonstring(255)N[body] Reason for the refund
transactions_to_be_refundedobject arrayN[body] Array supporting fully and partial refunds
-- transaction_idintegerY[body] Obtainable via Query Order API
-- amountfloatY[body] Refund amount
-- notestring(255)N[body] Refund note
-- payment_datastring(255)N[body] Payment data
Request Example

Header:

{
"x-app-slug": "3pDZ5B",
"x-app-key": "deb512b8-00b3-4cb9-a1b8-45d564a5fb81",
"authorization": "Bearer XXXXXXXXXXXXXXXX",
"x-p-business-id": "c3cc84fe-b1c3-11ec-a3d9-42010aaa001d"
}

Body (JSON):

{
"refund_reason": "reason",
"transactions_to_be_refunded": [
{
"amount": 0,
"note": "string",
"payment_data": "string",
"transaction_id": 0
}
]
}

Response Parameters

VariableTypeRequiredDescription
numberstring(24)YBindo order number
reference_numberstring(32)YUnique internal order number in the merchant system
correspondence_statestring(20)YPaid state: unpaid/partial_paid/paid/over_paid/refunded
statestring(20)YOrder state: in_completed/voided/completed
initial_totalfloatYOrder amount
paid_totalfloatYPayment amount
line_itemsobject arrayYOrder product information
- idintegerYSKU ID
- labelstring(255)YSKU name
- quantityintegerYSKU quantity
- pricefloatYSKU unit price
- discount_totalfloatYSKU discount total amount
sale_transactionsobject arrayNTransactions. include refunded transactions
- idintegerYTransaction ID
- amountfloatYTransaction amount
- currencystring(3)YCurrency
- successbooleanY
refund_transactionsobject arrayRefunded transactions
- idintegerYTransaction ID
- amountfloatYRefunded amount
- currencystring(3)YCurrency
- successbooleanY
void_transactionsobject arrayYVoided transactions
- idintegerYTransaction ID
- amountfloatYVoided amount
- currencystring(3)YCurrency
- successbooleanY
Response Example

Body (JSON):

{
"code": 200,
"message": "successful",
"data": {
"additional_documents": [
"string"
],
"auth_code": "string",
"business_name": "string",
"correspondence_state": "string",
"created_at": "2023-04-25T07:16:33.551Z",
"created_by": "string",
"currency": "string",
"custom_attributes": "string",
"customer_country_code": "string",
"customer_dial_code": "string",
"customer_email": "string",
"customer_linked_source_type": "string",
"customer_name": "string",
"customer_phone": "string",
"customer_reference": "string",
"delivery_date": "2023-04-25T07:16:33.551Z",
"discount_total": 0,
"due_date": "string",
"fail_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"from": 0,
"id": 0,
"initial_normal_tax": 0,
"initial_tax": 0,
"initial_tips": 0,
"initial_total": 0,
"inventory_status": "string",
"line_items": [
{
"discount_total": 0,
"id": 0,
"image_url": "string",
"label": "string",
"price": 0,
"purchasable_type": "string",
"purchase_id": "string",
"quantity": 0,
"total": 0
}
],
"note": "string",
"notify_url": "string",
"number": "string",
"oms_delivery_note": {
"address1": "string",
"address2": "string",
"city": "string",
"country": 0,
"email": "string",
"name": "string",
"note": "string",
"phone": "string"
},
"paid_total": "string",
"payment_link_url": "string",
"reference_number": "string",
"refund_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"return_url": "string",
"sale_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"signatures": [
{
"encoded_signature": "string",
"transaction_id": 0
}
],
"state": "string",
"subtotal": 0,
"surcharge_fee": 0,
"type": "string",
"unpaid_total": "string",
"updated_at": "2023-04-25T07:16:33.551Z",
"void_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
]
}
}

Close Order API

Close the order after partial paid.

API Description

Request URL

https://gateway.wonder.app/api/oms/b2b/open/payment/orders/reference/{reference_number}/close

Request Method

POST

Request Parameters

VariableTypeRequiredDescription
business_idstring(36)Y[header] Business ID
reference_numberstring(32)Y[path] Unique internal order number in the merchant system
Request Example

Header:

{
"x-app-slug": "3pDZ5B",
"x-app-key": "deb512b8-00b3-4cb9-a1b8-45d564a5fb81",
"authorization": "Bearer XXXXXXXXXXXXXXXX",
"x-p-business-id": "c3cc84fe-b1c3-11ec-a3d9-42010aaa001d"
}

Body (JSON):

{}

Response Parameters

Response Example

Body (JSON):

{
"code": 200,
"message": "successful",
"data": null
}

Void Transaction

Before the completion or settlement of a transaction, a void operation can be performed. Whether a transaction can be voided can be determined through the "allow_void" field of the Query Order API.

API Description

Request URL

https://gateway.wonder.app/api/oms/b2b/open/payment/transaction/{transaction_id}/reference/{reference_number}/void

Request Method

POST

Request Parameters

VariableTypeRequiredDescription
business_idstring(36)Y[header] Business ID
reference_numberstring(32)Y[path] Unique internal order number in the merchant system
transaction_idintegerY[path] Obtainable via Query Order API
payment_datastring(255)N[body] Payment data
Request Example

Header:

{
"x-app-slug": "3pDZ5B",
"x-app-key": "deb512b8-00b3-4cb9-a1b8-45d564a5fb81",
"authorization": "Bearer XXXXXXXXXXXXXXXX",
"x-p-business-id": "c3cc84fe-b1c3-11ec-a3d9-42010aaa001d"
}

Body (JSON):

{
"payment_data": "string"
}

Response Parameters

VariableTypeRequiredDescription
numberstring(24)YBindo order number
reference_numberstring(32)YUnique internal order number in the merchant system
correspondence_statestring(20)YPaid state: unpaid/partial_paid/paid/over_paid/refunded
statestring(20)YOrder state: in_completed/voided/completed
initial_totalfloatYOrder amount
paid_totalfloatYPayment amount
line_itemsobject arrayYOrder product information
--idintegerYSKU ID
--labelstring(255)YSKU name
--quantityintegerYSKU quantity
--pricefloatYSKU unit price
--discount_totalfloatYSKU discount total amount
sale_transactionsobject arrayNTransactions. include refunded transactions
-- idintegerYTransaction ID
-- amountfloatYTransaction amount
-- currencystring(3)YCurrency
-- successbooleanY
refund_transactionsobject arrayRefunded transactions
-- idintegerYTransaction ID
-- amountfloatYRefunded amount
-- currencystring(3)YCurrency
-- successbooleanY
void_transactionsobject arrayYVoided transactions
-- idintegerYTransaction ID
-- amountfloatYVoided amount
-- currencystring(3)YCurrency
-- successbooleanY
Response Example

Body (JSON):

{
"code": 200,
"message": "successful",
"data": {
"additional_documents": [
"string"
],
"auth_code": "string",
"business_name": "string",
"correspondence_state": "string",
"created_at": "2023-04-25T07:16:33.551Z",
"created_by": "string",
"currency": "string",
"custom_attributes": "string",
"customer_country_code": "string",
"customer_dial_code": "string",
"customer_email": "string",
"customer_linked_source_type": "string",
"customer_name": "string",
"customer_phone": "string",
"customer_reference": "string",
"delivery_date": "2023-04-25T07:16:33.551Z",
"discount_total": 0,
"due_date": "string",
"fail_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"from": 0,
"id": 0,
"initial_normal_tax": 0,
"initial_tax": 0,
"initial_tips": 0,
"initial_total": 0,
"inventory_status": "string",
"line_items": [
{
"discount_total": 0,
"id": 0,
"image_url": "string",
"label": "string",
"price": 0,
"purchasable_type": "string",
"purchase_id": "string",
"quantity": 0,
"total": 0
}
],
"note": "string",
"notify_url": "string",
"number": "string",
"oms_delivery_note": {
"address1": "string",
"address2": "string",
"city": "string",
"country": 0,
"email": "string",
"name": "string",
"note": "string",
"phone": "string"
},
"paid_total": "string",
"payment_link_url": "string",
"reference_number": "string",
"refund_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"return_url": "string",
"sale_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"signatures": [
{
"encoded_signature": "string",
"transaction_id": 0
}
],
"state": "string",
"subtotal": 0,
"surcharge_fee": 0,
"type": "string",
"unpaid_total": "string",
"updated_at": "2023-04-25T07:16:33.551Z",
"void_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:16:33.551Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:16:33.551Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
]
}
}

Query Order

API Description

Request URL

https://gateway.wonder.app/api/oms/b2b/open/payment/orders/reference/{reference_number}

Request Method

GET

Request Parameters

VariableTypeRequiredDescription
business_idstring(36)Y[header] Business ID
reference_numberstring(32)Y[path] Unique internal order number in the merchant system
Request Example

Header:

{
"x-app-slug": "3pDZ5B",
"x-app-key": "deb512b8-00b3-4cb9-a1b8-45d564a5fb81",
"authorization": "Bearer XXXXXXXXXXXXXXXX",
"x-p-business-id": "c3cc84fe-b1c3-11ec-a3d9-42010aaa001d"
}

Response Parameters

VariableTypeRequiredDescription
numberstring(24)YBindo order number
reference_numberstring(32)YUnique internal order number in the merchant system
correspondence_statestring(20)YPaid state: unpaid/partial_paid/paid/over_paid/refunded
statestring(20)YOrder state: in_completed/voided/completed
initial_totalfloatYOrder amount
paid_totalfloatYPayment amount
line_itemsobject arrayYOrder product information
--idintegerYSKU ID
--labelstring(255)YSKU name
--quantityintegerYSKU quantity
--pricefloatYSKU unit price
--discount_totalfloatYSKU discount total amount
sale_transactionsobject arrayTransactions. include refunded transactions
-- idintegerYTransaction ID
-- amountfloatYTransaction amount
-- currencystring(3)YCurrency
-- successbooleanY
-- allow_voidbooleanYTransaction can be voided or not
-- allow_refundbooleanYTransaction can be refuded or not
-- refunded_amountbooleanYRefunded amount
refund_transactionsobject arrayNRefunded transactions
-- idintegerYTransaction ID
-- amountfloatYRefunded amount
-- currencystring(3)YCurrency
-- successbooleanY
void_transactionsobject arrayNVoided transactions
-- idintegerYTransaction ID
-- amountfloatYVoided amount
-- currencystring(3)YCurrency
-- successbooleanY
Response Example

Body (JSON):

{
"code": 200,
"message": "successful",
"data": {
"additional_documents": [
"string"
],
"auth_code": "string",
"business_name": "string",
"correspondence_state": "string",
"created_at": "2023-04-25T07:15:03.222Z",
"created_by": "string",
"currency": "string",
"custom_attributes": "string",
"customer_country_code": "string",
"customer_dial_code": "string",
"customer_email": "string",
"customer_linked_source_type": "string",
"customer_name": "string",
"customer_phone": "string",
"customer_reference": "string",
"delivery_date": "2023-04-25T07:15:03.222Z",
"discount_total": 0,
"due_date": "string",
"fail_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:15:03.222Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:15:03.222Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"from": 0,
"id": 0,
"initial_normal_tax": 0,
"initial_tax": 0,
"initial_tips": 0,
"initial_total": 0,
"inventory_status": "string",
"line_items": [
{
"discount_total": 0,
"id": 0,
"image_url": "string",
"label": "string",
"price": 0,
"purchasable_type": "string",
"purchase_id": "string",
"quantity": 0,
"total": 0
}
],
"note": "string",
"notify_url": "string",
"number": "string",
"oms_delivery_note": {
"address1": "string",
"address2": "string",
"city": "string",
"country": 0,
"email": "string",
"name": "string",
"note": "string",
"phone": "string"
},
"paid_total": "string",
"payment_link_url": "string",
"reference_number": "string",
"refund_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:15:03.223Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:15:03.223Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"return_url": "string",
"sale_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:15:03.223Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:15:03.223Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
],
"state": "string",
"subtotal": 0,
"surcharge_fee": 0,
"type": "string",
"unpaid_total": "string",
"updated_at": "2023-04-25T07:15:03.223Z",
"void_transactions": [
{
"3ds": "string",
"acquirer_response_body": "string",
"amount": 0,
"created_at": "2023-04-25T07:15:03.223Z",
"currency": "string",
"extra": {
"credit_card_type": "string",
"first_6_digits": "string",
"holder_name": "string",
"last_4_digits": "string",
"number": "string"
},
"from": "string",
"id": 0,
"is_pending": true,
"note": "string",
"payment": "string",
"payment_data": "string",
"payment_method": 0,
"reference_id": "string",
"success": true,
"voided_at": "2023-04-25T07:15:03.223Z",
"allow_void": false,
"allow_refund": false,
"refunded_amount": 0
}
]
}
}

Order Webhook Notification

When an order is created, paid, voided, or refunded, and a callback URL is configured, you will receive this notification.

API Description

Request Method: POST

Callback URL: This link is set through the "callback_url" request parameter in the Create Order API. Please ensure that the callback URL can be accessed externally. Example of a callback URL: "https://pay.doman.com/callback".

Notification Rules

  1. During the notification integereraction with the backend, if the response received does not comply with the specification or exceeds the time limit, the platform considers the notification failed and will periodically reissue the notification through certain strategies to increase the success rate of notification as much as possible, but it does not guarantee that the notification will ultimately be successful. (Notification frequency is 15s/15s/30s/3m/10m/20m/30m/30m/30m/60m/3h/3h/3h/6h/6h - a total of 24h4m)
  2. In case of unclear order status or no webhook result notification received, it is recommended to proactively call the Query Order API to confirm the order status.

Notification Parameters

VariableTypeRequiredDescription
app_slugstring(255)YApp slug(x-app-slug)
noncestring(255)YRandom value
signstring(255)YSignature value
actionstring(20)YAction:order.created/order.paid/order.payment_failure/order.voided/order.refunded/transaction.voided
orderobjectYOrder object
-- numberstring(24)YOrder number
-- reference_numberstring(32)YIntegerernal order number
-- store_idintegerYStore ID
-- business_idstring(36)YBusiness ID
-- auth_codestring(255)YOrder authorization query code
-- paid_totalfloatYPaid amount
-- unpaid_totalfloatYUnpaid amount
-- statestring(20)YOrder status: invoiced/in_completed/voided/completed
-- correspondence_statestring(20)YPayment status: unpaid/partial_paid/paid/refunded
Notification Example

Body(JSON):

{
"app_slug": "3pDZ5B",
"nonce": "H0AKlYqYFtfs",
"sign": "34CAAF32B636A068A4080427F68960A4",
"action": "order.created",
"order": {
"id": 100,
"store_id": 1,
"business_id": "84cf5702-b292-11ec-a3d9-42010aaa001d",
"number": "201801312107321291062222",
"reference_number": "1000026",
"state": "completed",
"correspondence_state": "paid",
"auth_code": "htxnD0YhUJYoZjA",
"paid_total": 100,
"unpaid_total": 0
}
}

Signature verification steps

When receiving a webhook request, signature verification is required to ensure the legitimacy of the request source. The following is the process of signature verification:

Step 1: Sort the parameters of the order object, nonceand app_key alphabetically by parameter name, and concatenate the parameter names and their values integero a string in the format "parameter1=value1&parameter2=value2&..."

Step 2: Calculate the hash value of the string using MD5 function, and compare the calculated hash value to the signature value provided in the API request.

Step 3: If the two values match, the signature is valid and the request can be processed. If the values do not match, the request should be rejected as unauthorized.

Please note the following important rules:

  • The API may add fields, and the verification process must support these additional fields.

Example:

app_key: deb512b8-00b3-4cb9-a1b8-45d564a5fb81 (x-app-key)
nonce: H0AKlYqYFtfs
sign: 34CAAF32B636A068A4080427F68960A4

Step 1: Sort the parameters of the order object, nonceand app_key alphabetically by parameter name, and concatenate the parameter names and their values.

stringTemp = "app_key=deb512b8-00b3-4cb9-a1b8-45d564a5fb81&auth_code=htxnD0YhUJYoZjA&business_id=84cf5702-b292-11ec-a3d9-42010aaa001d&correspondence_state=paid&id=100&nonce=H0AKlYqYFtfs&number=201801312107321291062222&paid_total=100&reference_number=1000026&state=completed&store_id=1&unpaid_total=0"

Step 2: Calculate the MD5 hash value and verify it

signValue = MD5(stringTemp).toUpperCase()
output: 34CAAF32B636A068A4080427F68960A4

if (signValue == sign) {
// TODO
}

The relationship between action and order/payment state

actionstate(order state)correspondence_state(payment state)
order.createdinvoicedunpaid
order.paid(partial)in_completedpartial_paid
order.paid(fully)completedpaid
order.payment_failureinvoicedunpaid
order.voidedvoidedunpaid
order.refunded(partial)in_completedpartial_paid
order.refunded(fully)completedrefunded
transaction.voided(parital)in_completedpartial_paid
transaction.voided(fully)completedrefunded

Notification Response

Successful reception: HTTP response status code must return 200 without returning response message.

Failed reception: HTTP response status code must return 5XX and return response message in the following format:

VariableTypeRequiredDescription
codestringYError code, SUCCESS for successful receipt by the clearing institution, other error codes for failure.
messagestringYResponse information, if not empty, is the reason for the error. Example Value: FAIL

Example:

{  
"code": "FAIL",
"message": "error message"
}

Whitelist IP

If you have firewall requirements and need to allow specific IP addresses to access your production environment, please add the following IP addresses to your firewall whitelist:: 119.8.39.23/32 119.8.232.135/32

Make sure to regularly update and maintain this whitelist to ensure that your integration with Wonder remains secure and operational. Additionally, it's a good practice to consult Wonder's documentation or support for the most up-to-date list of IP addresses that should be allowed through your firewall.

API Rejection Reason

API Gateway Rejection Code

HTTP CodeDESCRIPTION
400Invalid Parameter
500Internal Server Error
NO.CodeDESCRIPTION
1100001Invalid Parameter
2100102Invalid Currency. Store does not support currency
3100201Store Does Not Exist
4100301Order Does Not Exist
5100302Order Has Already Paid
6100303Order Has Already Voided
7100304Order Has Already Overdue
8100305Invalid Currency. Order does not support currency
9100307Order Can't be Voided
10100308Order Can't be Refund
11100309Reference Number Has Already Existed
12100310Transaction Amount Error
13100311Order Can't be Close
14100312Order Has Already Closed
15100401Transaction Does Not Exist
16100403Transaction Can't be Voided
17100701Payment Failed
18100704Invalid Payment Method
19400000001Invalid Parameter
20400000002The auth app does not exist
21400002000Invalid app secret key