From 07d858b86369047fe3482723e0ae8377f640937c Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 6 May 2020 17:45:26 -0700 Subject: [PATCH] Add support for `Metadata` for `PaymentIntentData` and `SubscriptionData` on Checkout `Session` --- checkout/session/client_test.go | 8 ++++++++ checkout_session.go | 2 ++ 2 files changed, 10 insertions(+) diff --git a/checkout/session/client_test.go b/checkout/session/client_test.go index d7ae4639b0..40557259a6 100644 --- a/checkout/session/client_test.go +++ b/checkout/session/client_test.go @@ -32,6 +32,10 @@ func TestCheckoutSessionNew(t *testing.T) { }, PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{ Description: stripe.String("description"), + Metadata: map[string]string{ + "attr1": "val1", + "attr2": "val2", + }, Shipping: &stripe.ShippingDetailsParams{ Address: &stripe.AddressParams{ Line1: stripe.String("line1"), @@ -51,6 +55,10 @@ func TestCheckoutSessionNew(t *testing.T) { Quantity: stripe.Int64(2), }, }, + Metadata: map[string]string{ + "attr1": "val1", + "attr2": "val2", + }, }, SuccessURL: stripe.String("https://stripe.com/success"), }) diff --git a/checkout_session.go b/checkout_session.go index c3e2aed022..6eee1c19a6 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -62,6 +62,7 @@ type CheckoutSessionPaymentIntentDataParams struct { ApplicationFeeAmount *int64 `form:"application_fee_amount"` CaptureMethod *string `form:"capture_method"` Description *string `form:"description"` + Metadata map[string]string `form:"metadata"` OnBehalfOf *string `form:"on_behalf_of"` ReceiptEmail *string `form:"receipt_email"` SetupFutureUsage *string `form:"setup_future_usage"` @@ -101,6 +102,7 @@ type CheckoutSessionSubscriptionDataParams struct { Coupon *string `form:"coupon"` DefaultTaxRates []*string `form:"default_tax_rates"` Items []*CheckoutSessionSubscriptionDataItemsParams `form:"items"` + Metadata map[string]string `form:"metadata"` TrialEnd *int64 `form:"trial_end"` TrialFromPlan *bool `form:"trial_from_plan"` TrialPeriodDays *int64 `form:"trial_period_days"`