From 837fde283dee1e5349d1dfc11cd7e68e164d22db Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 26 Dec 2018 10:25:20 +0100 Subject: [PATCH] Add support for invoice_now and prorate on subscription cancelation --- sub.go | 4 +++- sub/client_test.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sub.go b/sub.go index ae7dd3a35c..cbad026f4f 100644 --- a/sub.go +++ b/sub.go @@ -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 diff --git a/sub/client_test.go b/sub/client_test.go index ccd2bbf7a8..f647bc480d 100644 --- a/sub/client_test.go +++ b/sub/client_test.go @@ -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) }