Onerway
POST

Create or cancel refund

Use this endpoint to submit a refund request for a successful payment, or cancel a submitted request before Onerway approves it. Refund availability and request time limits depend on the payment method.

Request

merchantNo
Merchant number assigned by Onerway. See Setup for how to obtain it.
Example:
refundType
Refund operation type: create a refund request or cancel a submitted request.
Example:
Allowed values
0
Create a refund request.
1
Cancel a submitted refund request.
Constraints
Rule
Refund availability, support for partial or multiple refunds, and the refund request time limit depend on the payment method. Most payment methods support partial and multiple refunds.
Rule
Submit a cancellation before Onerway approves the refund request. After approval, Onerway submits the request to the payment channel or card issuer. A processing status alone does not mean that the refund request can still be cancelled.
merchantTxnId
Merchant transaction number for this refund, used for tracking and reconciliation.
Example:
Constraints
Rule
Onerway generates this identifier if it is omitted. Duplicate submissions are rejected.
originTransactionId
Original Onerway transaction number associated with this refund operation.
Example:
Constraints
Rule
For refundType=0, provide the transaction ID of the original payment. For refundType=1, provide the transaction ID of the refund request to cancel.
refundAmount
Amount to refund.
Example:
Constraints
Consistency
The refund amount is expressed in the original payment currency.
Consistency
The total amount refunded across all refunds must not exceed the payment amount.
sign
Request signature string. See Request signing for how to generate it.

Request example

curl -X POST 'https://sandbox-acq.onerway.com/v1/txn/onlineRefund' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "merchantNo": "demo_merchantNo",
  "refundType": "0",
  "merchantTxnId": "demo_refund_merchant_txn_id",
  "originTransactionId": "demo_payment_transaction_id",
  "refundAmount": "20",
  "sign": "replace_with_signature"
}'

Response

respCode
For refundType=0, 20000 means the refund request was accepted, not that the refund succeeded. Handle the Refund result webhook or Refund request rejection webhook; use Query refunds if no notification arrives. A successful cancellation (refundType=1) does not trigger a notification. Other response codes are listed in Response codes.
Constraints
Rule
Most refunds are credited immediately. Other refunds can take up to 25 days.
respMsg
Human-readable message for the response code.
data
Refund transaction number.
Constraints
Rule
For refundType=0, this is the newly created Onerway refund transaction number. For a successful cancellation (refundType=1), this equals originTransactionId in the request.

Response example

{
  "respCode": "20000",
  "respMsg": "Success",
  "data": "demo_refund_transaction_id"
}
No error responses are documented for this endpoint.