payjp v0.1.3 Payjp.Subscriptions

Main API for working with Subscriptions at Payjp. Through this API you can:

  • create
  • change
  • retrieve
  • cancel
  • cancel_all
  • list all

Supports Connect workflow by allowing to pass in any API key explicitely (vs using the one from env/config).

(API ref https://pay.jp/docs/api/#subscription-定期課金)

Summary

Functions

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 Payjp API for acceptable options). Subscription ID is required for this

Changes a customer’s subscription using given api key(plan, description, etc - see Payjp API for acceptable options). Customer ID, Subscription ID, opts and api key are required for this

Starts a subscription for the specified customer

Starts a subscription for the specified customer using given api key

Deletes a subscription

Deletes a subscription with given api key

Returns a subscription; subscription_id is required

Returns a subscription using given api key; subscription_id is required

Returns a list of Subscriptions with a default limit of 10 which you can override with list/1

Returns a list of Subscriptions with a default limit of 10 which you can override with list/1 Using a given payjp key to apply against the account associated

Pauses a subscription

Pauses a subscription with given api key

Resumes a subscription

Resumes a subscription with given api key

Functions

all(accum \\ [], opts \\ [limit: 100])

List all subscriptions.

##Example

{:ok, subscriptions} = Payjp.Subscriptions.all
all(accum, key, opts)

List all subscriptions using given api key.

##Example

{:ok, subscriptions} = Payjp.Subscriptions.all [], key, []
cancel(sub_id, opts \\ [])

Cancels a subscription

Example

  Payjp.Subscriptions.cancel "subscription_id"
cancel(sub_id, key, opts)

Cancels a subscription with given api key.

Example

Payjp.Subscriptions.cancel "subscription_id", key, []
cancel_all(customer_id, opts)

Cancel all subscriptions for account.

#Example

Payjp.Subscriptions.cancel_all customer_id
cancel_all(customer_id, opts, key)

Cancel all subscriptions for account using given api key.

#Example

Payjp.Subscriptions.cancel_all customer_id, key
change(sub_id, plan_id)

Changes a customer’s subscription (plan, description, etc - see Payjp API for acceptable options). Subscription ID is required for this.

Example

Payjp.Subscriptions.change "subscription_id", "plan_id"
change(sub_id, plan_id, key)

Changes a customer’s subscription using given api key(plan, description, etc - see Payjp API for acceptable options). Customer ID, Subscription ID, opts and api key are required for this.

Example

Payjp.Subscriptions.change "subscription_id", [plan: "plan_id"], key
create(customer_id, opts)

Starts a subscription for the specified customer.

Example

  new_sub = [
    plan: plan_id,
    metadata: [
    ...
    ]
  ]
  {:ok, sub} = Payjp.Subscriptions.create customer_id, new_sub
create(customer_id, opts, key)

Starts a subscription for the specified customer using given api key.

Example

new_sub = [
  plan: plan_id,
  metadata: [
  ...
  ]
]
{:ok, sub} = Payjp.Subscriptions.create customer_id, opts, key
delete(sub_id, opts \\ [])

Deletes a subscription

Example

  Payjp.Subscriptions.delete "subscription_id"
delete(sub_id, key, opts)

Deletes a subscription with given api key.

Example

Payjp.Subscriptions.delete "subscription_id", key, []
get(sub_id)

Returns a subscription; subscription_id is required.

Example

  {:ok, customer} = Payjp.Subscriptions.get "subscription_id"
get(sub_id, key)

Returns a subscription using given api key; subscription_id is required.

Example

{:ok, sub} = Payjp.Subscriptions.get "subscription_id", key
list(opts \\ [])

Returns a list of Subscriptions with a default limit of 10 which you can override with list/1

Example

  {:ok, subscriptions} = Payjp.Subscriptions.list(limit: 20)
list(key, opts)

Returns a list of Subscriptions with a default limit of 10 which you can override with list/1 Using a given payjp key to apply against the account associated.

Example

{:ok, subscriptions} = Payjp.Subscriptions.list(key, limit: 20)
pause(sub_id, opts \\ [])

Pauses a subscription

Example

  Payjp.Subscriptions.pause "subscription_id"
pause(sub_id, key, opts)

Pauses a subscription with given api key.

Example

Payjp.Subscriptions.pause "subscription_id", key, []
resume(sub_id, opts \\ [])

Resumes a subscription

Example

  Payjp.Subscriptions.resume "subscription_id"
resume(sub_id, key, opts)

Resumes a subscription with given api key.

Example

Payjp.Subscriptions.resume "subscription_id", key, []