Configure Payment Processing and Payment Methods
Learning Objectives
After completing this unit, you’ll be able to:
- Describe two ways to implement payment processing with Order Management.
- List the steps you need to take to configure a payment gateway.
- List the payment methods supported by Salesforce Payments.
- Explain how to add an alternative payment method.
Payment Processing
Payments encompasses the money aspect of order processing: accessing third-party payment providers, authorizing and capturing funds, and issuing refunds. It’s an important part of an order management system. To enable Order Management to execute payment captures and issue refunds, Linda Rosenberg, Cloud Kicks admin, must integrate a payments component. She has a few choices. Among them are uploading Salesforce Payments from AppExchange or configuring a payment gateway manually.
After she explores how to implement payment processing, she takes a look at the payment methods she can use and how to add new ones.
Salesforce Payments
For easy payment integration with Order Management, Linda installs the Salesforce Payments package, available on AppExchange. Salesforce Payments integrates with the Storefront Reference Architecture (SFRA) front-end and the underlying B2C Commerce back-end components. Linda can link her Salesforce Payments-connected Stripe, PayPal, and Apple Pay accounts with Salesforce Order Management, adding order processing capabilities to the mix. The Payments package installs a Payments Setup app that walks her through linking payment accounts with these providers.
See the Salesforce Payments for Administrators Trailhead module for details.
Configure a Payment Gateway
Linda can also configure a payment gateway manually, such as with Stripe or PayPal, to view and manage payments in Order Management. This involves coding, so she asks a developer to help her. Here are the steps the developer takes.
- Create a payment gateway adapter class using the Salesforce APEX connector framework. To help you get started, see these reference classes:
https://github.com/forcedotcom/Core-Payments-Reference-Gateway-Integration-Adapters.
- Create a payment gateway provider record that points to the adapter class that you created.
- In Setup, define a named credential that contains the gateway provider’s authentication and login information. The adapter class callout definition calls the named credential.
- Create a payment gateway record to link the payment gateway provider record and the named credential.
Payment Methods
Linda is happy to learn that her Salesforce B2C Commerce integration with Order Management and Salesforce Payments supports credit cards, digital wallets, and non-card options such as SEPA and iDEAL.
Here’s how this capability works with order data.
Payment Method |
Details |
---|---|
Credit card |
The payment method ID in the order data must match an entry in the Card Type picklist on the Card Payment Method object. If it matches, a card payment method record is created in Salesforce. You can’t customize the Card Type picklist. |
Digital wallet |
The payment method ID in the order data must match this non-case-sensitive regular expression. If it matches, a digital wallet record is created in Salesforce. paypal|visa_checkout|pay_by_check|.*(apple|google|android|amazon|ali).*(pay)*
|
Non-card options |
Use the Alternative Payment Method object. |
Add Alternative Payment Methods
Linda needs to take her payment methods beyond credit cards and digital wallets. Many countries support cash transactions or other forms of payments—referred to as alternative payment methods—and she wants her storefront applications to support those shoppers. Besides, the payments world is constantly changing. Who knows what payment methods will be popular in the future?
Here’s how she adds a new payment method, with the help of a developer.
- Create a record type for the alternative payment method object that represents the payment method, for example, Square.
- Create a
GtwyProvPaymentMethodType
record (but you can’t do this in the Salesforce UI. The developer inserts the record using a tool, such as Postman, or Apex code.
The API name of the object isGtwyProvPaymentMethodType
, at the URL/services/data/version/sobjects/GtwyProvPaymentMethodType
.
- Set the
GtwyProvPaymentMethodType
fields, as shown in this table.
Field |
Description |
---|---|
Comments |
Optional description. |
Developer Name |
The unique API name of the record. |
Master Label |
A human-readable name for the record. |
Gateway Provider Payment Method Type |
The name of the payment method in the storefront. The value must match the payment method ID used in B2C Commerce. |
Payment Gateway Provider Id |
Reference to the payment gateway provider record associated with the payment processor for the payment method. |
Payment Method Type |
Select AlternativePaymentMethod. To use Alternative Payment Method, first create a corresponding Record Type record. |
Record Type Id |
For an alternative payment method, this value is a reference to the record type record. { "DeveloperName" : "BankTransfer" "MasterLabel" : "Bank Transfer", "GtwyProviderPaymentMethodType" : "directBanking", "PaymentGatewayProviderId" : "0cJaa0000000001E67", "PaymentMethodType" : "AlternativePaymentMethod", “RecordTypeId” : "012aa000000008A34F" } |
Let’s Wrap It Up
In this unit, you learned how to configure payment processing. You also explored adding new payment methods. Now you can take the final quiz and earn an awesome badge.
Resources
- Salesforce Developers: Use Cases for the CommercePayments Namespace
- Salesforce Developers: Commerce Payments Resources
- Salesforce Developers: CommercePayments Namespace
- Salesforce AppExchange: Salesforce Payments for Order Management