Skip to content

Commit

Permalink
Merge pull request #741 from stripe/remi-add-sub-cancel-options
Browse files Browse the repository at this point in the history
Add support for invoice_now and prorate on subscription cancelation
  • Loading branch information
brandur-stripe authored Dec 31, 2018
2 parents 3086550 + 837fde2 commit f22223c
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 f22223c

Please sign in to comment.