Using the Update Subscription request, you can update any of the following settings for an existing subscription:
- Plan associated to the subscription
- Payment source
- Override value for the recurring charge amount
- Auto-renew setting (if you set it to false, the subscription expires at the end of the current period)
- Next charge date
- Quantity
- Subscription status (ACTIVE/CANCELED)
Note: If you are using BlueSnap's tax feature, make sure to update the recurringTaxReference
parameter if you update the subscriptions' plan or recurringChargeAmount
.
For more information about working with subscriptions, see the Subscriptions tutorial.
Updating Payment Source
Supported Use Cases
You can only change the payment source if you are updating:
- to a credit card
- to a new payment source within the same Apple Pay or Google Pay payment method
Unsupported Use Cases
- Any update to a new ACH account is not supported
How to Update Payment Source
To change the payment source associated with a subscription:
- Make sure the payment details are saved to the shopper. If not, update the vaulted shopper with the details.
- Update the subscription to specify the new payment source.
Switch contract separately from other changes
If you are switching the contract associated with the subscription, we recommend you do this in a separate API call from other changes, such as updating the payment source or overriding the recurring charge amount.
For example if you want to switch a subscription from plan 1 to plan 2 and also override the recurring charge amount for plan 2, we recommend that you first make an Update Subscription call to change the plan. Then make a separate call to override the recurring charge amount.
Send a test request
Go to API Explorer to send a test request to our sandbox environment and receive a response in real time.
Request Content
Send a subscription object, with the following:
Property | Type | Required |
---|---|---|
autoRenew | boolean | optional |
nextChargeDate | string | optional |
overrideRecurringChargeAmount | decimal | optional |
paymentSource | object | optional (see paymentSource) |
planId | integer | optional (required with quantity ) |
quantity | integer | optional |
Notes
- If you use the
quantity
parameter, you must includeplanid
as well. If you want to change the quantity on the current plan, enter the currentplanId
. If you want to change the plan and the quantity, enter the new values for both.- Non-reusable cards, like gift cards, cannot be used as a new
paymentSource
.
Response Details
If successful, the response HTTP status code is 200 OK.
The response contains the subscription object.
Examples
Request Examples
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{"planId": 2283849}'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{"status": "CANCELED"}'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{"nextChargeDate": "2017-10-01"}'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
"paymentSource":{
"creditCardInfo":{
"creditCard":{
"cardLastFourDigits":"9299",
"cardType":"VISA"
}
}
}
}'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
"paymentSource":{
"creditCardInfo":{
"pfToken":"3f62200b744f70a07db549a8c9df11647f4c2442df9cb71a75026d0784fe1668_"
}
}
}
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
"planId": 2283849,
"quantity": 2
}'
Response Example
{
"nextChargeDate": "2016-08-16",
"quantity": 1,
"charge": {
"amount": 100,
"vaultedShopperId": 21188909,
"chargeInfo": {
"fromDate": "2016-08-02",
"toDate": "2016-08-16",
"chargeType": "INITIAL"
},
"chargeId": 12117877,
"paymentSource": {"creditCardInfo": {"creditCard": {
"expirationYear": 2023,
"cardLastFourDigits": 1111,
"cardSubType": "CREDIT",
"cardType": "VISA",
"expirationMonth": "07"
}}},
"softDescriptor": "BLS*default_descriptor",
"planId": 2283845,
"currency": "USD",
"transactionDate": "2016-08-02",
"subscriptionId": 8492717,
"transactionId": 1012463333
},
"trialPeriodDays": 14,
"paymentSource": {"creditCardInfo": {
"billingContactInfo": {
"firstName": "John",
"lastName": "Doe"
},
"creditCard": {
"expirationYear": 2019,
"cardLastFourDigits": 1111,
"cardSubType": "CREDIT",
"cardCategory": "CLASSIC",
"cardType": "VISA",
"expirationMonth": "07"
}
}},
"softDescriptor": "BLS*default_descriptor",
"recurringChargeAmount": 29.99,
"chargeFrequency": "MONTHLY",
"vaultedShopperId": 21188909,
"payerInfo": {
"firstName": "John",
"lastName": "Doe"
},
"initialChargeAmount": 100,
"autoRenew": true,
"planId": 2283849,
"currency": "USD",
"subscriptionId": 8492717,
"fraudResultInfo": {"deviceDataCollector": "N"},
"status": "ACTIVE"
}
{
"subscriptionId":39598852,
"planId":2205010,
"vaultedShopperId":19641860,
"status":"ACTIVE",
"quantity":1,
"softDescriptor":"BLS*try",
"chargeFrequency":"MONTHLY",
"recurringChargeAmount":1.99,
"currency":"USD",
"autoRenew":true,
"nextChargeDate":"2019-02-28",
"payerInfo":{
"firstName":"PIFirstName",
"lastName":"PILastName",
"email":"[email protected]",
"country":"il",
"address":"PIaddress1",
"address2":"PIaddress2",
"city":"PICity",
"zip":"PIZip"
},
"paymentSource":{
"creditCardInfo":{
"billingContactInfo":{
"firstName":"HpfBiFirstName",
"lastName":"HpfBiLastName",
"address1":"HpfBiAddress1",
"city":"HpfBiCity",
"state":"MA",
"zip":"HpfBiZip",
"country":"us"
},
"creditCard":{
"cardLastFourDigits":"0005",
"cardType":"AMEX",
"cardCategory":"CORPORATE",
"binCategory":"COMMERCIAL",
"cardRegulated":"Y",
"issuingBank":"AMERICAN EXPRESS US (CARS)",
"expirationMonth":"11",
"expirationYear":"2024",
"issuingCountryCode":"US"
}
}
}
}
{
"nextChargeDate": "2016-08-16",
"quantity": 2,
"charge": {
"amount": 100,
"vaultedShopperId": 21188909,
"chargeInfo": {
"fromDate": "2016-08-02",
"toDate": "2016-08-16",
"chargeType": "INITIAL"
},
"chargeId": 12117877,
"paymentSource": {"creditCardInfo": {"creditCard": {
"expirationYear": 2019,
"cardLastFourDigits": 1111,
"cardSubType": "CREDIT",
"cardType": "VISA",
"expirationMonth": "07"
}}},
"softDescriptor": "BLS*default_descriptor",
"planId": 2283845,
"currency": "USD",
"transactionDate": "2016-08-02",
"subscriptionId": 8492717,
"transactionId": 1012463333
},
"trialPeriodDays": 14,
"paymentSource": {"creditCardInfo": {
"billingContactInfo": {
"firstName": "John",
"lastName": "Doe"
},
"creditCard": {
"expirationYear": 2023,
"cardLastFourDigits": 1111,
"cardSubType": "CREDIT",
"cardCategory": "CLASSIC",
"cardType": "VISA",
"expirationMonth": "07"
}
}},
"softDescriptor": "BLS*default_descriptor",
"recurringChargeAmount": 59.98,
"chargeFrequency": "MONTHLY",
"vaultedShopperId": 21188909,
"payerInfo": {
"firstName": "John",
"lastName": "Doe"
},
"initialChargeAmount": 100,
"autoRenew": true,
"planId": 2283849,
"currency": "USD",
"subscriptionId": 8492717,
"fraudResultInfo": {"deviceDataCollector": "N"},
"status": "ACTIVE"
}
API Explorer
To test out a call, in the subscriptionId
field, enter the ID of an existing subscription (e.g. 8491543). Click the "Try It!" button in the right-hand column to test using the default, pre-populated sample values. To test with your own values, edit the parameter fields below. You'll see them populate in the right-hand column and you can click the "Try It!" button to submit your test request and see a response.