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.
  • Linked refunds are supported for both CARD and ACH payment methods, whereas unlinked refunds are supported only for the CARD payment method.

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
sourcestringMax length 50Indicates the X-source header value received in API request
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
statusStringPENDING, COMPLETED, FAILEDRefund Status
agentAgentAgent Description

Customer Structure

FieldTypeValid valuesDescription
enterpriseIdentifierstringMax lengthEnterprise Identifier
hsiduuidvalid uuid4Healthsafe Identifier
metadataObjectClient 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

Agent Structure

FieldTypeValid valuesDescription
firstNamestringMax length 50First name of Agent
lastNamestringMax length 50Last name of Agent
userIdstringMax length 50MSId of Agent
isAccessVerifiedbooleantrue/falseIs access verified by merchant

Paymentmethod Structure

FieldTypeValid valuesDescription
iduuidvalid uuid4Payment method Id
cardCardCard Description when payment Method is of type CARD.
Deprecated in favour of paymentMethodDetails
nicknamestringMax length 50Payment method nickname
defaultbooleantrue/falsedetermines if the payment method is default for the customer
paymentMethodTypestringMax length 50Payment method type can be CARD or BANK_ACCOUNT
paymentMethodDetailsCard or ACHOne of Card or ACH
sourceProviderSourceProviderTo identify the source of the Payment method

Source Provider Structure

FieldTypeValid valuesDescription
nameEnumCCG, GOOGLE_PAY, APPLE_PAYName of the source provider

Card Structure

FieldTypeValid valuesDescription
nameOnCardstringMax length 50Name of the customer
cardBrandstringVISA, AMEX, DINERS, DISCOVER, JCB, MASTERCARD, UNIONPAY, UNKNOWNCard brand
expiryMonthlong01-12Month of expiration
expiryYearlongMax length 4Year of expiration
last4stringMax length 4Last four digits of the card
zipCodestringMax length 55 digit zipcode
statusstringACTIVE/EXPIREDStatus of the card
manufacturerCardbooleantrue/falseDetermines if the card is manufacturer card or not. Only Agents can flag certain cards as manufacturer cards. Cards flagged as manufacturer cards cannot be default card.
cardCategoriesCardCategoriesCard categories that define different types of payment cards and their associated medication information

ACH Structure

FieldTypeValid valuesDescription
typestringBANK_ACCOUNTType of the PaymentMethod
accountHolderTypestringindividual or companyAccount holder type
accountTypestringchecking or savingsAccount Type
bankNamestringBank Name
last4stringLast 4 digits of bank account number
routingNumberstringRouting number of bank
nameOnAccountstringName on Account
statusenumACTIVE and INVALIDATEDBank Account Status

CardCategories Structure

CardCategories is an array of card category objects that define different types of payment cards and their associated medication information.

FieldTypeValid valuesDescription
typestringMANUFACTURER_CARDThe type of card category
medicationsarray[object]Array of ObjectsList of medication objects that are eligible for payment using this card

Example CardCategories Structure

"cardCategories": [
{
"type": "MANUFACTURER_CARD",
"medications": []
}
]

Note:

  • The medications array can be empty [] if no specific medications are associated with the card category.
  • cardCategories array can be empty for normal or regular card.

Sample Event

Events will be sent in JSON format.

{
"name": "REFUND_SUCCESS | REFUND_FAILED | REFUND_PENDING",
"source": "vendor-portal",
"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",
"enterpriseIdentifier": null,
"zip5": null,
"phoneNumber": {
"number": "9876543210",
"countryCode": "91"
},
"metadata": {
"patientId": "rx-patient-id"
}
},
"paymentMethod": {
"card": {
"last4": "4444",
"status": "ACTIVE",
"zipCode": "94043",
"cardBrand": "MASTERCARD",
"expiryYear": 2026,
"nameOnCard": "Card Holder Name",
"expiryMonth": 12,
"manufacturerCard": true,
"cardCategories": [
{
"type": "MANUFACTURER_CARD",
"medications": []
}
]
},
"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": true,
"cardCategories": [
{
"type": "MANUFACTURER_CARD",
"medications": []
}
]
}
},
"agent": {
"firstName": "string",
"lastName": "string",
"isAccessVerified": true,
"userId": "string"
},
"merchantTransactionId": "b6d52a1f-b4e7-4de7-85de-9bd5032d7643"
},
"error": {
"code": "VENDOR_ERROR",
"message": "Cannot issue refund on expired or cancelled card",
"declineCode": "generic_decline",
"errorDetails": null
}
}

More Info on REFUND_FAILED Webhook

The REFUND_FAILED webhook is triggered when a refund attempt for a payment cannot be successfully processed at Stripe or CCG processor.

This event is critical because it ensures that merchants are informed about refund failures so they can promptly address the situation, maintain customer trust, and avoid operational bottlenecks.

Refer to the table below to understand the various failure scenarios at the CCG processor

Unlinked Refund Failure Scenarios

Error ScenarioREFUND_FAILED Webhook TriggeredPaymentMethodDetails Included
Credit to Invalid Payment Method IDYesNo
Credit Exceeds Allowed Refund LimitYesYes
Credit to Bank AccountYesNo

Linked Refund Failure Scenarios

Error ScenarioREFUND_FAILED Webhook TriggeredPaymentMethodDetails Included
Refund on Invalid Payment IDYesNo
Refund on Uncaptured PaymentYesYes
Refund on Closed ACH AccountYesYes
Refund for Disputed PaymentsYesYes
Refund on Payment Already RefundedYesYes
Refund Greater than Original AmountYesYes