---
schema_version: "1"
id: e72abed372965a07603bcf8757fd859a57dd079765fea2cbe4ab80957f915026
title: Set Up a Synchronous Payment Gateway Adapter
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_commercepayments_sync_adapter_setup.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_sync_adapter_setup.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 56c6142733ecef8a1a548397c5fbb37523dcc6675b94025ae2dbd560e51a147d
description: For payments transactions, you can configure Salesforce to interface with a synchronous payment gateway adapter.
---
# Set Up a Synchronous Payment Gateway Adapter

For payments transactions, you can configure Salesforce to interface with a synchronous payment gateway adapter.

<table class="editionTable" border="0" summary="Salesforce editions needed for the documented functionality" width="100%"><tbody class="tbody"><tr><td class="subHead">Available in: Salesforce Summer ’20 and later</td></tr><tr><td class="subHead">Available in: API 49.0 and later</td></tr></tbody></table>

  

To access the commercepayments API, you need the PaymentPlatform org permission.

1. Create your payment gateway adapter Apex classes. For instructions, see [Building a Synchronous Gateway Adapter](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_commercepayments_sync_adapter_concept.htm "In synchronous payment configurations, the Salesforce payment platform sends transaction information to the gateway, and then waits for a gateway response that contains the final transaction status. Salesforce creates a transaction only if the transaction is successful in the gateway.").
2. Create a named credential.
    1. From Setup, in the Quick Find box, enter Named Credentials, and then select **New.**.
    2. Complete the required fields, including the URL for your payment gateway.
3. Create a payment gateway provider. The PaymentGatewayProvider object stores details about the payment gateway that Salesforce Payments communicates with when processing a transaction.
    1. Generate an access token according to the instructions in [Connect to Connect REST API Using OAuth](https://developer.salesforce.com/docs/atlas.en-us.264.0.chatterapi.meta/chatterapi/quickstart_connecting.htm "HTML (New Window)").
        
        The response includes the access token, specified in the access\_token property, and the server instance, specified in the instance\_url property. Use this information to make API calls to build the payment gateway provider.
    2. Execute a POST call to the resource using the domain in the instance\_url. For example, https://instance\_name.my.salesforce.com/services/data/vapi\_version/tooling/sobjects/PaymentGatewayProvider.
        
        Use this payload as the request body, replacing value with the correct data.
        
        {
                "ApexAdapterId": "value",
                "DeveloperName": "value",
                "MasterLabel": "value",
                "IdempotencySupported": "value",
                "Comments": "value"
                }
                
                Example:
                {
                "ApexAdapterId": "01pxx0000004UU8AAM",
                "DeveloperName": "MyNewGatewayProvider",
                "MasterLabel": "My New Gateway Provider",
                "IdempotencySupported": "Yes",
                "Comments": "Custom made gateway provider."
                }
4. Create a payment gateway record. The PaymentGateway object stores information about the connection to the external payment gateway. The record requires these field values.
    - Payment Gateway Name: Name of the external payment gateway.
    - Merchant Credential ID: ID of the named credential that you created.
    - Payment Gateway Provider ID: ID of the payment gateway provider that you created.
    - Status: Active

#### See Also

- [_Object Reference for the Salesforce Platform_: PaymentGateway](https://developer.salesforce.com/docs/atlas.en-us.264.0.object_reference.meta/object_reference/sforce_api_objects_paymentgateway.htm "Object Reference for the Salesforce Platform: PaymentGateway - HTML (New Window)")
- [_Object Reference for the Salesforce Platform_: PaymentGatewayProvider](https://developer.salesforce.com/docs/atlas.en-us.264.0.object_reference.meta/object_reference/sforce_api_objects_paymentgatewayprovider.htm "Object Reference for the Salesforce Platform:
    PaymentGatewayProvider - HTML (New Window)")