Skip to main content

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#

AttributeRequiredTypeDescription
sunbit-keyyestextProvided to you by Sunbit
sunbit-secretyestextProvided to you by Sunbit

Query Parameters#

AttributeRequiredTypeDescription
purchaseIdyestextThe purchase Id that is generated by Sunbit for successful Sunbit flow. This ID is returned in the webhook

Body#

AttributeRequiredTypeDescription
transactionIdyestextYour internal ID for the current transaction, should be the same as you provided during the initialization call
locationyestextYour location ID as provided by Sunbit
reasonyestextThe 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
returnedAmountyesdecimalAmount should be less than the total amount in the original purchase

Response#

AttributeTypeDescription
purchaseIdtextSame purchase ID from request
changedAmountdecimalNet 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}