stripity-stripe v1.4.0 Stripe.Subscriptions
Main API for working with Subscriptions at Stripe. Through this API you can:
- create
- change
- retrieve
- cancel
- cancel_all
- list all
- count all
Supports Connect workflow by allowing to pass in any API key explicitely (vs using the one from env/config).
Summary
Functions
List all subscriptions
List all subscriptions using given api key
Cancels a subscription
Cancels a subscription with given api key
Cancel all subscriptions for account
Cancel all subscriptions for account using given api key
Changes a customer’s subscription (plan, description, etc - see Stripe API for acceptable options). Customer ID and Subscription ID are required for this
Changes a customer’s subscription using given api key(plan, description, etc - see Stripe API for acceptable options). Customer ID, Subscription ID, opts and api key are required for this
Changes the payment source for a subscription
Count total number of subscriptions
Count total number of subscriptions using given api key
Starts a subscription for the specified customer
Starts a subscription for the specified customer using given api key
Returns a subscription; customer_id and subscription_id are required
Returns a subscription using given api key; customer_id and subscription_id are required
Functions
List all subscriptions.
##Example
{:ok, subscriptions} = Stripe.Subscriptions.all customer_id
List all subscriptions using given api key.
##Example
{:ok, subscriptions} = Stripe.Subscriptions.all customer_id, [], "", key
Cancels a subscription
Example
Stripe.Subscriptions.cancel "customer_id", "subscription_id"
Stripe.Subscriptions.cancel "customer_id", "subscription_id", [at_period_end: true]
Cancels a subscription with given api key.
Example
Stripe.Subscriptions.cancel "customer_id", "subscription_id", key
Cancel all subscriptions for account.
#Example
Stripe.Subscriptions.cancel_all customer_id
Cancel all subscriptions for account using given api key.
#Example
Stripe.Subscriptions.cancel_all customer_id, key
Changes a customer’s subscription (plan, description, etc - see Stripe API for acceptable options). Customer ID and Subscription ID are required for this.
Example
Stripe.Subscriptions.change "customer_id", "subscription_id", "plan_id"
Changes a customer’s subscription using given api key(plan, description, etc - see Stripe API for acceptable options). Customer ID, Subscription ID, opts and api key are required for this.
Example
Stripe.Subscriptions.change "customer_id", "subscription_id", "plan_id", key
Changes the payment source for a subscription.
#Example
source = [object: "card", number: "4111111111111111", exp_month: 01, exp_year: 2018, cvc: 123]
Stripe.Subscriptions.change_payment_source("customer_id", "subscription_id", source)
Count total number of subscriptions.
Example
{:ok, count} = Stripe.Subscriptions.count customer_id
Count total number of subscriptions using given api key.
Example
{:ok, count} = Stripe.Subscriptions.count customer_id, key
Starts a subscription for the specified customer.
Example
new_sub = [
plan: plan_id,
metadata: [
...
]
]
{:ok, sub} = Stripe.Subscriptions.create customer_id, new_sub
Starts a subscription for the specified customer using given api key.
Example
new_sub = [
plan: plan_id,
metadata: [
...
]
]
{:ok, sub} = Stripe.Subscriptions.create customer_id, opts, key
Returns a subscription; customer_id and subscription_id are required.
Example
{:ok, customer} = Stripe.Customers.get_subscription "customer_id", "subscription_id"