Process Refund Request
To process a refund, SHOPLINE will make an HTTP call to the latest refund URL set by your payment app, using a predetermined parameter protocol. The following diagram illustrates how the refund process between your payment app and SHOPLINE works:
- The merchant requested a refund.
- SHOPLINE sends a backend request to the payment app specifying a refund.
- The payment app handles refunds.
- The payment app completes the refund process and returns the refund result to SHOPLINE.
- SHOPLINE updates refund status.
Refund Status Flow
For a refund request initiated by a payment app, we expect its refund status to flow as follows:
Request refund interface
When requesting a refund, Shopline will request the refund Url provided by you through Http-Post;
Example request header
Correnspods to Http Request Header
pay-api-version: 1.0.0
pay-api-idempotency-key: TESTKEYKEYKEY
pay-api-signature: SIGNSIGNSIGN
pay-api-timestamp: 1665632758606000
Field | Is it required? | Description |
---|---|---|
pay-api-version | Yes | The API VERSION you filled in when configuring the payment app extension |
pay-api-idempotency-key | Yes | idempotent key |
pay-api-signature | Yes | Signature value |
pay-api-timestamp | Yes | Timestamp when the request was initiated |
Request body Example
Corresponds to Http Request Body
{
"refundTransactionId": "test_9b20051a834a",
"channelOrderTransactionId": "test_23ad103a2d40",
"amount": 60,
"currency": "test_999f91411796",
"notifyUrl": "test_6682bc9bbd0e",
"reason": "test_41b3cb8a59e7"
}
Field | Type | required? | Description |
---|---|---|---|
refundTransactionId | string | Yes | Refund serial number |
channelOrderTransactionId | string | Yes | Channel ID of the payment order |
amount | integer | Yes | Amount of refund |
currency | string | Yes | Currency of refund |
notifyUrl | string | Yes | Notification URL for asynchronous results |
reason | string | No | reason for refund |
Response header example
SHOPLINE must receive the expected result before it considers the call successful. If the expected result is not returned, then SHOPLINE will re-initiate the request with the same parameters after a certain period of time until it finally gets the expected response or reaches Maximum number of retries;
corresponding to Http Response Header
pay-api-signature: SIGNSIGNSIGN
Field | Is it required? | Description |
---|---|---|
pay-api-signature | yes | Signature value |
Response body example
Corresponds to Http Responese Body
{
"refundTransactionId": "test_b2d02e4cf198",
"channelRefundTransactionId": "test_8bc8a9f59480",
"channelOrderTransactionId": "test_93d9fea7eda2",
"amount": 80,
"currency": "test_cea487102235",
"refundStatus": "test_c07b9a2944be",
"returnCode": "test_ee09856d2a50",
"returnMessage": "test_d7d75b56590f",
"returnMessageId": "test_adbad71be1c1"
}
Field | Type | required? | Description |
---|---|---|---|
refundTransactionId | string | Yes | Refund serial number |
channelRefundTransactionId | string | Yes | Channel side refund ID |
channelOrderTransactionId | string | Yes | Channel ID of the payment order |
amount | integer | Yes | refund amount |
currency | string | Yes | Refund Currency |
refundStatus | string | Yes | Refund status |
returnCode | string | Yes | interface status code SUCCESS |
returnMessage | string | No | Failure reasons |
returnMessageId | string | No | Channel response identifier UUID, such as traceId |
Synchronize refund results
After receiving the refund request, if you cannot process it to the final state synchronously, then you can use the following two methods to synchronize the refund result with SHOPLINE. SHOPLINE recommends that you provide both methods:
- Provide a refund query URL, then Shopline will initiate an HTTP call through the refund query URL at a certain frequency after successfully calling the refund URL, and try to get the result of the payment until the final state is obtained or the timeout is reached;
- Actively call our refund notification Webhook interface until a correct response is returned;
Sample Refund Query Request Header
Corresponds to Http Request Header
pay-api-version: 1.0.0
pay-api-idempotency-key: TESTKEYKEYKEY
pay-api-signature: SIGNSIGNSIGN
pay-api-timestamp: 1665632758606000
Field | Is it required? | Description |
---|---|---|
pay-api-version | Yes | The API VERSION you filled in when configuring the payment app extension |
pay-api-idempotency-key | Yes | idempotent key |
pay-api-signature | Yes | Signature value |
pay-api-timestamp | Yes | Timestamp when the request was initiated |
Sample Refund Query Request Parameters
Corresponds to Http Request Query
refundTransactionId = SLASDJK12312131
Field | Is it required? | Description |
---|---|---|
refundTransactionId | Yes | Refund serial number |
Sample Refund Query Response Header
Corresponds to Http Response Header
pay-api-signature: SIGNSIGNSIGN
Field | Is it required? | Description |
---|---|---|
pay-api-signature | Yes | Signature Value |
Sample Refund Query Response Body
Corresponds to Http Response Header Body
Field | Type | Is it required? | Description |
---|---|---|---|
refundTransactionId | string | Yes | Refund serial number |
channelRefundTransactionId | string | Yes | The refund serial number of the channel |
channelOrderTransactionId | string | Yes | Channel ID of the channel payment order |
amount | integer | Yes | refund amount |
currency | string | Yes | Refund currency |
refundStatus | string | Yes | Refund status |
failCode | string | NO | failure error code |
failMessage | string | NO | Failure reasons |
returnCode | string | Yes | interface status code SUCCESS |
returnMessage | string | NO | Failure reasons |
returnMessageId | string | NO | Channel response identifier UUID, such as traceId |
Proactively notify Shopline of the refund result
You can actively notify Shopline of the refund result by calling the OpenApi interface of the refund result notification;