Refund a transaction

Refund a transaction

POST /svc/payment/api/v1/openapi/orders/refund

Request

  • application/json

Body

order objectrequired

number Wonder order number (string)

reference_number Your order number (string)

transaction objectrequired

uuid stringrequired

refund objectrequired

amount stringrequired

note stringrequired

Responses

  • 200

Response Headers

  • application/json

  • Schema

  • Example (auto)

Schema

code numberrequired

message stringrequired

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, refunded]

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/orders/refund"); request.Headers.Add("Accept", "application/json"); var content = new StringContent("{\n \"order\": {\n \"number\": \"string\",\n \"reference_number\": \"string\"\n },\n \"transaction\": {\n \"uuid\": \"string\"\n },\n \"refund\": {\n \"amount\": \"string\",\n \"note\": \"string\"\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

{ "order": { "number": "string", "reference_number": "string" }, "transaction": { "uuid": "string" }, "refund": { "amount": "string", "note": "string" } }