Skip to main content

Void Transactions

Overview#

This 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 Transaction#

PUT https://api-sandbox.sunbit.com/epay/api/v1/epay/cancel/{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

Response#

AttributeTypeDescription
purchaseIdtextSame purchase ID from request
statustextPurchase status after cancellation

Response Status Types

statusdescription
VOIDEDThe transaction has been cancelled

Example#

Request#

curl -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"}