Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1332

Merged
merged 3 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@ const (
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"
)

// CheckoutSessionCustomerDetailsTaxExempt is the list of allowed values for
// tax_exempt inside customer_details of a checkout session.
type CheckoutSessionCustomerDetailsTaxExempt string
Expand Down Expand Up @@ -185,11 +195,27 @@ type CheckoutSessionLineItemPriceDataParams struct {
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"`
Expand Down Expand Up @@ -338,15 +364,18 @@ type CheckoutSessionTaxIDCollectionParams struct {
// 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"`
Expand Down Expand Up @@ -377,11 +406,34 @@ type CheckoutSessionListParams struct {
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 *string `json:"promotions"`
}

// CheckoutSessionCustomerDetailsTaxIDs represent customer's tax IDs at the
// time of checkout.
type CheckoutSessionCustomerDetailsTaxIDs struct {
Expand Down Expand Up @@ -469,18 +521,22 @@ type CheckoutSessionTotalDetails struct {
// 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"`
Expand All @@ -492,6 +548,7 @@ type CheckoutSession struct {
PaymentMethodOptions *CheckoutSessionPaymentMethodOptions `json:"payment_method_options"`
PaymentMethodTypes []string `json:"payment_method_types"`
PaymentStatus CheckoutSessionPaymentStatus `json:"payment_status"`
RecoveredFrom string `json:"recovered_from"`
SetupIntent *SetupIntent `json:"setup_intent"`
Shipping *ShippingDetails `json:"shipping"`
ShippingAddressCollection *CheckoutSessionShippingAddressCollection `json:"shipping_address_collection"`
Expand Down
1 change: 1 addition & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import (
issuingcardholder "github.com/stripe/stripe-go/v72/issuing/cardholder"
issuingdispute "github.com/stripe/stripe-go/v72/issuing/dispute"
issuingtransaction "github.com/stripe/stripe-go/v72/issuing/transaction"
"github.com/stripe/stripe-go/v72/lineitem"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this addition seems incorrect

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, codegen bug I need to fix.

richardm-stripe marked this conversation as resolved.
Show resolved Hide resolved
"github.com/stripe/stripe-go/v72/loginlink"
"github.com/stripe/stripe-go/v72/mandate"
"github.com/stripe/stripe-go/v72/oauth"
Expand Down