Skip to content
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

Add support for invoice_now and prorate on subscription cancelation #741

Merged
merged 1 commit into from
Dec 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sub.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ type SubscriptionParams struct {
// SubscriptionCancelParams is the set of parameters that can be used when canceling a subscription.
// For more details see https://stripe.com/docs/api#cancel_subscription
type SubscriptionCancelParams struct {
Params `form:"*"`
Params `form:"*"`
InvoiceNow *bool `form:"invoice_now"`
Prorate *bool `form:"prorate"`
}

// AppendTo implements custom encoding logic for SubscriptionParams so that the special
Expand Down
5 changes: 4 additions & 1 deletion sub/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import (
)

func TestSubscriptionCancel(t *testing.T) {
subscription, err := Cancel("sub_123", &stripe.SubscriptionCancelParams{})
subscription, err := Cancel("sub_123", &stripe.SubscriptionCancelParams{
InvoiceNow: stripe.Bool(true),
Prorate: stripe.Bool(true),
})
assert.Nil(t, err)
assert.NotNil(t, subscription)
}
Expand Down