Skip to content

Commit

Permalink
Subscription :items is required (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer authored Dec 6, 2019
1 parent 5cd3128 commit 636da22
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/stripe/subscriptions/subscription.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ defmodule Stripe.Subscription do
optional(:collection_method) => String.t(),
optional(:coupon) => Stripe.id() | Stripe.Coupon.t(),
optional(:days_until_due) => non_neg_integer,
optional(:items) => [
:items => [
%{
:plan => Stripe.id() | Stripe.Plan.t(),
optional(:quantity) => non_neg_integer
optional(:billing_methods) => map,
optional(:metadata) => map,
optional(:quantity) => non_neg_integer,
optional(:tax_rates) => list
}
],
optional(:metadata) => Stripe.Types.metadata(),
Expand All @@ -121,7 +124,7 @@ defmodule Stripe.Subscription do
optional(:trial_from_plan) => boolean,
optional(:trial_period_days) => non_neg_integer
}
def create(%{customer: _} = params, opts \\ []) do
def create(%{customer: _, items: _} = params, opts \\ []) do
new_request(opts)
|> put_endpoint(@plural_endpoint)
|> put_params(params)
Expand Down Expand Up @@ -161,7 +164,10 @@ defmodule Stripe.Subscription do
optional(:items) => [
%{
:plan => Stripe.id() | Stripe.Plan.t(),
optional(:quantity) => non_neg_integer
optional(:billing_methods) => map,
optional(:metadata) => map,
optional(:quantity) => non_neg_integer,
optional(:tax_rates) => list
}
],
optional(:metadata) => Stripe.Types.metadata(),
Expand Down

0 comments on commit 636da22

Please sign in to comment.