Create and Cancel a Subscription
Subscriptions allow you to charge a customer on a recurring basis. They are created using the Subscriptions API. A customer and one of their associated payment methods is required. While the customer cannot be changed, the payment method can be updated as necessary.
Create a Subscription
To create a new subscription for an existing customer, you would use the Create a Subscription request.
1curl -X POST 'https://sandbox-app.tilled.com/v1/subscriptions' \
2-H 'tilled-account: {{MERCHANT_ACCOUNT_ID}}' \
3-H 'tilled-api-key: {{SECRET_KEY}}' \
4-H 'Content-Type: application/json' \
5-d '{
6 "billing_cycle_anchor": "1956-11-09T04:34:14.796Z",
7 "currency": "usd",
8 "customer_id": "cus_***********",
9 "payment_method": "pm_***********",
10 "interval_unit": "month",
11 "price": 100,
12 "cancel_at": "2015-06-04T07:32:32.084Z",
13 "interval_count": 1
14}'
Payment methods passed in the above request must be attached to the customer identified by the
customer_id
.
Cancel a Subscription
To cancel a customer’s subscription immediately you would use the Cancel a Subscription request.
1curl -X POST 'https://sandbox-app.tilled.com/v1/subscriptions/{{SUBSCRIPTION_ID}}/cancel' \
2-H 'tilled-account: {{MERCHANT_ACCOUNT_ID}}' \
3-H 'tilled-api-key: {{SECRET_KEY}}' \
4-H 'Content-Type: application/json'