Set Up a Synchronous Payment Gateway Adapter
For payments transactions, you can configure Salesforce to interface with a synchronous
payment gateway adapter.
Available in: Salesforce Summer ’20 and later |
Available in: API 49.0 and later |
To access the commercepayments API, you need the PaymentPlatform org permission.
- Create your payment gateway adapter Apex classes. For instructions, see Building a Synchronous Gateway Adapter.
-
Create a named credential.
- From Setup, in the Quick Find box, enter Named Credentials, and then select New..
- Complete the required fields, including the URL for your payment gateway.
-
Create a payment gateway provider. The PaymentGatewayProvider object stores details about
the payment gateway that Salesforce Payments communicates with when processing a
transaction.
-
Generate an access token according to the instructions in Connect to Connect REST API Using
OAuth.
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.
-
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." }
-
Generate an access token according to the instructions in Connect to Connect REST API Using
OAuth.
-
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