# Refunds from Salesforce

FinDock supports initiating refunds from Salesforce in addition to refunds initiated from PSPs.

The Refunds from Salesforce feature is in [beta](/faq/findock-feature-maturity-stages) and open to all customers for testing.

**Pilot scope and limitations**

* Supported PSPs
  * Authorize.net (and their [standard limitations](https://developer.authorize.net/docs/anet/en-us/merchant/user/all/anet/anet-olh-merchant/payments-intro/trx-mgmt-intro/refund-requirements.html))
  * Paya (and their standard limitations)
  * Stripe (and their [standard limitations](https://docs.stripe.com/refunds))
* Supported sources
  * FinDock Standalone
  * Fundraising (NPC, EDU)


## Setting up Refunds from Salesforce

Refunds from Salesforce currently does not have any explicit setting in the FinDock Setup. However, using the feature requires the FinDock Core Refunds Run permission set, part of the FinDock Service Agent permission set group. For specific integration patterns, see [Integrating Refunds from Salesforce](/docs/payments/integrating-refunds-from-salesforce).

Please also keep in mind potential impact on existing business processes that are built around initiating refunds from PSP dashboards and portals. A refund of the same payment initiated from the PSP and from Salesforce should be automatically handled by the PSP. Whichever initiation comes second is blocked. However, it is better to avoid overlapping refund initiation processes and eliminate failure scenarios that are normal and expected.

### What can be refunded

Any individual Payment (`cpm__Payment__c`) record linked to an installment is potentially refundable. The refund amount can be less than or equal to the payment amount. FinDock automatically checks of the sum of all refunds for a given payment remains below or equal to the original payment amount to prevent over-refunding.

To be able initiate the refund from Salesforce, the following must be true for the Payment record:

* Amount: greater than zero
* Payment Method: not empty
* Payment Reference: not empty
* Payment Processor: not empty
* Target: not empty


One-time and recurring payments set up and collection through FinDock have all the needed data for refunding. If you are migrating, importing or otherwise manually creating payments in FinDock, make sure the required fields in Payment records are populated.

## Refunds with Fundraising as source

If you have customizations on top of the default Salesforce Gift Refund capabilities, please carefully test refunds in your unique context and flows to ensure everything works as expected.

When using [Fundraising as a source](/docs/source-connectors/introduction-to-findock-for-fundraising), processing refunds through FinDock automatically creates corresponding Gift Refund records. The Gift Refund records are created and updated based on the Guided Matching results from processed inbound reports.

Refunds triggered from FinDock automatically create a corresponding, linked Gift Refund record with the following mapping. Limitations on field updating only apply when a Gift Refund record in linked to a Refund record.

| Gift Refund | FinDock Refund | Sync | Comments |
|  --- | --- | --- | --- |
| Amount | Amount | One way | Can only be changed from the Refund record |
| Date | Created Date / Refund Date | One way | Create Date when initiated, Refund Date when completed |
| Reason | Refund Reason | Two way | Only synced if values are same |
| Status | Status | One way | Can only be changed from the Refund record |


FinDock uses the following status mapping between Refund and Gift Refund:

| Refund Status | Gift Refund Status |
|  --- | --- |
| Pending Processing | Initiated |
| Failed | Failed |
| Completed | Completed |


We recommend updating the Refund page layout to include a Gift Refund field to the Details tab so you can easily see the linked record from the Refund record.

Please also note that the Reason picklist on Gift Refund is restricted. Therefore, when setting up Refunds from Salesforce, you need to modify the Refund Reason picklist on the FinDock Refund object to match the Gift Refund Reason values.

## Refunds data model

FinDock uses the [custom Refund object](/docs/data-model/refund) to capture refunds. When the Refund record is created, FinDock makes callouts to the defined PSP and receives notifications that are processed as InBound Report records through Guided Matching.

Please note that manually creating Refund records does not trigger the refund from Salesforce process. The records need to be created through one of the supported integration patterns.

The following ERD illustrates how the Refund object relates to other custom objects and Salesforce objects, in this case, Salesforce with Fundraising (NPC/EDU).

FinDock ERD with Refunds