Associating a new billing option to an existing subscription
Learn how to associate a new billing option to an existing subscription.
The following
POST /v1/subscriptions/{subscriptionId}/payment-source
request associates a new billing option to an existing subscription by payment source. You need to provide the subscriptionId
, and the payment sourceId
. The isShippingSameAsBilling
attribute is optional. When set to true
, the shipping address is the same as the billing address.cURL
curl --location --request POST 'https://{host}/v1/subscriptions/{subscriptionId}/payment-source' \
--header 'Content-Type: application/json' \
--header 'authorization: bearer ***\
--data-raw '{
"sourceId": "6260e924-704f-42f2-8f36-b62101d9f904",
"isShippingSameAsBilling": true
}'
You will receive a
202 Accepted
response.When associating a new billing option with an existing subscription by payment source, note the following:
- If the system found a valid billing option by the given
sourceId
, it associates thatsourceId
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.|
The following
POST /v1/subscriptions/{subscriptionId}/payment-option
request associates a new billing option to an existing subscription by payment option. You need to provide the subscriptionId
, and the paymentOptionId
. The isShippingSameAsBilling
attribute is optional.cURL
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
}'
You will receive a
202 Accepted
response.