For the purposes of making test subscriptions call, you'll be using the subscriptions simulator in your Testing Pays account.
To open the simulator interface, login to your Testing Pays account and click "OPEN" on the "subscriptions" bookmark on your dashboard. You'll see the following sections in your simulator:
The simplest option is using cURL. To create a Stripe subscription, at minimum you need a customer id, plan (encapsulated in an items list) and tax_percent. Using cURL, you need to submit these parameters as you would with a form POST.
You can add more parameters to your subscriptions: metadata, billing or trial period settings. The latter can be used to handle ‘first 14 days off’ kinda scenarios.
Next, your code needs to send the assembled request to the subscriptions simulator. The URL to POST to can be found under the "Integration" tab of the simulator - make sure to copy&paste this URL from your simulator as it contains your unique API_KEY.
The example shown below shows how to make a subscriptions request using cURL.
curl -X POST -u API_KEY: \
-d items[0][plan]=PLAN_10 \
-d customer=cus_sa9sd9f8asdf98329as9df \
-d tax_percent=1.00 \
https://api.testingpays.com/API_KEY/stripe/v1/subscriptions
The simulator will send back a JSON object that contains information about the subscription - echoing back your call details along with the defaults
{
"id": "sub_D3mOlPUnzEj4Iv2XjtrxrmKN",
"object": "subscription",
"application_fee_percent": null,
"billing": "charge_automatically",
"billing_cycle_anchor": null,
"billing_thresholds": "",
"cancel_at_period_end": null,
"canceled_at": null,
"created": 1550495588,
"current_period_end": 1551359588,
"current_period_start": 1548767588,
"customer": "cus_A7gEnmzqIud0yg",
"discount": null,
"ended_at": null,
"livemode": false,
"metadata": { },
"items": {
"object": "list",
"data": [
{
"id": "si_S6upnHBNyZfjc9sZX3bEtUoz",
"object": "subscription_item",
"billing_thresholds": "",
"created": 1550495588,
"plan": {
"id": "",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 1999,
"billing_scheme": "per_unit",
"created": 1550495588,
"currency": "eur",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": "Testing Pays Monthly",
"product": "prod_BUthVRQ7KdFfa7",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
},
"quantity": 1,
"subscription": "sub_D3mOlPUnzEj4Iv2XjtrxrmKN"
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/subscription_items?subscription=sub_D3mOlPUnzEj4Iv2XjtrxrmKN"
},
"plan": {
"id": "",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 1999,
"billing_scheme": "per_unit",
"created": 1550495588,
"currency": "eur",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": "Testing Pays Monthly",
"product": "prod_BUthVRQ7KdFfa7",
"tiers": null,
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
},
"quantity": 1,
"start": 1550495588,
"status": "active",
"tax_percent": 1.00,
"trial_end": null,
"trial_start": null
}
Save the subscription ID and connect it to your customer ID! This way you can always trace back a transaction, subscription data, etc. Subscription ID can be used to update a subscription: cancel, add more, modify current subscription items, etc.