-
Notifications
You must be signed in to change notification settings - Fork 448
/
checkout_session.go
692 lines (604 loc) · 38.6 KB
/
checkout_session.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
//
//
// File generated from our OpenAPI spec
//
//
package stripe
import "encoding/json"
// CheckoutSessionCustomerDetailsTaxIDsType is the list of allowed values for type
// on the tax_ids inside customer_details of a checkout session.
type CheckoutSessionCustomerDetailsTaxIDsType string
// List of values that CheckoutSessionCustomerDetailsTaxIDsType can take.
const (
CheckoutSessionCustomerDetailsTaxIDsTypeAETRN CheckoutSessionCustomerDetailsTaxIDsType = "ae_trn"
CheckoutSessionCustomerDetailsTaxIDsTypeAUABN CheckoutSessionCustomerDetailsTaxIDsType = "au_abn"
CheckoutSessionCustomerDetailsTaxIDsTypeAUARN CheckoutSessionCustomerDetailsTaxIDsType = "au_arn"
CheckoutSessionCustomerDetailsTaxIDsTypeBRCNPJ CheckoutSessionCustomerDetailsTaxIDsType = "br_cnpj"
CheckoutSessionCustomerDetailsTaxIDsTypeBRCPF CheckoutSessionCustomerDetailsTaxIDsType = "br_cpf"
CheckoutSessionCustomerDetailsTaxIDsTypeCABN CheckoutSessionCustomerDetailsTaxIDsType = "ca_bn"
CheckoutSessionCustomerDetailsTaxIDsTypeCAGSTHST CheckoutSessionCustomerDetailsTaxIDsType = "ca_gst_hst"
CheckoutSessionCustomerDetailsTaxIDsTypeCAPSTBC CheckoutSessionCustomerDetailsTaxIDsType = "ca_pst_bc"
CheckoutSessionCustomerDetailsTaxIDsTypeCAPSTMB CheckoutSessionCustomerDetailsTaxIDsType = "ca_pst_mb"
CheckoutSessionCustomerDetailsTaxIDsTypeCAPSTSK CheckoutSessionCustomerDetailsTaxIDsType = "ca_pst_sk"
CheckoutSessionCustomerDetailsTaxIDsTypeCAQST CheckoutSessionCustomerDetailsTaxIDsType = "ca_qst"
CheckoutSessionCustomerDetailsTaxIDsTypeCHVAT CheckoutSessionCustomerDetailsTaxIDsType = "ch_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeCLTIN CheckoutSessionCustomerDetailsTaxIDsType = "cl_tin"
CheckoutSessionCustomerDetailsTaxIDsTypeESCIF CheckoutSessionCustomerDetailsTaxIDsType = "es_cif"
CheckoutSessionCustomerDetailsTaxIDsTypeEUVAT CheckoutSessionCustomerDetailsTaxIDsType = "eu_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeGBVAT CheckoutSessionCustomerDetailsTaxIDsType = "gb_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeGEVAT CheckoutSessionCustomerDetailsTaxIDsType = "ge_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeHKBR CheckoutSessionCustomerDetailsTaxIDsType = "hk_br"
CheckoutSessionCustomerDetailsTaxIDsTypeIDNPWP CheckoutSessionCustomerDetailsTaxIDsType = "id_npwp"
CheckoutSessionCustomerDetailsTaxIDsTypeILVAT CheckoutSessionCustomerDetailsTaxIDsType = "il_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeINGST CheckoutSessionCustomerDetailsTaxIDsType = "in_gst"
CheckoutSessionCustomerDetailsTaxIDsTypeJPCN CheckoutSessionCustomerDetailsTaxIDsType = "jp_cn"
CheckoutSessionCustomerDetailsTaxIDsTypeJPRN CheckoutSessionCustomerDetailsTaxIDsType = "jp_rn"
CheckoutSessionCustomerDetailsTaxIDsTypeKRBRN CheckoutSessionCustomerDetailsTaxIDsType = "kr_brn"
CheckoutSessionCustomerDetailsTaxIDsTypeLIUID CheckoutSessionCustomerDetailsTaxIDsType = "li_uid"
CheckoutSessionCustomerDetailsTaxIDsTypeMXRFC CheckoutSessionCustomerDetailsTaxIDsType = "mx_rfc"
CheckoutSessionCustomerDetailsTaxIDsTypeMYFRP CheckoutSessionCustomerDetailsTaxIDsType = "my_frp"
CheckoutSessionCustomerDetailsTaxIDsTypeMYITN CheckoutSessionCustomerDetailsTaxIDsType = "my_itn"
CheckoutSessionCustomerDetailsTaxIDsTypeMYSST CheckoutSessionCustomerDetailsTaxIDsType = "my_sst"
CheckoutSessionCustomerDetailsTaxIDsTypeNOVAT CheckoutSessionCustomerDetailsTaxIDsType = "no_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeNZGST CheckoutSessionCustomerDetailsTaxIDsType = "nz_gst"
CheckoutSessionCustomerDetailsTaxIDsTypeRUINN CheckoutSessionCustomerDetailsTaxIDsType = "ru_inn"
CheckoutSessionCustomerDetailsTaxIDsTypeRUKPP CheckoutSessionCustomerDetailsTaxIDsType = "ru_kpp"
CheckoutSessionCustomerDetailsTaxIDsTypeSAVAT CheckoutSessionCustomerDetailsTaxIDsType = "sa_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeSGGST CheckoutSessionCustomerDetailsTaxIDsType = "sg_gst"
CheckoutSessionCustomerDetailsTaxIDsTypeSGUEN CheckoutSessionCustomerDetailsTaxIDsType = "sg_uen"
CheckoutSessionCustomerDetailsTaxIDsTypeTHVAT CheckoutSessionCustomerDetailsTaxIDsType = "th_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeTWVAT CheckoutSessionCustomerDetailsTaxIDsType = "tw_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeUAVAT CheckoutSessionCustomerDetailsTaxIDsType = "ua_vat"
CheckoutSessionCustomerDetailsTaxIDsTypeUnknown CheckoutSessionCustomerDetailsTaxIDsType = "unknown"
CheckoutSessionCustomerDetailsTaxIDsTypeUSEIN CheckoutSessionCustomerDetailsTaxIDsType = "us_ein"
CheckoutSessionCustomerDetailsTaxIDsTypeZAVAT CheckoutSessionCustomerDetailsTaxIDsType = "za_vat"
)
type CheckoutSessionAutomaticTaxStatus string
// List of values that CheckoutSessionAutomaticTaxStatus can take
const (
CheckoutSessionAutomaticTaxStatusComplete CheckoutSessionAutomaticTaxStatus = "complete"
CheckoutSessionAutomaticTaxStatusFailed CheckoutSessionAutomaticTaxStatus = "failed"
CheckoutSessionAutomaticTaxStatusRequiresLocationInputs CheckoutSessionAutomaticTaxStatus = "requires_location_inputs"
)
// Describes whether Checkout should collect the customer's billing address.
type CheckoutSessionBillingAddressCollection string
// List of values that CheckoutSessionBillingAddressCollection can take
const (
CheckoutSessionBillingAddressCollectionAuto CheckoutSessionBillingAddressCollection = "auto"
CheckoutSessionBillingAddressCollectionRequired CheckoutSessionBillingAddressCollection = "required"
)
// If `opt_in`, the customer consents to receiving promotional communications
// from the merchant about this Checkout Session.
type CheckoutSessionConsentPromotions string
// List of values that CheckoutSessionConsentPromotions can take
const (
CheckoutSessionConsentPromotionsOptIn CheckoutSessionConsentPromotions = "opt_in"
CheckoutSessionConsentPromotionsOptOut CheckoutSessionConsentPromotions = "opt_out"
)
// If set to `auto`, enables the collection of customer consent for promotional communications. The Checkout
// Session will determine whether to display an option to opt into promotional communication
// from the merchant depending on the customer's locale. Only available to US merchants.
type CheckoutSessionConsentCollectionPromotions string
// List of values that CheckoutSessionConsentCollectionPromotions can take
const (
CheckoutSessionConsentCollectionPromotionsAuto CheckoutSessionConsentCollectionPromotions = "auto"
)
// CheckoutSessionCustomerDetailsTaxExempt is the list of allowed values for
// tax_exempt inside customer_details of a checkout session.
type CheckoutSessionCustomerDetailsTaxExempt string
// List of values that CheckoutSessionCustomerDetailsTaxExempt can take.
const (
CheckoutSessionCustomerDetailsTaxExemptExempt CheckoutSessionCustomerDetailsTaxExempt = "exempt"
CheckoutSessionCustomerDetailsTaxExemptNone CheckoutSessionCustomerDetailsTaxExempt = "none"
CheckoutSessionCustomerDetailsTaxExemptReverse CheckoutSessionCustomerDetailsTaxExempt = "reverse"
)
// CheckoutSessionMode is the list of allowed values for the mode on a Session.
type CheckoutSessionMode string
// List of values that CheckoutSessionMode can take.
const (
CheckoutSessionModePayment CheckoutSessionMode = "payment"
CheckoutSessionModeSetup CheckoutSessionMode = "setup"
CheckoutSessionModeSubscription CheckoutSessionMode = "subscription"
)
// List of Stripe products where this mandate can be selected automatically. Returned when the Session is in `setup` mode.
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultFor string
// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultFor can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultForInvoice CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultFor = "invoice"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultForSubscription CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultFor = "subscription"
)
// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule is the list of allowed values for payment_schedule
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule string
// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentScheduleCombined CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule = "combined"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentScheduleInterval CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule = "interval"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentScheduleSporadic CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule = "sporadic"
)
// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType is the list of allowed values for transaction_type
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType string
// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionTypeBusiness CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType = "business"
CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionTypePersonal CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType = "personal"
)
// CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod is the list of allowed values for verification_method
type CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod string
// List of values that CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod can take
const (
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodAutomatic CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "automatic"
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodInstant CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "instant"
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodMicrodeposits CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "microdeposits"
)
// CheckoutSessionPaymentStatus is the list of allowed values for the payment status on a Session.`
type CheckoutSessionPaymentStatus string
// List of values that CheckoutSessionPaymentStatus can take.
const (
CheckoutSessionPaymentStatusNoPaymentRequired CheckoutSessionPaymentStatus = "no_payment_required"
CheckoutSessionPaymentStatusPaid CheckoutSessionPaymentStatus = "paid"
CheckoutSessionPaymentStatusUnpaid CheckoutSessionPaymentStatus = "unpaid"
)
// The status of the Checkout Session, one of `open`, `complete`, or `expired`.
type CheckoutSessionStatus string
// List of values that CheckoutSessionStatus can take
const (
CheckoutSessionStatusComplete CheckoutSessionStatus = "complete"
CheckoutSessionStatusExpired CheckoutSessionStatus = "expired"
CheckoutSessionStatusOpen CheckoutSessionStatus = "open"
)
// CheckoutSessionSubmitType is the list of allowed values for the submit type on a Session.
type CheckoutSessionSubmitType string
// List of values that CheckoutSessionSubmitType can take.
const (
CheckoutSessionSubmitTypeAuto CheckoutSessionSubmitType = "auto"
CheckoutSessionSubmitTypeBook CheckoutSessionSubmitType = "book"
CheckoutSessionSubmitTypeDonate CheckoutSessionSubmitType = "donate"
CheckoutSessionSubmitTypePay CheckoutSessionSubmitType = "pay"
)
// CheckoutSessionLineItemAdjustableQuantityParams represents the parameters for
// an adjustable quantity on a checkout session's line items.
type CheckoutSessionLineItemAdjustableQuantityParams struct {
Enabled *bool `form:"enabled"`
Maximum *int64 `form:"maximum"`
Minimum *int64 `form:"minimum"`
}
// CheckoutSessionLineItemPriceDataProductDataParams is the set of parameters that can be used when
// creating a product created inline for a line item.
type CheckoutSessionLineItemPriceDataProductDataParams struct {
Description *string `form:"description"`
Images []*string `form:"images"`
Metadata map[string]string `form:"metadata"`
Name *string `form:"name"`
TaxCode *string `form:"tax_code"`
}
// CheckoutSessionLineItemPriceDataRecurringParams is the set of parameters for the recurring
// components of a price created inline for a line item.
type CheckoutSessionLineItemPriceDataRecurringParams struct {
AggregateUsage *string `form:"aggregate_usage"`
Interval *string `form:"interval"`
IntervalCount *int64 `form:"interval_count"`
TrialPeriodDays *int64 `form:"trial_period_days"`
UsageType *string `form:"usage_type"`
}
// CheckoutSessionLineItemPriceDataParams is a structure representing the parameters to create
// an inline price for a line item.
type CheckoutSessionLineItemPriceDataParams struct {
Currency *string `form:"currency"`
Product *string `form:"product"`
ProductData *CheckoutSessionLineItemPriceDataProductDataParams `form:"product_data"`
Recurring *CheckoutSessionLineItemPriceDataRecurringParams `form:"recurring"`
TaxBehavior *string `form:"tax_behavior"`
UnitAmount *int64 `form:"unit_amount"`
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}
// Configure a Checkout Session that can be used to recover an expired session.
type CheckoutSessionAfterExpirationRecoveryParams struct {
AllowPromotionCodes *bool `form:"allow_promotion_codes"`
Enabled *bool `form:"enabled"`
}
// Configure actions after a Checkout Session has expired.
type CheckoutSessionAfterExpirationParams struct {
Recovery *CheckoutSessionAfterExpirationRecoveryParams `form:"recovery"`
}
// Settings for automatic tax lookup for this session and resulting payments, invoices, and subscriptions.
type CheckoutSessionAutomaticTaxParams struct {
Enabled *bool `form:"enabled"`
}
// Configure fields for the Checkout Session to gather active consent from customers.
type CheckoutSessionConsentCollectionParams struct {
Promotions *string `form:"promotions"`
}
// Controls what fields on Customer can be updated by the Checkout Session. Can only be provided when `customer` is provided.
type CheckoutSessionCustomerUpdateParams struct {
Address *string `form:"address"`
Name *string `form:"name"`
Shipping *string `form:"shipping"`
}
// CheckoutSessionDiscountParams is the set of parameters allowed for discounts on
// a checkout session.
type CheckoutSessionDiscountParams struct {
Coupon *string `form:"coupon"`
PromotionCode *string `form:"promotion_code"`
}
// CheckoutSessionLineItemParams is the set of parameters allowed for a line item
// on a checkout session.
type CheckoutSessionLineItemParams struct {
AdjustableQuantity *CheckoutSessionLineItemAdjustableQuantityParams `form:"adjustable_quantity"`
Amount *int64 `form:"amount"`
Currency *string `form:"currency"`
Description *string `form:"description"`
DynamicTaxRates []*string `form:"dynamic_tax_rates"`
Images []*string `form:"images"`
Name *string `form:"name"`
Price *string `form:"price"`
PriceData *CheckoutSessionLineItemPriceDataParams `form:"price_data"`
Quantity *int64 `form:"quantity"`
TaxRates []*string `form:"tax_rates"`
}
// CheckoutSessionPaymentIntentDataTransferDataParams is the set of parameters allowed for the
// transfer_data hash.
type CheckoutSessionPaymentIntentDataTransferDataParams struct {
Amount *int64 `form:"amount"`
Destination *string `form:"destination"`
}
// CheckoutSessionPaymentIntentDataParams is the set of parameters allowed for the
// payment intent creation on a checkout session.
type CheckoutSessionPaymentIntentDataParams struct {
Params `form:"*"`
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"`
Shipping *ShippingDetailsParams `form:"shipping"`
StatementDescriptor *string `form:"statement_descriptor"`
StatementDescriptorSuffix *string `form:"statement_descriptor_suffix"`
TransferData *CheckoutSessionPaymentIntentDataTransferDataParams `form:"transfer_data"`
TransferGroup *string `form:"transfer_group"`
}
// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams is the set of parameters allowed for mandate_options for acss debit.
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams struct {
CustomMandateURL *string `form:"custom_mandate_url"`
DefaultFor []*string `form:"default_for"`
IntervalDescription *string `form:"interval_description"`
PaymentSchedule *string `form:"payment_schedule"`
TransactionType *string `form:"transaction_type"`
}
// CheckoutSessionPaymentMethodOptionsACSSDebitParams is the set of parameters allowed for acss_debit on payment_method_options.
type CheckoutSessionPaymentMethodOptionsACSSDebitParams struct {
Currency *string `form:"currency"`
MandateOptions *CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams `form:"mandate_options"`
VerificationMethod *string `form:"verification_method"`
}
// CheckoutSessionPaymentMethodOptionsBoletoParams is the set of parameters allowed for boleto on payment_method_options.
type CheckoutSessionPaymentMethodOptionsBoletoParams struct {
ExpiresAfterDays *int64 `form:"expires_after_days"`
}
// CheckoutSessionPaymentMethodOptionsOXXOParams is the set of parameters allowed for oxxo on payment_method_options.
type CheckoutSessionPaymentMethodOptionsOXXOParams struct {
ExpiresAfterDays *int64 `form:"expires_after_days"`
}
// CheckoutSessionPaymentMethodOptionsWechatPayParams is the set of parameters allowed for wechat_pay on payment_method_options.
type CheckoutSessionPaymentMethodOptionsWechatPayParams struct {
AppID *string `form:"app_id"`
Client *string `form:"client"`
}
// CheckoutSessionPaymentMethodOptionsParams is the set of allowed parameters for payment_method_options on a checkout session.
type CheckoutSessionPaymentMethodOptionsParams struct {
ACSSDebit *CheckoutSessionPaymentMethodOptionsACSSDebitParams `form:"acss_debit"`
Boleto *CheckoutSessionPaymentMethodOptionsBoletoParams `form:"boleto"`
OXXO *CheckoutSessionPaymentMethodOptionsOXXOParams `form:"oxxo"`
WechatPay *CheckoutSessionPaymentMethodOptionsWechatPayParams `form:"wechat_pay"`
}
// Controls phone number collection settings for the session.
//
// We recommend that you review your privacy policy and check with your legal contacts
// before using this feature. Learn more about [collecting phone numbers with Checkout](https://stripe.com/docs/payments/checkout/phone-numbers).
type CheckoutSessionPhoneNumberCollectionParams struct {
Enabled *bool `form:"enabled"`
}
// CheckoutSessionSetupIntentDataParams is the set of parameters allowed for the setup intent
// creation on a checkout session.
type CheckoutSessionSetupIntentDataParams struct {
Params `form:"*"`
Description *string `form:"description"`
OnBehalfOf *string `form:"on_behalf_of"`
}
// CheckoutSessionShippingAddressCollectionParams is the set of parameters allowed for the
// shipping address collection.
type CheckoutSessionShippingAddressCollectionParams struct {
AllowedCountries []*string `form:"allowed_countries"`
}
// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
type CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateMaximumParams struct {
Unit *string `form:"unit"`
Value *int64 `form:"value"`
}
// The lower bound of the estimated range. If empty, represents no lower bound.
type CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateMinimumParams struct {
Unit *string `form:"unit"`
Value *int64 `form:"value"`
}
// The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
type CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateParams struct {
Maximum *CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateMaximumParams `form:"maximum"`
Minimum *CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateMinimumParams `form:"minimum"`
}
// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`.
type CheckoutSessionShippingOptionShippingRateDataFixedAmountParams struct {
Amount *int64 `form:"amount"`
Currency *string `form:"currency"`
}
// Parameters to be passed to Shipping Rate creation for this shipping option
type CheckoutSessionShippingOptionShippingRateDataParams struct {
DeliveryEstimate *CheckoutSessionShippingOptionShippingRateDataDeliveryEstimateParams `form:"delivery_estimate"`
DisplayName *string `form:"display_name"`
FixedAmount *CheckoutSessionShippingOptionShippingRateDataFixedAmountParams `form:"fixed_amount"`
Metadata map[string]string `form:"metadata"`
TaxBehavior *string `form:"tax_behavior"`
TaxCode *string `form:"tax_code"`
Type *string `form:"type"`
}
// The shipping rate options to apply to this Session.
type CheckoutSessionShippingOptionParams struct {
ShippingRate *string `form:"shipping_rate"`
ShippingRateData *CheckoutSessionShippingOptionShippingRateDataParams `form:"shipping_rate_data"`
}
// CheckoutSessionSubscriptionDataItemsParams is the set of parameters allowed for one item on a
// checkout session associated with a subscription.
type CheckoutSessionSubscriptionDataItemsParams struct {
Plan *string `form:"plan"`
Quantity *int64 `form:"quantity"`
TaxRates []*string `form:"tax_rates"`
}
// CheckoutSessionSubscriptionDataTransferDataParams is the set of parameters allowed
// for the transfer_data hash.
type CheckoutSessionSubscriptionDataTransferDataParams struct {
AmountPercent *float64 `form:"amount_percent"`
Destination *string `form:"destination"`
}
// CheckoutSessionSubscriptionDataParams is the set of parameters allowed for the subscription
// creation on a checkout session.
type CheckoutSessionSubscriptionDataParams struct {
Params `form:"*"`
ApplicationFeePercent *float64 `form:"application_fee_percent"`
Coupon *string `form:"coupon"`
DefaultTaxRates []*string `form:"default_tax_rates"`
Items []*CheckoutSessionSubscriptionDataItemsParams `form:"items"`
Metadata map[string]string `form:"metadata"`
TransferData *CheckoutSessionSubscriptionDataTransferDataParams `form:"transfer_data"`
TrialEnd *int64 `form:"trial_end"`
TrialFromPlan *bool `form:"trial_from_plan"`
TrialPeriodDays *int64 `form:"trial_period_days"`
}
// Controls tax ID collection settings for the session.
type CheckoutSessionTaxIDCollectionParams struct {
Enabled *bool `form:"enabled"`
}
// CheckoutSessionParams is the set of parameters that can be used when creating
// a checkout session.
// For more details see https://stripe.com/docs/api/checkout/sessions/create
type CheckoutSessionParams struct {
Params `form:"*"`
AfterExpiration *CheckoutSessionAfterExpirationParams `form:"after_expiration"`
AllowPromotionCodes *bool `form:"allow_promotion_codes"`
AutomaticTax *CheckoutSessionAutomaticTaxParams `form:"automatic_tax"`
BillingAddressCollection *string `form:"billing_address_collection"`
CancelURL *string `form:"cancel_url"`
ClientReferenceID *string `form:"client_reference_id"`
ConsentCollection *CheckoutSessionConsentCollectionParams `form:"consent_collection"`
Customer *string `form:"customer"`
CustomerEmail *string `form:"customer_email"`
CustomerUpdate *CheckoutSessionCustomerUpdateParams `form:"customer_update"`
Discounts []*CheckoutSessionDiscountParams `form:"discounts"`
ExpiresAt *int64 `form:"expires_at"`
LineItems []*CheckoutSessionLineItemParams `form:"line_items"`
Locale *string `form:"locale"`
Mode *string `form:"mode"`
PaymentIntentData *CheckoutSessionPaymentIntentDataParams `form:"payment_intent_data"`
PaymentMethodOptions *CheckoutSessionPaymentMethodOptionsParams `form:"payment_method_options"`
PaymentMethodTypes []*string `form:"payment_method_types"`
PhoneNumberCollection *CheckoutSessionPhoneNumberCollectionParams `form:"phone_number_collection"`
SetupIntentData *CheckoutSessionSetupIntentDataParams `form:"setup_intent_data"`
ShippingAddressCollection *CheckoutSessionShippingAddressCollectionParams `form:"shipping_address_collection"`
ShippingOptions []*CheckoutSessionShippingOptionParams `form:"shipping_options"`
ShippingRates []*string `form:"shipping_rates"`
SubmitType *string `form:"submit_type"`
SubscriptionData *CheckoutSessionSubscriptionDataParams `form:"subscription_data"`
SuccessURL *string `form:"success_url"`
TaxIDCollection *CheckoutSessionTaxIDCollectionParams `form:"tax_id_collection"`
}
// A Session can be expired when it is in one of these statuses: open
//
// After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired.
type CheckoutSessionExpireParams struct {
Params `form:"*"`
}
// CheckoutSessionListLineItemsParams is the set of parameters that can be
// used when listing line items on a session.
type CheckoutSessionListLineItemsParams struct {
ListParams `form:"*"`
Session *string `form:"-"` // Included in URL
}
// CheckoutSessionListParams is the set of parameters that can be
// used when listing sessions.
// For more details see: https://stripe.com/docs/api/checkout/sessions/list
type CheckoutSessionListParams struct {
ListParams `form:"*"`
PaymentIntent *string `form:"payment_intent"`
Subscription *string `form:"subscription"`
}
// When set, configuration used to recover the Checkout Session on expiry.
type CheckoutSessionAfterExpirationRecovery struct {
AllowPromotionCodes bool `json:"allow_promotion_codes"`
Enabled bool `json:"enabled"`
ExpiresAt int64 `json:"expires_at"`
URL string `json:"url"`
}
// When set, provides configuration for actions to take if this Checkout Session expires.
type CheckoutSessionAfterExpiration struct {
Recovery *CheckoutSessionAfterExpirationRecovery `json:"recovery"`
}
type CheckoutSessionAutomaticTax struct {
Enabled bool `json:"enabled"`
Status CheckoutSessionAutomaticTaxStatus `json:"status"`
}
// Results of `consent_collection` for this session.
type CheckoutSessionConsent struct {
Promotions CheckoutSessionConsentPromotions `json:"promotions"`
}
// When set, provides configuration for the Checkout Session to gather active consent from customers.
type CheckoutSessionConsentCollection struct {
Promotions CheckoutSessionConsentCollectionPromotions `json:"promotions"`
}
// CheckoutSessionCustomerDetailsTaxIDs represent customer's tax IDs at the
// time of checkout.
type CheckoutSessionCustomerDetailsTaxIDs struct {
Type CheckoutSessionCustomerDetailsTaxIDsType `json:"type"`
Value string `json:"value"`
}
// CheckoutSessionCustomerDetails represent the customer details including
// the tax exempt status and the customer's tax IDs.
type CheckoutSessionCustomerDetails struct {
Email string `json:"email"`
Phone string `json:"phone"`
TaxExempt CheckoutSessionCustomerDetailsTaxExempt `json:"tax_exempt"`
TaxIDs []*CheckoutSessionCustomerDetailsTaxIDs `json:"tax_ids"`
}
// CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions represent mandate options for acss debit.
type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions struct {
CustomMandateURL string `json:"custom_mandate_url"`
DefaultFor []CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsDefaultFor `json:"default_for"`
IntervalDescription string `json:"interval_description"`
PaymentSchedule CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsPaymentSchedule `json:"payment_schedule"`
TransactionType CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsTransactionType `json:"transaction_type"`
}
// CheckoutSessionPaymentMethodOptionsACSSDebit represent the options for acss debit on payment_method_options.
type CheckoutSessionPaymentMethodOptionsACSSDebit struct {
Currency string `json:"currency"`
MandateOptions *CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptions `json:"mandate_options"`
VerificationMethod CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod `json:"verification_method"`
}
// CheckoutSessionPaymentMethodOptionsBoleto represent the options for boleto on payment_method_options.
type CheckoutSessionPaymentMethodOptionsBoleto struct {
ExpiresAfterDays int64 `json:"expires_after_days"`
}
// CheckoutSessionPaymentMethodOptionsOXXO represent the options for oxxo on payment_method_options.
type CheckoutSessionPaymentMethodOptionsOXXO struct {
ExpiresAfterDays int64 `json:"expires_after_days"`
}
// CheckoutSessionPaymentMethodOptions represent payment-method-specific options for a checkout session.
type CheckoutSessionPaymentMethodOptions struct {
ACSSDebit *CheckoutSessionPaymentMethodOptionsACSSDebit `json:"acss_debit"`
Boleto *CheckoutSessionPaymentMethodOptionsBoleto `json:"boleto"`
OXXO *CheckoutSessionPaymentMethodOptionsOXXO `json:"oxxo"`
}
type CheckoutSessionPhoneNumberCollection struct {
Enabled bool `json:"enabled"`
}
// CheckoutSessionShippingAddressCollection is the set of parameters allowed for the
// shipping address collection.
type CheckoutSessionShippingAddressCollection struct {
AllowedCountries []string `json:"allowed_countries"`
}
// The shipping rate options applied to this Session.
type CheckoutSessionShippingOption struct {
ShippingAmount int64 `json:"shipping_amount"`
ShippingRate *ShippingRate `json:"shipping_rate"`
}
type CheckoutSessionTaxIDCollection struct {
Enabled bool `json:"enabled"`
}
// CheckoutSessionTotalDetailsBreakdownDiscount represent the details of one discount applied to a session.
type CheckoutSessionTotalDetailsBreakdownDiscount struct {
Amount int64 `json:"amount"`
Discount *Discount `json:"discount"`
}
// CheckoutSessionTotalDetailsBreakdownTax represent the details of tax rate applied to a session.
type CheckoutSessionTotalDetailsBreakdownTax struct {
Amount int64 `json:"amount"`
Rate *TaxRate `json:"rate"`
TaxRate *TaxRate `json:"tax_rate"` // Do not use: use `Rate`
}
// CheckoutSessionTotalDetailsBreakdown is the set of properties detailing a breakdown of taxes and discounts applied to a session if any.
type CheckoutSessionTotalDetailsBreakdown struct {
Discounts []*CheckoutSessionTotalDetailsBreakdownDiscount `json:"discounts"`
Taxes []*CheckoutSessionTotalDetailsBreakdownTax `json:"taxes"`
}
// CheckoutSessionTotalDetails is the set of properties detailing how the amounts were calculated.
type CheckoutSessionTotalDetails struct {
AmountDiscount int64 `json:"amount_discount"`
AmountShipping int64 `json:"amount_shipping"`
AmountTax int64 `json:"amount_tax"`
Breakdown *CheckoutSessionTotalDetailsBreakdown `json:"breakdown"`
}
// CheckoutSession is the resource representing a Stripe checkout session.
// For more details see https://stripe.com/docs/api/checkout/sessions/object
type CheckoutSession struct {
APIResource
AfterExpiration *CheckoutSessionAfterExpiration `json:"after_expiration"`
AllowPromotionCodes bool `json:"allow_promotion_codes"`
AmountSubtotal int64 `json:"amount_subtotal"`
AmountTotal int64 `json:"amount_total"`
AutomaticTax *CheckoutSessionAutomaticTax `json:"automatic_tax"`
BillingAddressCollection CheckoutSessionBillingAddressCollection `json:"billing_address_collection"`
CancelURL string `json:"cancel_url"`
ClientReferenceID string `json:"client_reference_id"`
Consent *CheckoutSessionConsent `json:"consent"`
ConsentCollection *CheckoutSessionConsentCollection `json:"consent_collection"`
Currency Currency `json:"currency"`
Customer *Customer `json:"customer"`
CustomerDetails *CheckoutSessionCustomerDetails `json:"customer_details"`
CustomerEmail string `json:"customer_email"`
Deleted bool `json:"deleted"`
ExpiresAt int64 `json:"expires_at"`
ID string `json:"id"`
LineItems *LineItemList `json:"line_items"`
Livemode bool `json:"livemode"`
Locale string `json:"locale"`
Metadata map[string]string `json:"metadata"`
Mode CheckoutSessionMode `json:"mode"`
Object string `json:"object"`
PaymentIntent *PaymentIntent `json:"payment_intent"`
PaymentMethodOptions *CheckoutSessionPaymentMethodOptions `json:"payment_method_options"`
PaymentMethodTypes []string `json:"payment_method_types"`
PaymentStatus CheckoutSessionPaymentStatus `json:"payment_status"`
PhoneNumberCollection *CheckoutSessionPhoneNumberCollection `json:"phone_number_collection"`
RecoveredFrom string `json:"recovered_from"`
SetupIntent *SetupIntent `json:"setup_intent"`
Shipping *ShippingDetails `json:"shipping"`
ShippingAddressCollection *CheckoutSessionShippingAddressCollection `json:"shipping_address_collection"`
ShippingOptions []*CheckoutSessionShippingOption `json:"shipping_options"`
ShippingRate *ShippingRate `json:"shipping_rate"`
Status CheckoutSessionStatus `json:"status"`
SubmitType CheckoutSessionSubmitType `json:"submit_type"`
Subscription *Subscription `json:"subscription"`
SuccessURL string `json:"success_url"`
TaxIDCollection *CheckoutSessionTaxIDCollection `json:"tax_id_collection"`
TotalDetails *CheckoutSessionTotalDetails `json:"total_details"`
URL string `json:"url"`
}
// UnmarshalJSON handles deserialization of a CheckoutSession.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (c *CheckoutSession) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
c.ID = id
return nil
}
type checkoutSession CheckoutSession
var v checkoutSession
if err := json.Unmarshal(data, &v); err != nil {
return err
}
*c = CheckoutSession(v)
return nil
}
// CheckoutSessionList is a list of sessions as retrieved from a list endpoint.
type CheckoutSessionList struct {
APIResource
ListMeta
Data []*CheckoutSession `json:"data"`
}