---
schema_version: "1"
id: b90d116b38c2a1e7e00e98b12c009d77c2a45adb4dc87fa2f1e93795ce79c9d9
title: Create a Saved Payment Method Record from a Client-Side Component
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/salesforce-commerce/guides/d2c-commerce/b2b-comm-spm-client-side-component.md
canonical_url: https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-comm-spm-client-side-component.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5cd4280a9a35967b7c6a0b4a8ea4c22b21a2c24834b8a5a00a4d9751765edbef
products:
  - B2B Commerce Developer Guide
  - Salesforce APIs
---
# Create a Saved Payment Method Record from a Client-Side Component

Buyers can save their payment details directly from a buyer-facing client-side component. The client-side component calls a third-party payment gateway to tokenize the buyer’s payment method. It then sends the token and related metadata to Salesforce by using the SavedPaymentMethod sObject API. Salesforce creates the Saved Payment Method (SPM) record.

This flow supports only third-party payment gateways and these payment methods categories:

- Alternative Payment Methods (APMs)
- Digital Wallets (such as Amazon Pay)
- Credit Cards

## Before You Begin

Before you begin, make sure your configuration meets these requirements.

- Payment gateway tokenization is configured. Your storefront or third-party gateway must tokenize the buyer’s payment details before sending any information to Salesforce.
- Buyer is authenticated and has access to the SavedPaymentMethod sObject API.
- Supported payment types—APMs, Digital Wallets, and Credit Cards—are configured in your Payments setup.
- Required fields such as paymentMethodType and payment token are available in your client-side component.
- HTTPS securely transmits all tokenized data.

## How It Works

1. Buyer enters their payment details in your storefront component.
2. Client-side component calls the third-party payment gateway to tokenize the payment method.
3. The gateway returns a payment token.
4. Client-side component sends the token and related payment metadata to the SavedPaymentMethod sObject API. Submit this information using one of the following ways:
   - [Synchronous saved payment method creation](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-comm-spm-client-side-create-sync.md)
   - [Asynchronous saved payment method creation](https://developer.salesforce.com/docs/commerce/salesforce-commerce/guide/b2b-comm-spm-client-side-create-async.md)
5. Salesforce validates the request and creates the SPM record, including data such as:
   - Last four digits, expiration date, and name on card
   - Gateway token
6. The SPM record becomes available for future use by the Billing Engine.

**See Also**

- [_Object Reference for the Salesforce Platform_: SavedPaymentMethod](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_savedpaymentmethod.htm)
