# Changing the subscription's payment option

Managing a subscription's payment method is critical to maintaining uninterrupted service. Digital River's Commerce API provides a straightforward way to update the payment option for a customer's subscription. Whether they are switching to a new credit card, updating an expired card, or simply changing their billing preferences, our guide will walk you through the steps to modify the subscription's payment method. This ensures the customer's account stays in good standing and your services continue without disruption.

To change the subscription's payment option, use the [`POST /v1/subscriptions/{subscriptionId}/payment-option`](https://app.gitbook.com/s/drE2RCYBuoRpd2TC2sx2/subscription-mangement/manage-subscription-payments#v1-subscriptions-subid-payment-option) request. This requires specifying the `subscriptionId` and the new `paymentOptionId` in the request body. Optionally, you can indicate whether the shipping address is the same as the billing address by setting `isShippingSameAsBilling` to `true` or `false`.

Here is an example request using cURL:

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```javascript
curl --location --request POST 'https://<<host>>/v1/subscriptions/{subscriptionId}/payment-option' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer ***' \
--data-raw '{
 "paymentOptionId": "23443434343434",
 "isShippingSameAsBilling": true
}'
```

{% endcode %}
{% endtab %}
{% endtabs %}

Upon successfully associating a new billing option to the subscription, you will receive a `202 Accepted` response.

When associating a new payment option with an existing subscription by payment source, note the following:

* If the system finds a valid payment option by the given `sourceId`, it associates that `sourceId` to the subscription. It does not update any other data for that billing option.
* If it is a valid source and no existing billing option is associated with it in Global Commerce, the system creates a new billing option for this given source. Here are the rules for creating a billing option:
  * The system generates a unique nickname for this billing option.
  * If this shopper doesn’t have an existing default billing option, the system sets the default flag to `true` on this new billing option.
  * If this shopper has an existing default billing option, the system sets the default flag to `false` on this new billing option.|


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/admin-apis/subscription-management/update-the-subscription-at-the-next-renewal/changing-the-subscriptions-payment-option.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
