Refunds
You can refund payments from the Unaric Payments Refunds tab.
Some payment service providers place restrictions on refunds. If this is the case, you will need to contact your payment service provider and ask them to enable refunds on your account.
How it works
When a refund is submitted from Salesforce, the following flow of events takes place:
Refund request
Salesforce securely sends the refund request through to the Unaric Payments servers. Unaric Payments identifies the refund requested, the amount requested, and then instructs the card gateway to process the refund against the original transaction. Depending on the amount, this can either be a full or a partial refund.
Gateway check & refund response
The card gateway will (usually) perform some checks on their side to ensure the refund amount doesn't exceed the value of the original transaction; sometimes, they will limit the number of individual partial refunds that can be made against the same transaction. The card gateway then executes the refund request and returns the response to Unaric Payments.
Refund object & processing
Unaric Payments will parse the response from the card gateway, and create the relevant refund object in Salesforce. This will update the Amount refunded field on the original payment request, if the refund was successful.
Requisites
To process a refund, the following must be true on the record:
- The associated Payment record should have the status Collected From Customer. In other words, The original payment must have been paid before it can be refunded.
- The Record Type of the original payment should be Inbound.
Required permissions
Assign the Refund permissions to anyone in your organisation that requires it.
Permission Set | Details |
|---|---|
Unaric Payments Refunds | Refund - Read, Create, Edit |
Legacy compatibility
If you are upgrading from Unaric Payments v2.19.1 or earlier versions, you must add the picklist value New to the Refund_Stage__c field on the asp_Refund__c object and mark this value as default. Ideally it should be at the top of the list so you may need to reorder your values for this picklist.
You will also need to add the button Process Refund to the List View layout for the same object and on the Refund Page the Process Refund button is in Mobile & Lightning Quick Actions.
Create refund records
- Go to the Unaric Payments Refunds tab.
- Click the New button on the action bar.
- A pop-up window will ask you to select the payment to refund, refund amount, payment route, and amount.
- Click Save to finish.
Multiple refunds can be issued against the same payment, so long as your payment provider allows this and the total amount refunded does not exceed the original transaction value.
Process refunds manually
- On the Payments tab, select the payment record and press the Refund button.
- A pop-up window will ask you to either choose to refund a specified amount up to the original amount of the payment.

- Click Process Refund to finish.
Automate refunds
Via scheduled job
You can schedule the Refund job to process refund records automatically, or even create and process refund records automatically.
The apex job to process Refunds is separate from the existing Unaric Payments Repeat Payments scheduled job. It will need to be separate from and scheduled separately. Scheduling the refund job to process all refund records with a status of ‘New’ can be done in one of the following two ways:
If you require the job to run more than once a day, schedule from within Developer Console using the apex code below (set your own cron expression as per frequency required):
Via batch class
Use this code to process existing refund records.
The code takes a List of Refund IDs. This is particularly useful for reprocessing refunds that were in a Failed status, as long as you provide the IDs of those failed refund records—they won’t be picked up automatically.
Failed records can alternatively be submitted via the List View or via the Record itself once the reason for failure has been addressed.
Refunds with Direct Debit
Processing refunds from direct debit payments can be risky. A customer is protected under the Direct Debit Scheme Rules; if a Direct Debit is collected in error, they should request a refund from their bank. This means you could easily end up with a double refund, and subsequently have to resort to legal means to claim back the funds.