Issue Refunds
Overview#
This API is used to issue a partial refund to the customer after the Sunbit transaction has been completed. It should be used only when the refund amount is less than the total purchase amount.
Use Cases
- A customer returns some of the items from the original purchase
- Not all items from the original order could be fulfilled (e.g., out of stock, unable to deliver)
- An error occurred during the online purchase or there was lower price adjustment
Issue Refunds#
PUT https://api-sandbox.sunbit.com/epay/api/v1/epay/changeAmount/{purchaseId}#
Headers#
| Attribute | Required | Type | Description |
|---|---|---|---|
| sunbit-key | yes | text | Provided to you by Sunbit |
| sunbit-secret | yes | text | Provided to you by Sunbit |
Query Parameters#
| Attribute | Required | Type | Description |
|---|---|---|---|
| purchaseId | yes | text | The purchase Id that is generated by Sunbit for successful Sunbit flow. This ID is returned in the webhook |
Body#
| Attribute | Required | Type | Description |
|---|---|---|---|
| transactionId | yes | text | Your internal ID for the current transaction, should be the same as you provided during the initialization call |
| location | yes | text | Your location ID as provided by Sunbit |
| reason | yes | text | The reason for change should be PARTIAL_REFUND - when a customer returns some items from the purchase or ERROR_CORRECTION when an issue occurs during fulfillment or pricing |
| returnedAmount | yes | decimal | Amount should be less than the total amount in the original purchase |
Response#
| Attribute | Type | Description |
|---|---|---|
| purchaseId | text | Same purchase ID from request |
| changedAmount | decimal | Net purchase amount after refund deduction |
Example#
Request#
curl --request PUT \ --url https://api-sandbox.sunbit.com/epay/api/v1/epay/changeAmount/%7BpurchaseId%7D \ --header 'Content-Type: application/json' \ --header 'accept: */*' \ --header 'sunbit-key: YOUR_KEY' \ --header 'sunbit-secret: YOUR_SECRET' \ --data '{ "transactionId": "23259d52f67fb8", "purchaseId": "39325178", "location": "retailer4"}'Response#
{ "purchaseId": "39325178", "changedAmount": 490}