Skip to main content

Refunds

Refund events are sent when a refund is processed. Refunds can be processed for both CARD and BANK_ACCOUNT payment methods. There are two types of refunds that can be processed i.e., linked and unlinked refunds.

  • Linked refunds are processed against a payment and unlinked refunds are processed without a payment.
  • In case of unlinked refunds i.e., credit / cashback, payment method id is needed to process the refund.

Supported Events

Event TypeDescriptionApplicable payment method types
REFUND_SUCCESSEmitted when refund is successful.CARD, BANK_ACCOUNT
REFUND_FAILEDEmitted when a refund fails.CARD, BANK_ACCOUNT
REFUND_PENDINGEmitted when a refund status is pending.CARD, BANK_ACCOUNT

Event Structure

FieldTypeValid valuesDescription
nameEnumREFUND_SUCCESS, REFUND_FAILED, REFUND_PENDINGEvent name
payloadPayloadEvent Payload

Payload Structure

FieldTypeValid valuesDescription
amountlong50 - 99999999Refund amount in United States Cents
reasonStringMax length 50Refund reason
refundIduuidvalid uuid4Refund Identifier
PaymentPaymentPayment Details
merchantTransactionIdStringMax length 50MerchantTransactionId sent by the merchant with original refund request
merchantIduuidvalid uuid4Merchant Identifier
metadataStringMax length 50Client provided additional metadate
paymentMethodPaymentMethodPaymentmethod Description
customerCustomerCustomer Description
errorErrorError Information
statusStringCOMPLETED and FAILEDRefund Status

Customer Structure

FieldTypeValid valuesDescription
enterpriseIdstringMax lengthPayment method Id
hsiduuidvalid uuid4Healthsafe Identifier
metadatastringMax length 50Client provided additional metadata
firstNameStringfirst name
lastNameStringlast name
emailStringemail address
ssnLastFourDigits (4)SSN last four digits, e.g 1234
phoneNumberObjectContains both the phone number and the country code
└─ numberDigits (10-20)Phone number, e.g. 9876543210
└─ countryCodeDigits (1-3)Country code, e.g. 91
dateOfBirthDate (YYYY-MM-DD)Date of Birth, e.g. 1975-11-14
zip5Digits (5)ZIP Code, e.g. 10001

Error Structure

FieldTypeValid valuesDescription
codestringMax length 50Short code for error
descriptionstringMax length 255Error description
errorDetailsErrorDetailsError details

Error Details Structure

FieldTypeValid valuesDescription
codestringMax length 100code for error
messagestringMax length 255Error description
declineCodestringMax length 100Decline Code
networkAdviceCodestringMax length 100Network Advice Code
networkDeclineCodestringMax length 100Network Decline Code

Sample Event

Events will be sent in JSON format.

{
"name": "REFUND_SUCCESS | REFUND_FAILED | REFUND_PENDING",
"payload": {
"amount": 100,
"reason": "DUPLICATE",
"status": "COMPLETED",
"payment": {
"id": "d3398a06-e038-4aaa-9a6f-08e6884b6aa9",
"amount": 900000,
"merchantId": "b955db5e-aef2-47de-bbb9-c80b9cc16e8f",
"description": "UI widget payment",
"capturedAmount": 900000,
"partialAuthorization": false,
"merchantTransactionId": "68da00a3-d96c-4731-ad9c-f7b4f005b04c"
},
"refundId": "242ecd9b-333a-4537-ba95-bea1de6ce973",
"merchantId": "b955db5e-aef2-47de-bbb9-c80b9cc16e8f",
"customer": {
"name": null,
"firstName": "John",
"lastName": "Doe",
"email": "test@mail.com",
"ssnLastFour": "6785",
"dateOfBirth": "2000-09-21",
"hsid": "62b737bf-ca25-4319-b2b7-05d0fd684654",
"enterpriseId": null,
"zip5": null,
"phoneNumber": {
"number": "9876543210",
"countryCode": "91"
},
patientId": "rx-patient-id"
},
"paymentMethod": {
"card": {
"last4": "4444",
"status": "ACTIVE",
"zipCode": "94043",
"cardBrand": "MASTERCARD",
"expiryYear": 2026,
"nameOnCard": "Card Holder Name",
"expiryMonth": 12,
"manufacturerCard": false
},
"default": false,
"nickname": "",
"paymentMethodType": "CARD",
"paymentMethodDetails": {
"type": "CARD",
"last4": "4444",
"status": "ACTIVE",
"zipCode": "94043",
"cardBrand": "MASTERCARD",
"expiryYear": 2026,
"nameOnCard": "Card Holder Name",
"expiryMonth": 12,
"manufacturerCard": false
}
},
"merchantTransactionId": "b6d52a1f-b4e7-4de7-85de-9bd5032d7643"
},
"error": {
"code": "VENDOR_ERROR",
"message": "Cannot issue refund on expired or cancelled card",
"declineCode": "generic_decline",
"errorDetails": null
}
}