---
schema_version: "1"
id: 1cdfd18e0893231d6e63293937524a9bb6d6fb7d5105e9ad6bf9372ef9270ae8
title: Salesforce Payments for Exchanges with RMA
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/commerce/264-0-0/om_salesforce_payments_exchanges_rma.md
canonical_url: https://help.salesforce.com/s/articleView?id=commerce.om_salesforce_payments_exchanges_rma.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 8dbd4bd5a7626372c08e4fd363fa6739ba5ac801e03d13110d98dda2d97878c1
description: If an exchange requires additional funds, use Salesforce Payments to charge and accept those funds seamlessly.
products:
  - Commerce
  - Salesforce Order Management
release: "264"
---
# Salesforce Payments for Exchanges with RMA

If an exchange requires additional funds, use Salesforce Payments to charge and accept those funds seamlessly.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=commerce.om_editions.htm&amp;language=en_US" target="_blank">View supported editions</a>.</td></tr></tbody></table>

Salesforce Payments can work with Exchanges RMA using B2C, B2B, or D2C Commerce.

Because Salesforce Payment Gateways don’t automatically appear as available integrations, there’s an extra step for Exchanges RMA on B2B and D2C stores to work with Salesforce Payments.

Set up an alternative provider on the Payments page. This alternative provider must be a credit card gateway that’s created by Salesforce Payments. To configure the StoreIntegratedService for Salesforce payments, run this script. Use your own web store name and merchant account name for the payment gateway.

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-commerce-om_order_management-264-0-0-production-enus/4c4844e3-a194-4a65-95b7-17291a6dbefa/images/icon_example.png)

Example

```
// Script to add a connection between the webstore and the payment gateway for stores using
// Salesforce Payments (SFP) as the payment gateway for SFP does not show in the the Payment 
// Alternate Integration.

String merchantAccountName = 'DemoTest';
String webStoreName = 'B2B Store';

// obtain webstoreid
List<WebStore> webstores = [SELECT Id, Name FROM WebStore WHERE Name = :webStoreName];
System.debug('Webstores: ' + webstores);
if(webstores.isEmpty()){
    System.debug('Error obtaining webstore with name ' + webStoreName);
}
String webStoreId = webstores[0].Id;
System.debug('WebStoreId: ' + webStoreId);

// obtain merchant account 
List<MerchAccPaymentMethodSet> merchAccPaymentMethodSet = [SELECT Id, MerchantAccountId, DeveloperName FROM MerchAccPaymentMethodSet WHERE MerchantAccount.Name = :merchantAccountName];
System.debug('Details: ' + merchAccPaymentMethodSet);
if(merchAccPaymentMethodSet.isEmpty()){
    System.debug('Error obtaining MerchAccPaymentMethodSet with name ' + merchantAccountName);
}
String merchantAccountId = merchAccPaymentMethodSet[0].MerchantAccountId;
System.debug('merchantAccountId: ' + merchantAccountId);

// obtain payment gateway id from the merchant account
List<PaymentGateway> paymentGateways = [SELECT Id, PaymentGatewayName FROM PaymentGateway WHERE MerchantAccountId = :merchantAccountId];
System.debug('paymentGateways: ' + paymentGateways);
if(paymentGateways.isEmpty()){
    System.debug('Error obtaining payment gateway with merchant account id ' + merchantAccountId);
}
String paymentGatewayId = paymentGateways[0].Id;
System.debug('paymentGatewayId: ' + paymentGatewayId);

// If a StoreIntegratedService already exists for Payment on the WebStore then update the Integration field with the paymentGatewayId
List<StoreIntegratedService> storeServices = [SELECT Id FROM StoreIntegratedService WHERE StoreId = :webStoreId AND ServiceProviderType ='Payment' ];
System.debug('storeServices: ' + storeServices);
if(storeServices.isEmpty()){
    StoreIntegratedService storeService = new StoreIntegratedService(
        StoreId = webStoreId,
        Integration = paymentGatewayId,
        ServiceProviderType ='Payment');
    insert storeService;
} else {
    StoreIntegratedService existingStoreService = storeServices[0];
    existingStoreService.Integration = paymentGatewayId;
    update existingStoreService;
}
```

#### See Also

- [Exchanges with RMA Setup](https://help.salesforce.com/s/articleView?id=commerce.om_exchanges_rma_setup.htm&release=264.0.0&type=5 "After you have installed and configured either an Order Management, B2B Commerce, or D2C Commerce org, configure Exchanges with RMA Returns.")
- [Exchanges with RMA Returns Overview](https://help.salesforce.com/s/articleView?id=commerce.om_exchanges_rma_overview.htm&release=264.0.0&type=5 "An exchange with an RMA return provides a more robust exchange experience for customers. Unlike a simple exchange, which only allows for same-cost variant exchanges, an exchange with RMA processes the return of the previous product before letting a customer service representative (CSR) order a new item, enter a new delivery address, and select a shipping method, all on behalf of the user. Finally, the CSR can process any refund or additional funds needed from the customer.")