Back to insights
Salesforce Commerce CloudStripeCommerce Cloud

Configuring Stripe Payment Gateway Integration in Salesforce Commerce Cloud

Integrate Stripe payment gateway into Salesforce Commerce Cloud for secure online payment processing.

Samimoonnisha AbdulJabar12 min read

Salesforce Commerce Cloud Developer

Configuring Stripe Payment Gateway Integration in Salesforce Commerce Cloud cover infographic

Abstract

Modern e-commerce applications require secure and reliable online payment processing. This document explains how to configure a mock Stripe Payment Gateway integration in Salesforce Commerce Cloud using Apex classes, Named Credentials, Payment Gateway Providers, and storefront payment mapping. The solution uses custom Apex adapters to simulate Stripe API transactions and provides a reusable framework for testing payment integrations in sandbox or development environments.

Introduction

Salesforce Commerce Cloud provides flexible payment integration capabilities that allow organizations to connect third-party payment providers such as Stripe, PayPal, and Authorize.Net.

This implementation demonstrates a basic mock setup of Stripe payment integration using:

  • Custom Apex adapter classes
  • Named Credentials
  • Payment Gateway Provider configuration
  • Commerce Storefront payment mapping

The configuration simulates how Salesforce Commerce communicates with Stripe payment services during checkout operations.

Solution Architecture

Process Flow

Customer Checkout
        ↓
Salesforce Commerce Storefront
        ↓
Stripe Payment Adapter (Apex)
        ↓
Named Credential Authentication
        ↓
   Stripe REST API
        ↓
Payment Authorization Response
        ↓
   Order Confirmation

Prerequisites

Before implementation, ensure the following prerequisites are completed:

  • Salesforce Commerce Cloud environment access
  • System Administrator permissions
  • Workbench access
  • Access to Apex Classes
  • GitHub repository access
  • Internet connectivity

Required Repository: https://github.com/tzarrsf/b2b-commerce-gtk-admin

Step-by-Step Implementation

Step 1 — Create Apex Classes

Navigate to: Setup → Apex Classes

Create the following Apex classes from the repository:

  • StripeValidationException
  • QueryUtils
  • StripeAdapter

GitHub Reference: https://github.com/tzarrsf/b2b-commerce-gtk-admin/blob/main/codev2/StripeAdapter.cls

Steps:

  1. Open Setup
  2. Search for Apex Classes
  3. Click New
  4. Copy class contents from repository
  5. Save the class
Important: Create the classes in the following order: StripeValidationException, QueryUtils, StripeAdapter.
Reason: The StripeAdapter class depends on the utility and exception classes.

Step 2 — Create Named Credential

Named Credentials provide secure authentication management for external API integrations.

Navigation: Setup → Security → Named Credentials

Click: New → New Legacy

Configuration:

FieldValue
LabelStripeAdapter_NC
NameStripeAdapter_NC
URLhttps://api.stripe.com
Identity TypeNamed Principal
Authentication ProtocolPassword Authentication
UsernameStripe Secret Key
Passwordtest1234
Generate Authorization HeaderChecked
Allow Merge Fields in HTTP HeaderChecked

Purpose: The Named Credential securely stores Stripe authentication details and eliminates the need to hardcode credentials in Apex classes.

Step 3 — Query Apex Class Using Workbench

Navigate to Workbench: Queries → SOQL Query

Object: ApexClass

SOQL Query:

SELECT Id, Name
FROM ApexClass
WHERE Name LIKE 'StripeAdapt%'

Purpose: This query retrieves the StripeAdapter Apex Class ID required during Payment Gateway Provider creation.

Make note of the returned Apex Class ID.

Step 4 — Create Payment Gateway Provider

Navigate in Workbench: Data → Insert

Select Object: PaymentGatewayProvider

Configuration:

FieldValue
ApexAdapterIdStripeAdapter Apex Class ID
DeveloperNameStripe_Adapter
IdempotencySupportedYes
MasterLabelStripe Adapter

Click: Confirm Insert

Purpose: The Payment Gateway Provider connects the Commerce payment framework with the custom Apex adapter.

Step 5 — Create Payment Gateway

Navigation: App Launcher → Payment Gateways

Click: New

Configuration:

FieldValue
Payment Gateway NameStripe
Payment Gateway ProviderStripe Adapter
Merchant CredentialStripeAdapter_NC
StatusActive

Click: Save

Expected Result: Payment Gateway "Stripe" was created successfully.

Step 6 — Map Payment Integration to Storefront

Navigation: Commerce App → Store → Administration → Payments

Steps:

  1. Click Select Provider
  2. Select Stripe Adapter
  3. Click Next
  4. Click Confirm

Expected Result: Card Payment Gateway mapping created; success toast notification displayed.

Apex Integration Overview

The StripeAdapter Apex class acts as the integration layer between Salesforce Commerce and Stripe APIs.

Responsibilities:

  • Payment authorization
  • Payment request handling
  • API callouts
  • Response processing
  • Error handling

Real-Time Business Use Cases

This integration architecture can be used in:

  • E-commerce checkout systems
  • Online payment processing
  • Subscription billing platforms
  • Order management systems
  • Commerce payment authorization
  • Enterprise payment integrations

Conclusion

The Stripe Payment Gateway mock setup demonstrates how Salesforce Commerce Cloud can integrate with external payment providers using Apex adapters, Named Credentials, and Commerce payment configurations.

This implementation provides a foundational understanding of:

  • Commerce payment architecture
  • External API integrations
  • Payment gateway configuration
  • Secure authentication handling

The solution can be extended further for enterprise-grade payment processing implementations and real-time e-commerce integrations.

Screenshots

Named Credentials

Configuring Stripe Payment Gateway Integration in Salesforce Commerce Cloud Step 1

Payment Gateway Provider

Configuring Stripe Payment Gateway Integration in Salesforce Commerce Cloud Step 2

Map Payment Integration to stripe

Configuring Stripe Payment Gateway Integration in Salesforce Commerce Cloud Step 3

References

GitHub Repository: https://github.com/tzarrsf/b2b-commerce-gtk-admin

Stripe API: https://api.stripe.com

Topics:StripeCommerce CloudPayment Gateway

Ready to accelerate your digital transformation?

Partner with Subsel to build modern CRM, AI-enabled automation, and enterprise systems that scale.