-
Notifications
You must be signed in to change notification settings - Fork 353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
changed params for subscription to accept default payment method #592
Conversation
@@ -124,7 +124,7 @@ defmodule Stripe.Subscription do | |||
optional(:trial_from_plan) => boolean, | |||
optional(:trial_period_days) => non_neg_integer | |||
} | |||
def create(%{customer: _, items: _} = params, opts \\ []) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
THis ensures that the create action is passed with a customer and items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we need this? It seems these two are required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I think it's necessary to provide it for the sake of keeping in line with the tutorial. If we'd like to figure out if the user has passed in a customer and items key, we can probably just use the Map.has_key?(params, :customer)
and if it returns false, we throw an exception.
@@ -164,6 +164,7 @@ defmodule Stripe.Subscription do | |||
optional(:items) => [ | |||
%{ | |||
:plan => Stripe.id() | Stripe.Plan.t(), | |||
optional(:id) => Stripe.id() | binary(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this documented anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's located here as an optional parameter
It's also considered a required parameter when upgrading and downgrading a user subscription
When updating a new subscription, it's considered to be an optional parameter. When I was attempting to upgrade and downgrade my current subscription, I realized this library doesn't allow for me to upgrade/downgrade an existing subscription.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥇
Made a minor change to the api that allows you to pass a default payment method directly into the parameters of Stripe.Subscription.create.