Processing a Refund

Sequence Diagram

Sequence Diagram Steps:

  1. The merchant confirms the refund and submits the request in the Shoplazza backend.
  2. The Shoplazza backend service receives the refund request and initiates the refund process.
  3. The Shoplazza service assembles the refund request and calls the payment app's refund API.
  4. The payments app synchronously returns the refund result.
  5. The Shoplazza backend processes the refund result and displays the outcome.
  6. The payments app asynchronously notifies Shoplazza of the final refund result.
  7. The Shoplazza refund notification service processes the result and updates the order status.

Refund Request Specification

Request Headers

HeaderDescription
Shoplazza-Shop-IdShop ID in the Shoplazza system.
Shoplazza-Shop-DomainSystem domain name assigned by Shoplazza.
Shoplazza-Request-IdThe unique ID of the request.
Shoplazza-Api-VersionOpen API version.
Shoplazza-Hmac-Sha256Digital signature for request validation.

Request Header Example

{
  "refund_id": "db5fc9a6-2a64-11ec-8d3d-0242ac130003",
  "status": "refund_success",
  "message": "success"
}

Refund Request

By calling the refund session URL, the payment-related information is transmitted to the third party, and the third party synchronously returns the refund result. If the current status is not refunded, the refund result will be asynchronously notified.

Request Body: (The request body format is x-www-form-urlencoded)

{
  "id": "7eb3fefb-6b43-4400-b40a-a2a0531364ae",
  "app_id": "db5fc9a6-2a64-11ec-8d3d-0242ac130003",
  "account_id": "TIOnETZE",
  "payment_id": "7eb3fefb-6b43-4400-b40a-a2a0531364ae",
  "amount": "254.20",
  "currency": "CAD",
  "callback_url": "https://developer.myshoplaza.com/openapi/2021-07/payments_apps/notify_callbacks?version=1.0",
  "test": false,
  "type": "refund",
  "extra": "625598363623041156",
  "timestamp": "2021-09-01T18:32:20Z"
}

Request Structure

ParameterRequiredTypeDescription
idYstringUnique refund ID for idempotency.
app_idYstringPayments app ID.
account_idYstringMerchant ID in the payment system.
payment_idYstringOriginal payment ID.
amountYdecimalRefund amount (2 decimal places).
currencyYstringCurrency code (e.g., USD, CAD).
callback_urlYstringURL for asynchronous refund result notifications.
testNbooleanIndicates test mode (no actual refund).
typeYstringFixed value: refund.
extraYstringAdditional information (ignored).
timestampYstringTimestamp in ISO 8601 format.

Refund Response

Refund Response Fields

KeyTypeRequiredDescription
refund_idstringYThe ID of the refund, used to ensure the idempotence of the request and avoid repeated deductions for one payment.
statusstringYRefund status:
- refund_success: Refund completed successfully.
- refund_failed: Refund failed.
- refund_pending: Refund is in progress.
messagestringYRefund description or reason for refund failure.

Refund Response Example

{
  "refund_id": "db5fc9a6-2a64-11ec-8d3d-0242ac130003",
  "status": "refund_success",
  "message": "success"
}