Newer Version Available

This content describes an older version of this product. View Latest

Commerce Subscriptions, Saved Payment Method

Update the saved payment method associated with a specific Commerce subscription. This API is available only to registered buyers.

In the out-of-the-box Commerce solution, this API is implemented on the My Subscriptions page, enabling buyers to update saved payment methods for their subscriptions through My Subscription experience.

To access this API, users must have the following licenses and permissions:

  • B2B Commerce, or D2C Commerce
  • Revenue Lifecycle Management
Resource
1/commerce/webstores/webstoreId/subscriptions/subscriptionId/saved-payment-methods
Resource examples
1https://yourInstance.salesforce.com/services/data/66.0/commerce/webstores​/0ZExx00000003NhGAI/subscriptions/02ixx0000004HJKAA2/saved-payment-methods
Available version
63.0
HTTP methods
PATCH
Request parameters for PATCH
Parameter Name Type Description Required or Optional Available Version
effectiveAccountId String ID of the account for which the request is made. If unspecified, defaults to the account ID for the context user. Optional

For the account switcher, if the user provides a valid effectiveAccountId, the API updates the saved payment method associated with a Commerce subscription for that account ID. The account switcher feature is only applicable to B2B Commerce.

63.0
Request body for PATCH
Root XML tag
commerceSubscriptionSavedPaymentMethodInput
JSON example
1{
2  "merchantAccountId": "8zbxx00000000ODAAY",
3  "savedPaymentMethodId": "12qxx000002pmjEAAQ"
4}
Properties
Name Type Description Required or Optional Available Version
merchant​AccountId String Salesforce Payments merchant account ID associated with the saved payment method. Required 63.0
savedPayment​MethodId String ID of the saved payment method record associated with the Commerce subscription. Required 63.0
Response body for PATCH
Here’s a sample response for the Commerce Subscription Detail in the Saved Payment Method PATCH request:

The PATCH API populates only the billing, endDate, id, and startDate field values in the response. Other fields are ignored by the PATCH API.

Note

1{
2  "billing": {
3    "billingMethod": "OrderAmount",
4    "billingPeriodAmount": null,
5    "billingTerm": 1,
6    "billingTermUnit": "Month",
7    "billingType": "Arrears",
8    "cancellationDate": null,
9    "currencyIsoCode": "USD",
10    "nextBillingDate": "2024-10-10",
11    "savedPaymentMethod": {
12      "gatewayResponse": {},
13      "id": "12qxx000002pmmSAAQ",
14      "merchantAccountId": "8zbxx00000000ODAAY",
15      "name": "Ra*****"
16    }
17  },
18  "cancelStatus": null,
19  "endDate": "2025-09-10T23:59:59.000Z",
20  "id": "02ixx0000004HJKAA2",
21  "product": null,
22  "quantity": null,
23  "sellingModel": null,
24  "startDate": "2024-09-10T00:00:00.000Z",
25  "subscriptionTerm": null
26}
Commerce Subscription Detail