{"_id":"59a45d2bd12e81000f842ef6","category":{"_id":"59a45d2bd12e81000f842eea","version":"59a45d2bd12e81000f842ee2","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-07-27T10:22:06.636Z","from_sync":false,"order":7,"slug":"subscriptions","title":"Subscriptions"},"user":"560d5913af97231900938124","parentDoc":null,"project":"57336fd5a6a9c40e00e13a0b","version":{"_id":"59a45d2bd12e81000f842ee2","project":"57336fd5a6a9c40e00e13a0b","__v":1,"createdAt":"2017-08-28T18:12:59.168Z","releaseDate":"2017-08-28T18:12:59.168Z","categories":["59a45d2bd12e81000f842ee3","59a45d2bd12e81000f842ee4","59a45d2bd12e81000f842ee5","59a45d2bd12e81000f842ee6","59a45d2bd12e81000f842ee7","59a45d2bd12e81000f842ee8","59a45d2bd12e81000f842ee9","59a45d2bd12e81000f842eea","59a45d2bd12e81000f842eeb","59a45d2bd12e81000f842eec","59a45d2bd12e81000f842eed","59a45d2bd12e81000f842eee","59a45d2bd12e81000f842eef","59a45d2bd12e81000f842ef0","59a45d2bd12e81000f842ef1"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"3.22.1","version_clean":"8976.0.0-JSON","version":"8976-JSON"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-07-29T16:13:02.799Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[]},"method":"post","results":{"codes":[{"code":"","language":"text"}]},"settings":"57ee593a21ceb20e0061959e","auth":"optional","params":[],"url":"/recurring/subscriptions"},"isReference":false,"order":21,"body":"The Create Subscription request enables you to set up a subscription, which associates a shopper with a plan to bill on an ongoing basis.\n\nFor more information about working with subscriptions, see the [Subscriptions tutorial](doc:subscription-management#section-tutorial-subscriptions).\n[block:callout]\n{\n  \"type\": \"success\",\n  \"title\": \"Testing subscription charges in sandbox\",\n  \"body\": \"After creating the subscription, you can simulate a recurring charge event, and trigger associated IPN's, emails, and invoices, in sandbox. Visit the [Subscriptions Guide](/v2.1/docs/subscription-management#section-testing-your-subscriptions) to learn how\"\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\nSend a **[subscription](doc:recurring-subscription)** object, with the following:\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`payerInfo` &nbsp;&nbsp;&nbsp; *object* &nbsp;&nbsp;&nbsp;optional - do not include if sending `vaultedShopperId` (see [payerInfo](doc:payer-info))\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`vaultedShopperId` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;optional - do not include if sending `payerInfo`\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`vendorInfo` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span> if using marketplace vendors (see [vendorInfo](doc:vendorinfo-1))\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`paymentSource` &nbsp;&nbsp;&nbsp; *object* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required** for `payerInfo`</span>; optional for `vaultedShopperId` (see [paymentSource](doc:payment-source))\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`authorizedByShopper` &nbsp;&nbsp;&nbsp; *boolean* &nbsp;&nbsp;<span style=\"color:#F37500\">**required** for SEPA Direct Debit</span>&nbsp;&nbsp; value must be **true**\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`overrideInitialChargeAmount` &nbsp;&nbsp;&nbsp; *decimal* &nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`overrideRecurringChargeAmount` &nbsp;&nbsp;&nbsp; *decimal* &nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`quantity` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`overrideTrialPeriodDays` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`softDescriptor` &nbsp;&nbsp;&nbsp; *string* &nbsp;&nbsp;&nbsp;optional\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`planId` &nbsp;&nbsp;&nbsp; *integer* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;`transactionFraudInfo` &nbsp;&nbsp;&nbsp; *object* &nbsp;&nbsp;&nbsp;optional (see [transactionFraudInfo](doc:transaction-fraud-info))\n\n###Response Details\nIf successful, the response HTTP status code is 200 OK.\nThe response contains the **[subscription](doc:recurring-subscription)** object.\nThe `subscriptionId` appears in the response body and the location header (unless payment source was SEPA DD).\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 \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"payerInfo\\\": {\\n        \\\"zip\\\": 12345,\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"phone\\\": 1234567890\\n    },\\n    \\\"paymentSource\\\": {\\\"creditCardInfo\\\": {\\\"creditCard\\\": {\\n        \\\"expirationYear\\\": 2019,\\n        \\\"securityCode\\\": 111,\\n        \\\"expirationMonth\\\": \\\"07\\\",\\n        \\\"cardNumber\\\": 4111111111111111\\n    }}},\\n    \\\"planId\\\": 2283845,\\n    \\\"transactionFraudInfo\\\": {\\\"fraudSessionId\\\": 1234}\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"Create Subscription Request: with new shopper\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"vaultedShopperId\\\": 20769005,\\n    \\\"overrideInitialChargeAmount\\\": 10.5,\\n    \\\"overrideRecurringChargeAmount\\\": 29.99,\\n    \\\"quantity\\\": 2,\\n    \\\"overrideTrialPeriodDays\\\": 10,\\n    \\\"softDescriptor\\\": \\\"Merchant name\\\",\\n    \\\"planId\\\": 2283845,\\n    \\\"transactionFraudInfo\\\": {\\n        \\\"shopperIpAddress\\\": \\\"123.12.134.1\\\",\\n        \\\"fraudSessionId\\\": 1234,\\n        \\\"company\\\": \\\"Company Name\\\",\\n        \\\"shippingContactInfo\\\": {\\n            \\\"zip\\\": 12345,\\n            \\\"country\\\": \\\"US\\\",\\n            \\\"firstName\\\": \\\"Doe\\\",\\n            \\\"lastName\\\": \\\"John\\\",\\n            \\\"city\\\": \\\"Juneau\\\",\\n            \\\"address2\\\": \\\"Apt 2\\\",\\n            \\\"address1\\\": \\\"1 Main St\\\",\\n            \\\"state\\\": \\\"AK\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"curl\",\n      \"name\": \"with vaulted shopper and optional fields\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"vaultedShopperId\\\": 20769005,\\n    \\\"paymentSource\\\": {\\\"creditCardInfo\\\": {\\\"creditCard\\\": {\\n        \\\"cardLastFourDigits\\\": 9299,\\n        \\\"cardType\\\": \\\"VISA\\\"\\n    }}},\\n    \\\"planId\\\": 2283845\\n}\",\n      \"language\": \"curl\",\n      \"name\": \"with vaulted shopper and specific payment method\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{  \\n   \\\"payerInfo\\\":{  \\n      \\\"zip\\\":12345,\\n      \\\"firstName\\\":\\\"John\\\",\\n      \\\"lastName\\\":\\\"Doe\\\",\\n      \\\"phone\\\":1234567890\\n   },\\n   \\\"paymentSource\\\":{  \\n      \\\"creditCardInfo\\\":{  \\n         \\\"pfToken\\\":\\\"339110a75e2cdbb5f5f2cea8d7cd8af261ad7c89fb0ce1aae_\\\"\\n      }\\n   },\\n   \\\"planId\\\":2186278\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with new shopper and hosted pay fields\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"payerInfo\\\": {\\n        \\\"zip\\\": 12345,\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"phone\\\": 1234567890\\n    },\\n    \\\"paymentSource\\\": {\\\"creditCardInfo\\\": {\\\"creditCard\\\": {\\n        \\\"expirationYear\\\": 2019,\\n        \\\"securityCode\\\": 111,\\n        \\\"expirationMonth\\\": 07,\\n        \\\"cardNumber\\\": 4111111111111111\\n    }}},\\n    \\\"planId\\\": 2283845,\\n    \\\"transactionFraudInfo\\\": {\\\"fraudSessionId\\\": 1234}\\n    \\\"vendorInfo\\\": {\\\"vendorId\\\": 402090}\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with new shopper and vendor info\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"planId\\\": 2283845,\\n    \\\"paymentSource\\\": {\\n      \\\"wallet\\\": {\\n        \\\"applePay\\\": { \\n          \\\"encodedPaymentToken\\\": \\\"ImRhdGEiO1AvRitIUy85Im9RbXhCMFd\\\" \\n        }\\n      }\\n    }\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with Apple Pay\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Accept: application/json' \\\\ \\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"planId\\\": 2436197,\\n    \\\"authorizedByShopper\\\": true,\\n    \\\"payerInfo\\\": {\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"country\\\": \\\"fr\\\",\\n        \\\"zip\\\": \\\"12345\\\",\\n        \\\"phone\\\": \\\"1234567890\\\"\\n    },\\n    \\\"paymentSource\\\": {\\n        \\\"sepaDirectDebitInfo\\\": {\\n            \\\"sepaDirectDebit\\\": {\\n                \\\"iban\\\": \\\"DE09100100101234567893\\\"\\n            }\\n        }\\n    }\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with SEPA Direct Debit \"\n    }\n  ],\n  \"sidebar\": true\n}\n[/block]\n###Response Examples\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n    \\\"nextChargeDate\\\": \\\"2016-08-16\\\",\\n    \\\"quantity\\\": 1,\\n    \\\"charge\\\": {\\n        \\\"amount\\\": 100,\\n        \\\"vaultedShopperId\\\": 21188909,\\n        \\\"chargeInfo\\\": {\\n            \\\"fromDate\\\": \\\"2016-08-02\\\",\\n            \\\"toDate\\\": \\\"2016-08-16\\\",\\n            \\\"chargeType\\\": \\\"INITIAL\\\"\\n        },\\n        \\\"chargeId\\\": 12117877,\\n        \\\"paymentSource\\\": {\\\"creditCardInfo\\\": {\\\"creditCard\\\": {\\n            \\\"expirationYear\\\": 2019,\\n            \\\"cardLastFourDigits\\\": 1111,\\n            \\\"cardSubType\\\": \\\"CREDIT\\\",\\n            \\\"cardType\\\": \\\"VISA\\\",\\n            \\\"expirationMonth\\\": \\\"07\\\"\\n        }}},\\n        \\\"softDescriptor\\\": \\\"BLS&#x2a;default_descriptor\\\",\\n        \\\"planId\\\": 2283845,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"transactionDate\\\": \\\"2016-08-02\\\",\\n        \\\"subscriptionId\\\": 8492717,\\n        \\\"transactionId\\\": 1012463333\\n    },\\n    \\\"trialPeriodDays\\\": 14,\\n    \\\"paymentSource\\\": {\\\"creditCardInfo\\\": {\\n        \\\"billingContactInfo\\\": {\\n            \\\"firstName\\\": \\\"John\\\",\\n            \\\"lastName\\\": \\\"Doe\\\"\\n        },\\n        \\\"creditCard\\\": {\\n            \\\"expirationYear\\\": 2019,\\n            \\\"cardLastFourDigits\\\": 1111,\\n            \\\"cardSubType\\\": \\\"CREDIT\\\",\\n          \\t\\\"cardCategory\\\": \\\"CLASSIC\\\",\\n            \\\"cardType\\\": \\\"VISA\\\",\\n            \\\"expirationMonth\\\": \\\"07\\\"\\n        }\\n    }},\\n    \\\"softDescriptor\\\": \\\"BLS&#x2a;default_descriptor\\\",\\n    \\\"recurringChargeAmount\\\": 29.99,\\n    \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n    \\\"vaultedShopperId\\\": 21188909,\\n    \\\"payerInfo\\\": {\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\"\\n    },\\n    \\\"initialChargeAmount\\\": 100,\\n    \\\"autoRenew\\\": true,\\n    \\\"planId\\\": 2283845,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"subscriptionId\\\": 8492717,\\n    \\\"fraudResultInfo\\\": {\\\"deviceDataCollector\\\": \\\"Y\\\"},\\n    \\\"status\\\": \\\"ACTIVE\\\"\\n}\",\n      \"language\": \"json\",\n      \"name\": \"Create Subscription Response: 200 OK\"\n    },\n    {\n      \"code\": \"{\\n  \\\"subscriptionId\\\": 39565914,\\n  \\\"planId\\\": 2200594,\\n  \\\"vaultedShopperId\\\": 19608696,\\n  \\\"status\\\": \\\"ACTIVE\\\",\\n  \\\"quantity\\\": 1,\\n  \\\"softDescriptor\\\": \\\"BLS*default_descriptor\\\",\\n  \\\"chargeFrequency\\\": \\\"MONTHLY\\\",\\n  \\\"recurringChargeAmount\\\": 29.99,\\n  \\\"currency\\\": \\\"USD\\\",\\n  \\\"autoRenew\\\": \\\"true\\\",\\n  \\\"nextChargeDate\\\": \\\"2017-04-16\\\",\\n  \\\"payerInfo\\\": {\\n    \\\"firstName\\\": \\\"John\\\",\\n    \\\"lastName\\\": \\\"Doe\\\",\\n    \\\"zip\\\": \\\"12345\\\",\\n    \\\"phone\\\": \\\"1234567890\\\"\\n  },\\n  \\\"paymentSource\\\": {\\n    \\\"Wallet\\\": {\\n      \\\"billingContactInfo\\\": {\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"address1\\\": \\\"South St\\\",\\n        \\\"city\\\": \\\"Waltham\\\",\\n        \\\"state\\\": \\\"MA\\\",\\n        \\\"zip\\\": \\\"02453\\\"\\n\\t\\t\\t},\\n      \\\"applePay\\\": {\\n        \\\"cardLastFourDigits\\\": \\\"0492\\\",\\n        \\\"cardType\\\": \\\"VISA\\\",\\n        \\\"cardSubType\\\": \\\"DEBIT\\\",\\n        \\\"dpanLastFourDigits\\\": \\\"4109\\\",\\n        \\\"dpanExpirationMonth\\\": \\\"11\\\",\\n        \\\"dpanExpirationYear\\\": \\\"25\\\"\\n      }\\n    }\\n  },\\n  \\\"charge\\\": {\\n    \\\"chargeId\\\": 235835,\\n    \\\"subscriptionId\\\": 39565914,\\n    \\\"planId\\\": 2200594,\\n    \\\"vaultedShopperId\\\": 19608696,\\n    \\\"transactionId\\\": 38548964,\\n    \\\"transactionDate\\\": \\\"2017-03-16\\\",\\n    \\\"amount\\\": 29.99,\\n    \\\"currency\\\": \\\"USD\\\",\\n    \\\"softDescriptor\\\": \\\"BLS*default_descriptor\\\",\\n    \\\"paymentSource\\\": {\\n      \\\"wallet\\\": {\\n        \\\"billingContactInfo\\\": {\\n          \\\"firstName\\\": \\\"John\\\",\\n          \\\"lastName\\\": \\\"Doe\\\",\\n          \\\"address1\\\": \\\"South St\\\",\\n          \\\"city\\\": \\\"Waltham\\\",\\n          \\\"state\\\": \\\"MA\\\",\\n          \\\"zip\\\": \\\"02453\\\"\\n        },\\n        \\\"applePay\\\": {\\n          \\\"cardLastFourDigits\\\": \\\"0492\\\",\\n          \\\"cardType\\\": \\\"VISA\\\",\\n\\t\\t\\t\\t\\t\\\"cardSubType\\\": \\\"DEBIT\\\",\\n          \\\"dpanLastFourDigits\\\": \\\"4109\\\",\\n          \\\"dpanExpirationMonth\\\": \\\"11\\\",\\n          \\\"dpanExpirationYear\\\": \\\"25\\\"\\n        }\\n      }\\n    },\\n    \\\"chargeInfo\\\": {\\n      \\\"fromDate\\\": \\\"2017-03-16\\\",\\n      \\\"toDate\\\": \\\"2017-04-16\\\",\\n      \\\"chargeType\\\": \\\"INITIAL\\\"\\n    }\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"200 OK - Apple Pay\"\n    },\n    {\n      \"code\": \"{\\n    \\\"planId\\\": 2436197,\\n    \\\"vaultedShopperId\\\": 21804015,\\n    \\\"softDescriptor\\\": \\\"Oooops LTD\\\",\\n    \\\"payerInfo\\\": {\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"country\\\": \\\"fr\\\",\\n        \\\"zip\\\": \\\"12345\\\",\\n        \\\"phone\\\": \\\"1234567890\\\"\\n    },\\n    \\\"paymentSource\\\": {\\n        \\\"sepaDirectDebitInfo\\\": {\\n            \\\"sepaDirectDebit\\\": {\\n                \\\"ibanFirstFour\\\": \\\"DE09\\\",\\n                \\\"ibanLastFour\\\": \\\"7893\\\",\\n                \\\"mandateId\\\": \\\"Ooo154091\\\",\\n                \\\"mandateDate\\\": \\\"25-Jul-17\\\",\\n                \\\"preNotificationText\\\": \\\"The amount of 29.99 EUR will be collected using SEPA Direct Debit with Mandate Ooo154091 from your bank account IBAN DE09XXXXXX7893 in the next few days. Please ensure sufficient funds in your account.\\\"\\n            }\\n        }\\n    },\\n    \\\"charge\\\": {\\n        \\\"planId\\\": 2436197,\\n        \\\"vaultedShopperId\\\": 21804015,\\n        \\\"transactionId\\\": \\\"1011216623\\\",\\n        \\\"transactionDate\\\": \\\"2017-07-25\\\",\\n        \\\"amount\\\": 29.99,\\n        \\\"currency\\\": \\\"EUR\\\",\\n        \\\"softDescriptor\\\": \\\"Oooops LTD\\\",\\n        \\\"paymentSource\\\": {\\n            \\\"sepaDirectDebitInfo\\\": {\\n                \\\"sepaDirectDebit\\\": {\\n                    \\\"ibanFirstFour\\\": \\\"DE09\\\",\\n                    \\\"ibanLastFour\\\": \\\"7893\\\",\\n                    \\\"mandateId\\\": \\\"Ooo154091\\\",\\n                    \\\"mandateDate\\\": \\\"25-Jul-17\\\",\\n                    \\\"preNotificationText\\\": \\\"The amount of 29.99 EUR will be collected using SEPA Direct Debit with Mandate Ooo154091 from your bank account IBAN DE09XXXXXX7893 in the next few days. Please ensure sufficient funds in your account.\\\"\\n                }\\n            }\\n        },\\n        \\\"processingInfo\\\": {\\n            \\\"processingStatus\\\": \\\"PENDING\\\"\\n        }\\n    }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"200 OK - SEPA Direct Debit \"\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\n\n###Create Subscription: with new shopper\nThis example shows a basic Create Subscription request for a new shopper, with details about the shopper and their payment method. If you are using client-side encryption, you can send the encrypted card info in this requested instead of the plain card details.\n\n###Create Subscription: with vaulted shopper and optional fields\nThis example shows a Create Subscription request with an existing vaulted shopper who has only one saved payment method, so there is no need to specify which payment method to use.\n\nThis example request also includes all optional subscription fields, such as quantity, soft descriptor and the various override fields. The override values take precedence over the settings at the plan level, and they apply only to this subscription. \n\n###Create Subscription: with vaulted shopper and specific payment method\nThis example shows a Create Subscription request with an existing vaulted shopper who has multiple saved payment methods, so you must specify which payment method to use.\n\n###Create Subscription: with Apple Pay\nThis example shows a Create Subscription request with an Apple Pay wallet. In the request, include `encodedPaymentToken` inside `paymentSource` > `wallet` > `applePay`. See the [Apple Pay Guide](/v1.0/docs/apple-pay#section-implementing-apple-pay-in-your-website-or-ios-app) for more information.\n\n**Note**: To test Apple Pay, follow the steps in the [Apple Pay Guide](/v1.0/docs/apple-pay#section-implementing-apple-pay-in-your-website-or-ios-app). The API Explorer does not support Apple Pay testing. \n\n###Create Subscription: with SEPA Direct Debit \nThis example shows a Create Subscription request with a new shopper with the SEPA Direct Debit payment method. In the request, include `authorizedByShopper` with a value set to **true** to indicate that you've collected the shopper's [mandate acceptance](/v1.0/docs/sepa-direct-debit#section-step-1-collect-a-mandate-acceptance-from-your-shopper). \n\n**Note**: `subscriptionId` will not be returned in the Create Subscription response. The subscription ID will be created when the shopper's account is debited (typically within 5 - 6 business days) and the `processingStatus` value changes to **SUCCESS**. You will be informed of the subscription ID via `Charge` webhook or via [Retrieve SEPA DD Transaction](doc:retrieve-sepa-dd-transaction) request. \n\n<br>\n\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, enter the request content below and then click **Try it!**\n\n**Tip**: Use the JSON code below as a starting point. You can enter different parameters 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\": \"{\\n    \\\"payerInfo\\\": {\\n        \\\"zip\\\": 12345,\\n        \\\"firstName\\\": \\\"John\\\",\\n        \\\"lastName\\\": \\\"Doe\\\",\\n        \\\"phone\\\": 1234567890\\n    },\\n    \\\"paymentSource\\\": {\\\"creditCardInfo\\\": {\\\"creditCard\\\": {\\n        \\\"expirationYear\\\": 2019,\\n        \\\"securityCode\\\": 111,\\n        \\\"expirationMonth\\\": \\\"07\\\",\\n        \\\"cardNumber\\\": 4111111111111111\\n    }}},\\n    \\\"planId\\\": 2283845\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"create-subscription","type":"post","title":"Create Subscription"}

postCreate Subscription


Definition

{{ api_url }}{{ page_api_url }}

Documentation

The Create Subscription request enables you to set up a subscription, which associates a shopper with a plan to bill on an ongoing basis.

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

Testing subscription charges in sandbox

After creating the subscription, you can simulate a recurring charge event, and trigger associated IPN's, emails, and invoices, in sandbox. Visit the Subscriptions Guide to learn how

Try it in the API Explorer

Request Content

Send a subscription object, with the following:

      payerInfo     object    optional - do not include if sending vaultedShopperId (see payerInfo)

      vaultedShopperId     integer    optional - do not include if sending payerInfo

      vendorInfo container    required if using marketplace vendors (see vendorInfo)

      paymentSource     object    required for payerInfo; optional for vaultedShopperId (see paymentSource)

      authorizedByShopper     boolean   required for SEPA Direct Debit   value must be true

      overrideInitialChargeAmount     decimal   optional

      overrideRecurringChargeAmount     decimal   optional

      quantity     integer    optional

      overrideTrialPeriodDays     integer    optional

      softDescriptor     string    optional

      planId     integer    required

      transactionFraudInfo     object    optional (see transactionFraudInfo)

Response Details

If successful, the response HTTP status code is 200 OK.
The response contains the subscription object.
The subscriptionId appears in the response body and the location header (unless payment source was SEPA DD).


Examples

Request Examples

curl -v -X PUT https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "payerInfo": {
        "zip": 12345,
        "firstName": "John",
        "lastName": "Doe",
        "phone": 1234567890
    },
    "paymentSource": {"creditCardInfo": {"creditCard": {
        "expirationYear": 2019,
        "securityCode": 111,
        "expirationMonth": "07",
        "cardNumber": 4111111111111111
    }}},
    "planId": 2283845,
    "transactionFraudInfo": {"fraudSessionId": 1234}
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "vaultedShopperId": 20769005,
    "overrideInitialChargeAmount": 10.5,
    "overrideRecurringChargeAmount": 29.99,
    "quantity": 2,
    "overrideTrialPeriodDays": 10,
    "softDescriptor": "Merchant name",
    "planId": 2283845,
    "transactionFraudInfo": {
        "shopperIpAddress": "123.12.134.1",
        "fraudSessionId": 1234,
        "company": "Company Name",
        "shippingContactInfo": {
            "zip": 12345,
            "country": "US",
            "firstName": "Doe",
            "lastName": "John",
            "city": "Juneau",
            "address2": "Apt 2",
            "address1": "1 Main St",
            "state": "AK"
        }
    }
}
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "vaultedShopperId": 20769005,
    "paymentSource": {"creditCardInfo": {"creditCard": {
        "cardLastFourDigits": 9299,
        "cardType": "VISA"
    }}},
    "planId": 2283845
}
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{  
   "payerInfo":{  
      "zip":12345,
      "firstName":"John",
      "lastName":"Doe",
      "phone":1234567890
   },
   "paymentSource":{  
      "creditCardInfo":{  
         "pfToken":"339110a75e2cdbb5f5f2cea8d7cd8af261ad7c89fb0ce1aae_"
      }
   },
   "planId":2186278
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "payerInfo": {
        "zip": 12345,
        "firstName": "John",
        "lastName": "Doe",
        "phone": 1234567890
    },
    "paymentSource": {"creditCardInfo": {"creditCard": {
        "expirationYear": 2019,
        "securityCode": 111,
        "expirationMonth": 07,
        "cardNumber": 4111111111111111
    }}},
    "planId": 2283845,
    "transactionFraudInfo": {"fraudSessionId": 1234}
    "vendorInfo": {"vendorId": 402090}
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "planId": 2283845,
    "paymentSource": {
      "wallet": {
        "applePay": { 
          "encodedPaymentToken": "ImRhdGEiO1AvRitIUy85Im9RbXhCMFd" 
        }
      }
    }
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/recurring/subscriptions \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \ 
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "planId": 2436197,
    "authorizedByShopper": true,
    "payerInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "country": "fr",
        "zip": "12345",
        "phone": "1234567890"
    },
    "paymentSource": {
        "sepaDirectDebitInfo": {
            "sepaDirectDebit": {
                "iban": "DE09100100101234567893"
            }
        }
    }
}'

Response Examples

{
    "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": 2019,
            "cardLastFourDigits": 1111,
            "cardSubType": "CREDIT",
            "cardType": "VISA",
            "expirationMonth": "07"
        }}},
        "softDescriptor": "BLS&#x2a;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&#x2a;default_descriptor",
    "recurringChargeAmount": 29.99,
    "chargeFrequency": "MONTHLY",
    "vaultedShopperId": 21188909,
    "payerInfo": {
        "firstName": "John",
        "lastName": "Doe"
    },
    "initialChargeAmount": 100,
    "autoRenew": true,
    "planId": 2283845,
    "currency": "USD",
    "subscriptionId": 8492717,
    "fraudResultInfo": {"deviceDataCollector": "Y"},
    "status": "ACTIVE"
}
{
  "subscriptionId": 39565914,
  "planId": 2200594,
  "vaultedShopperId": 19608696,
  "status": "ACTIVE",
  "quantity": 1,
  "softDescriptor": "BLS*default_descriptor",
  "chargeFrequency": "MONTHLY",
  "recurringChargeAmount": 29.99,
  "currency": "USD",
  "autoRenew": "true",
  "nextChargeDate": "2017-04-16",
  "payerInfo": {
    "firstName": "John",
    "lastName": "Doe",
    "zip": "12345",
    "phone": "1234567890"
  },
  "paymentSource": {
    "Wallet": {
      "billingContactInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "address1": "South St",
        "city": "Waltham",
        "state": "MA",
        "zip": "02453"
			},
      "applePay": {
        "cardLastFourDigits": "0492",
        "cardType": "VISA",
        "cardSubType": "DEBIT",
        "dpanLastFourDigits": "4109",
        "dpanExpirationMonth": "11",
        "dpanExpirationYear": "25"
      }
    }
  },
  "charge": {
    "chargeId": 235835,
    "subscriptionId": 39565914,
    "planId": 2200594,
    "vaultedShopperId": 19608696,
    "transactionId": 38548964,
    "transactionDate": "2017-03-16",
    "amount": 29.99,
    "currency": "USD",
    "softDescriptor": "BLS*default_descriptor",
    "paymentSource": {
      "wallet": {
        "billingContactInfo": {
          "firstName": "John",
          "lastName": "Doe",
          "address1": "South St",
          "city": "Waltham",
          "state": "MA",
          "zip": "02453"
        },
        "applePay": {
          "cardLastFourDigits": "0492",
          "cardType": "VISA",
					"cardSubType": "DEBIT",
          "dpanLastFourDigits": "4109",
          "dpanExpirationMonth": "11",
          "dpanExpirationYear": "25"
        }
      }
    },
    "chargeInfo": {
      "fromDate": "2017-03-16",
      "toDate": "2017-04-16",
      "chargeType": "INITIAL"
    }
  }
}
{
    "planId": 2436197,
    "vaultedShopperId": 21804015,
    "softDescriptor": "Oooops LTD",
    "payerInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "country": "fr",
        "zip": "12345",
        "phone": "1234567890"
    },
    "paymentSource": {
        "sepaDirectDebitInfo": {
            "sepaDirectDebit": {
                "ibanFirstFour": "DE09",
                "ibanLastFour": "7893",
                "mandateId": "Ooo154091",
                "mandateDate": "25-Jul-17",
                "preNotificationText": "The amount of 29.99 EUR will be collected using SEPA Direct Debit with Mandate Ooo154091 from your bank account IBAN DE09XXXXXX7893 in the next few days. Please ensure sufficient funds in your account."
            }
        }
    },
    "charge": {
        "planId": 2436197,
        "vaultedShopperId": 21804015,
        "transactionId": "1011216623",
        "transactionDate": "2017-07-25",
        "amount": 29.99,
        "currency": "EUR",
        "softDescriptor": "Oooops LTD",
        "paymentSource": {
            "sepaDirectDebitInfo": {
                "sepaDirectDebit": {
                    "ibanFirstFour": "DE09",
                    "ibanLastFour": "7893",
                    "mandateId": "Ooo154091",
                    "mandateDate": "25-Jul-17",
                    "preNotificationText": "The amount of 29.99 EUR will be collected using SEPA Direct Debit with Mandate Ooo154091 from your bank account IBAN DE09XXXXXX7893 in the next few days. Please ensure sufficient funds in your account."
                }
            }
        },
        "processingInfo": {
            "processingStatus": "PENDING"
        }
    }
}

Back to Top


Example Descriptions

Create Subscription: with new shopper

This example shows a basic Create Subscription request for a new shopper, with details about the shopper and their payment method. If you are using client-side encryption, you can send the encrypted card info in this requested instead of the plain card details.

Create Subscription: with vaulted shopper and optional fields

This example shows a Create Subscription request with an existing vaulted shopper who has only one saved payment method, so there is no need to specify which payment method to use.

This example request also includes all optional subscription fields, such as quantity, soft descriptor and the various override fields. The override values take precedence over the settings at the plan level, and they apply only to this subscription.

Create Subscription: with vaulted shopper and specific payment method

This example shows a Create Subscription request with an existing vaulted shopper who has multiple saved payment methods, so you must specify which payment method to use.

Create Subscription: with Apple Pay

This example shows a Create Subscription request with an Apple Pay wallet. In the request, include encodedPaymentToken inside paymentSource > wallet > applePay. See the Apple Pay Guide for more information.

Note: To test Apple Pay, follow the steps in the Apple Pay Guide. The API Explorer does not support Apple Pay testing.

Create Subscription: with SEPA Direct Debit

This example shows a Create Subscription request with a new shopper with the SEPA Direct Debit payment method. In the request, include authorizedByShopper with a value set to true to indicate that you've collected the shopper's mandate acceptance.

Note: subscriptionId will not be returned in the Create Subscription response. The subscription ID will be created when the shopper's account is debited (typically within 5 - 6 business days) and the processingStatus value changes to SUCCESS. You will be informed of the subscription ID via Charge webhook or via Retrieve SEPA DD Transaction request.


Back to Top


API Explorer

To test out a call, enter the request content below and then click Try it!

Tip: Use the JSON code below as a starting point. You can enter different parameters 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.

{
    "payerInfo": {
        "zip": 12345,
        "firstName": "John",
        "lastName": "Doe",
        "phone": 1234567890
    },
    "paymentSource": {"creditCardInfo": {"creditCard": {
        "expirationYear": 2019,
        "securityCode": 111,
        "expirationMonth": "07",
        "cardNumber": 4111111111111111
    }}},
    "planId": 2283845
}

User Information

Try It Out


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