Skip to content

Commit

Permalink
Add support for invoice_now and prorate on subscription cancelation
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed Dec 26, 2018
1 parent c616bf2 commit 837fde2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 837fde2

Please sign in to comment.