Void Transactions
#
OverviewThis API is used to void/cancel a purchase and issue a full refund to the customer after the Sunbit transaction has been completed. Calling this API will cancel the entire purchase immediately and notify the customer and merchant of the cancellation and refund.
Use Cases
- A customer has returned all the items from the original purchase
- The merchant cannot fulfill the entire order (e.g., runs out of inventory)
#
Void / Cancel Transactionhttps://api-sandbox.sunbit.com/epay/api/v1/epay/cancel/{purchaseId}#
PUT#
HeadersAttribute | Required | Type | Description |
---|---|---|---|
sunbit-key | yes | text | Provided to you by Sunbit |
sunbit-secret | yes | text | Provided to you by Sunbit |
#
Query ParametersAttribute | 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 |
#
BodyAttribute | 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 |
#
ResponseAttribute | Type | Description |
---|---|---|
purchaseId | text | Same purchase ID from request |
status | text | Purchase status after cancellation |
Response Status Types
status | description |
---|---|
VOIDED | The transaction has been cancelled |
#
Example#
Requestcurl -X PUT "https://api-sandbox.sunbit.com/epay/api/v1/epay/cancel/39325178" -H "accept: */*" \-H "sunbit-key: YOUR_KEY" -H "sunbit-secret: YOUR_SECRET" \-H "Content-Type: application/json"\ -d "{ \"transactionId\": \"23259d52f67fb8\", \"location\": \"retailer4\"}"
#
Response{ "purchaseId": "39325178", "status": "VOIDED"}