{"_id":"59a45d447ee621000fc9d3ce","category":{"_id":"59a45d447ee621000fc9d3c0","version":"59a45d437ee621000fc9d3b7","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-27T10:22:06.636Z","from_sync":false,"order":8,"slug":"subscriptions","title":"Subscriptions"},"project":"57336fd5a6a9c40e00e13a0b","parentDoc":null,"user":"560d5913af97231900938124","version":{"_id":"59a45d437ee621000fc9d3b7","project":"57336fd5a6a9c40e00e13a0b","__v":1,"createdAt":"2017-08-28T18:13:23.840Z","releaseDate":"2017-08-28T18:13:23.840Z","categories":["59a45d447ee621000fc9d3b8","59a45d447ee621000fc9d3b9","59a45d447ee621000fc9d3ba","59a45d447ee621000fc9d3bb","59a45d447ee621000fc9d3bc","59a45d447ee621000fc9d3bd","59a45d447ee621000fc9d3be","59a45d447ee621000fc9d3bf","59a45d447ee621000fc9d3c0","59a45d447ee621000fc9d3c1","59a45d447ee621000fc9d3c2","59a45d447ee621000fc9d3c3","59a45d447ee621000fc9d3c4","59a45d447ee621000fc9d3c5","59a45d447ee621000fc9d3c6","59a45d447ee621000fc9d3c7"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"3.22.1","version_clean":"8976.0.0-XML","version":"8976-XML"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-29T17:16:53.270Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"put","results":{"codes":[{"language":"text","code":""}]},"settings":"","auth":"optional","params":[{"_id":"579b92475623be2200832642","ref":"","in":"path","required":true,"desc":"BlueSnap identifier for the subscription.","default":"","type":"int","name":"subscription-id"}],"url":"/recurring/subscriptions/:subscription-id"},"isReference":false,"order":24,"body":"The Update Subscription request enables you to change any of the following settings for an existing subscription:\n  * Plan associated to the subscription\n  * Payment source\n  * Override value for the recurring charge amount\n  * Auto-renew setting (if you set it to false, the subscription will expire at the end of the current period)\n  * Next charge date\n  * Subscription status (ACTIVE/CANCELED)\n\nFor more information about working with subscriptions, see the [Subscriptions tutorial](doc:subscription-management#section-tutorial-subscriptions).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Changing payment source\",\n  \"body\": \"If you wish to change the credit card associated with the subscription: \\n\\n1. Make sure the card details are saved to the vaulted shopper (If not, [update the vaulted shopper](/docs/update-vaulted-shopper) with the new card details).\\n2.  Update the subscription to specify the new payment source.\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Switch contract separately from other changes\",\n  \"body\": \"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.\"\n}\n[/block]\n<a class=\"btn btn-success\" href=\"#section-api-explorer\" role=\"button\">Try it in the API Explorer</a>\n\n###Request Content\n`recurring-subscription` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>, contains the following properties (see [recurring-subscription](doc:recurring-subscription)):\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`plan-id` *integer* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`payment-source` *container* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`override-recurring-charge-amount` *decimal* &nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`auto-renew` *boolean* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`next-charge-date` *string* &nbsp;&nbsp;&nbsp;optional\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`status` *string* &nbsp;&nbsp;&nbsp;optional\n\n###Response Details\nIf successful, the response HTTP status code is 200 OK.\nThe response body contains the [recurring-subscription](doc:recurring-subscription) resource.\n\n<hr>\n\n##Examples\n\n###Request Examples\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<recurring-subscription xmlns=\\\"http://ws.plimus.com\\\">\\n  <plan-id>2283849</plan-id>\\n</recurring-subscription>'\",\n      \"language\": \"curl\",\n      \"name\": \"Update Subscription Request: change plan\"\n    },\n    {\n      \"code\": \"curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<recurring-subscription xmlns=\\\"http://ws.plimus.com\\\">\\n  <status>CANCELED</status>\\n</recurring-subscription>'\",\n      \"language\": \"curl\",\n      \"name\": \"cancel subscription\"\n    },\n    {\n      \"code\": \"curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<recurring-subscription xmlns=\\\"http://ws.plimus.com\\\">\\n  <next-charge-date>2017-10-01</next-charge-date>\\n</recurring-subscription>'\",\n      \"language\": \"curl\",\n      \"name\": \"change next charge date\"\n    },\n    {\n      \"code\": \"curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \\\\\\n-H 'Content-Type: application/xml' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n<recurring-subscription xmlns=\\\"http://ws.plimus.com\\\">\\n  <payment-source>\\n    <credit-card-info>\\n      <credit-card>\\n        <card-last-four-digits>1111</card-last-four-digits>\\n        <card-type>VISA</card-type>\\n      </credit-card>\\n    </credit-card-info>\\n  </payment-source>\\n</recurring-subscription>\",\n      \"language\": \"xml\",\n      \"name\": \"change payment source\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n###Response Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/ 1.1 200 OK\\n\\n<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\\n<recurring-subscription xmlns=\\\"http://ws.plimus.com\\\">\\n  <subscription-id>8492717</subscription-id>\\n  <plan-id>2283849</plan-id>\\n  <vaulted-shopper-id>21188909</vaulted-shopper-id>\\n  <status>ACTIVE</status>\\n  <quantity>1</quantity>\\n  <soft-descriptor>BLS&#x2a;default_descriptor</soft-descriptor>\\n  <charge-frequency>MONTHLY</charge-frequency>\\n  <trial-period-days>14</trial-period-days>\\n  <recurring-charge-amount>29.99</recurring-charge-amount>\\n  <currency>USD</currency>\\n  <initial-charge-amount>100.00</initial-charge-amount>\\n  <auto-renew>true</auto-renew>\\n  <next-charge-date>2016-08-16</next-charge-date>\\n  <payer-info>\\n    <first-name>John</first-name>\\n    <last-name>Doe</last-name>\\n  </payer-info>\\n  <payment-source>\\n    <credit-card-info>\\n      <billing-contact-info>\\n        <first-name>John</first-name>\\n        <last-name>Doe</last-name>\\n      </billing-contact-info>\\n      <credit-card>\\n        <card-last-four-digits>1111</card-last-four-digits>\\n        <card-type>VISA</card-type>\\n        <card-sub-type>CREDIT</card-sub-type>\\n        <card-category>CLASSIC</card-category>\\n        <expiration-month>07</expiration-month>\\n        <expiration-year>2019</expiration-year>\\n      </credit-card>\\n    </credit-card-info>\\n  </payment-source>\\n  <charge>\\n    <charge-id>12117877</charge-id>\\n    <subscription-id>8492717</subscription-id>\\n    <plan-id>2283845</plan-id>\\n    <vaulted-shopper-id>21188909</vaulted-shopper-id>\\n    <transaction-id>1012463333</transaction-id>\\n    <transaction-date>2016-08-02</transaction-date>\\n    <amount>100.00</amount>\\n    <currency>USD</currency>\\n    <soft-descriptor>BLS&#x2a;default_descriptor</soft-descriptor>\\n    <payment-source>\\n      <credit-card-info>\\n        <credit-card>\\n          <card-last-four-digits>1111</card-last-four-digits>\\n          <card-type>VISA</card-type>\\n          <card-sub-type>CREDIT</card-sub-type>\\n          <expiration-month>07</expiration-month>\\n          <expiration-year>2019</expiration-year>\\n        </credit-card>\\n      </credit-card-info>\\n    </payment-source>\\n    <charge-info>\\n      <from-date>2016-08-02</from-date>\\n      <to-date>2016-08-16</to-date>\\n      <charge-type>INITIAL</charge-type>\\n    </charge-info>\\n  </charge>\\n  <fraud-result-info>\\n    <device-data-collector>N</device-data-collector>\\n  </fraud-result-info>\\n</recurring-subscription>\",\n      \"language\": \"xml\",\n      \"name\": \"Update Subscription Response: 200 OK\"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n\n<hr>\n\n##Example Descriptions\nTo update any subscription setting, simply send the relevant field within the request. No other fields are required.\n\n<br>\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n\n<hr>\n\n##API Explorer\nTo test out a call, in the `subscription-id` field, enter the ID of an existing subscription (e.g. 8491543). In the Body Content field, paste in the XML portion of the request and then click **Try it!**\n\n**Tip**: Copy the XML portion from one of the example requests above, or use the XML code below as a starting point. You can enter different parameter values to see how your test scenario would work. *The request headers, including authorization, are already built in for you in this test area, so you should not include them here.*\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<recurring-subscription xmlns=\\\"http://ws.plimus.com\\\">\\n  <next-charge-date>2017-07-01</next-charge-date>\\n</recurring-subscription>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"update-subscription","type":"put","title":"Update Subscription"}

putUpdate Subscription


Definition

{{ api_url }}{{ page_api_url }}

Parameters

Path Params

subscription-id:
required
integer
BlueSnap identifier for the subscription.

Documentation

The Update Subscription request enables you to change 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 will expire at the end of the current period)
  • Next charge date
  • Subscription status (ACTIVE/CANCELED)

For more information about working with subscriptions, see the Subscriptions tutorial.

Changing payment source

If you wish to change the credit card associated with the subscription:

  1. Make sure the card details are saved to the vaulted shopper (If not, update the vaulted shopper with the new card details).
  2. 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.

Try it in the API Explorer

Request Content

recurring-subscription container    required, contains the following properties (see recurring-subscription):
      plan-id integer    optional
      payment-source container    optional
      override-recurring-charge-amount decimal   optional
      auto-renew boolean    optional
      next-charge-date string    optional
      status string    optional

Response Details

If successful, the response HTTP status code is 200 OK.
The response body contains the recurring-subscription resource.


Examples

Request Examples

curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<recurring-subscription xmlns="http://ws.plimus.com">
  <plan-id>2283849</plan-id>
</recurring-subscription>'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<recurring-subscription xmlns="http://ws.plimus.com">
  <status>CANCELED</status>
</recurring-subscription>'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<recurring-subscription xmlns="http://ws.plimus.com">
  <next-charge-date>2017-10-01</next-charge-date>
</recurring-subscription>'
curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions/8491543 \
-H 'Content-Type: application/xml' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
<recurring-subscription xmlns="http://ws.plimus.com">
  <payment-source>
    <credit-card-info>
      <credit-card>
        <card-last-four-digits>1111</card-last-four-digits>
        <card-type>VISA</card-type>
      </credit-card>
    </credit-card-info>
  </payment-source>
</recurring-subscription>

Response Example

HTTP/ 1.1 200 OK

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recurring-subscription xmlns="http://ws.plimus.com">
  <subscription-id>8492717</subscription-id>
  <plan-id>2283849</plan-id>
  <vaulted-shopper-id>21188909</vaulted-shopper-id>
  <status>ACTIVE</status>
  <quantity>1</quantity>
  <soft-descriptor>BLS&#x2a;default_descriptor</soft-descriptor>
  <charge-frequency>MONTHLY</charge-frequency>
  <trial-period-days>14</trial-period-days>
  <recurring-charge-amount>29.99</recurring-charge-amount>
  <currency>USD</currency>
  <initial-charge-amount>100.00</initial-charge-amount>
  <auto-renew>true</auto-renew>
  <next-charge-date>2016-08-16</next-charge-date>
  <payer-info>
    <first-name>John</first-name>
    <last-name>Doe</last-name>
  </payer-info>
  <payment-source>
    <credit-card-info>
      <billing-contact-info>
        <first-name>John</first-name>
        <last-name>Doe</last-name>
      </billing-contact-info>
      <credit-card>
        <card-last-four-digits>1111</card-last-four-digits>
        <card-type>VISA</card-type>
        <card-sub-type>CREDIT</card-sub-type>
        <card-category>CLASSIC</card-category>
        <expiration-month>07</expiration-month>
        <expiration-year>2019</expiration-year>
      </credit-card>
    </credit-card-info>
  </payment-source>
  <charge>
    <charge-id>12117877</charge-id>
    <subscription-id>8492717</subscription-id>
    <plan-id>2283845</plan-id>
    <vaulted-shopper-id>21188909</vaulted-shopper-id>
    <transaction-id>1012463333</transaction-id>
    <transaction-date>2016-08-02</transaction-date>
    <amount>100.00</amount>
    <currency>USD</currency>
    <soft-descriptor>BLS&#x2a;default_descriptor</soft-descriptor>
    <payment-source>
      <credit-card-info>
        <credit-card>
          <card-last-four-digits>1111</card-last-four-digits>
          <card-type>VISA</card-type>
          <card-sub-type>CREDIT</card-sub-type>
          <expiration-month>07</expiration-month>
          <expiration-year>2019</expiration-year>
        </credit-card>
      </credit-card-info>
    </payment-source>
    <charge-info>
      <from-date>2016-08-02</from-date>
      <to-date>2016-08-16</to-date>
      <charge-type>INITIAL</charge-type>
    </charge-info>
  </charge>
  <fraud-result-info>
    <device-data-collector>N</device-data-collector>
  </fraud-result-info>
</recurring-subscription>

Back to Top


Example Descriptions

To update any subscription setting, simply send the relevant field within the request. No other fields are required.



Back to Top


API Explorer

To test out a call, in the subscription-id field, enter the ID of an existing subscription (e.g. 8491543). In the Body Content field, paste in the XML portion of the request and then click Try it!

Tip: Copy the XML portion from one of the example requests above, or use the XML code below as a starting point. You can enter different parameter values to see how your test scenario would work. The request headers, including authorization, are already built in for you in this test area, so you should not include them here.

<recurring-subscription xmlns="http://ws.plimus.com">
  <next-charge-date>2017-07-01</next-charge-date>
</recurring-subscription>

User Information

Try It Out


put
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}