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 #1600

Merged
merged 3 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v219
v223
2 changes: 1 addition & 1 deletion charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ type ChargePaymentMethodDetailsKlarna struct {
// Can be one of `pay_later`, `pay_now`, `pay_with_financing`, or `pay_in_installments`
PaymentMethodCategory ChargePaymentMethodDetailsKlarnaPaymentMethodCategory `json:"payment_method_category"`
// Preferred language of the Klarna authorization page that the customer is redirected to.
// Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `en-IE`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `es-US`, `fr-FR`, `en-FR`, `en-AU`, `en-NZ`, `en-CA`, `fr-CA`, `pl-PL`, `en-PL`, `pt-PT`, `en-PT`, `de-CH`, `fr-CH`, `it-CH`, or `en-CH`
// Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `en-IE`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `es-US`, `fr-FR`, `en-FR`, `cs-CZ`, `en-CZ`, `el-GR`, `en-GR`, `en-AU`, `en-NZ`, `en-CA`, `fr-CA`, `pl-PL`, `en-PL`, `pt-PT`, `en-PT`, `de-CH`, `fr-CH`, `it-CH`, or `en-CH`
PreferredLocale string `json:"preferred_locale"`
}

Expand Down
20 changes: 18 additions & 2 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,8 @@ type CheckoutSessionListParams struct {
CustomerDetails *CheckoutSessionListCustomerDetailsParams `form:"customer_details"`
// Only return the Checkout Session for the PaymentIntent specified.
PaymentIntent *string `form:"payment_intent"`
// Only return the Checkout Sessions for the Payment Link specified.
PaymentLink *string `form:"payment_link"`
// Only return the Checkout Session for the subscription specified.
Subscription *string `form:"subscription"`
}
Expand Down Expand Up @@ -970,7 +972,7 @@ type CheckoutSessionPaymentMethodOptionsCardParams struct {

// Configuration for eu_bank_transfer funding type.
type CheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEUBankTransferParams struct {
// The desired country code of the bank account information. Permitted values include: `DE`, `ES`, `FR`, `IE`, or `NL`.
// The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
Country *string `form:"country"`
}

Expand Down Expand Up @@ -1322,6 +1324,18 @@ type CheckoutSessionSubscriptionDataTransferDataParams struct {
Destination *string `form:"destination"`
}

// Defines how the subscription should behave when the user's free trial ends.
type CheckoutSessionSubscriptionDataTrialSettingsEndBehaviorParams struct {
// Indicates how the subscription should change when the trial ends if the user did not provide a payment method.
MissingPaymentMethod *string `form:"missing_payment_method"`
}

// Settings related to subscription trials.
type CheckoutSessionSubscriptionDataTrialSettingsParams struct {
// Defines how the subscription should behave when the user's free trial ends.
EndBehavior *CheckoutSessionSubscriptionDataTrialSettingsEndBehaviorParams `form:"end_behavior"`
}

// A subset of parameters to be passed to subscription creation for Checkout Sessions in `subscription` mode.
type CheckoutSessionSubscriptionDataParams struct {
// A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. To use an application fee percent, the request must be made on behalf of another account, using the `Stripe-Account` header or an OAuth key. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
Expand Down Expand Up @@ -1351,6 +1365,8 @@ type CheckoutSessionSubscriptionDataParams struct {
// Integer representing the number of trial period days before the
// customer is charged for the first time. Has to be at least 1.
TrialPeriodDays *int64 `form:"trial_period_days"`
// Settings related to subscription trials.
TrialSettings *CheckoutSessionSubscriptionDataTrialSettingsParams `form:"trial_settings"`
}

// Controls tax ID collection settings for the session.
Expand Down Expand Up @@ -1715,7 +1731,7 @@ type CheckoutSessionPaymentMethodOptionsCard struct {
StatementDescriptorSuffixKanji string `json:"statement_descriptor_suffix_kanji"`
}
type CheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEUBankTransfer struct {
// The desired country code of the bank account information. Permitted values include: `DE`, `ES`, `FR`, `IE`, or `NL`.
// The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
Country string `json:"country"`
}
type CheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransfer struct {
Expand Down
52 changes: 52 additions & 0 deletions creditnote.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ type CreditNoteLineParams struct {
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}

// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
type CreditNoteShippingCostParams struct {
// The ID of the shipping rate to use for this order.
ShippingRate *string `form:"shipping_rate"`
}

// Issue a credit note to adjust the amount of a finalized invoice. For a status=open invoice, a credit note reduces
// its amount_due. For a status=paid invoice, a credit note does not affect its amount_due. Instead, it can result
// in any combination of the following:
Expand Down Expand Up @@ -89,6 +95,8 @@ type CreditNoteParams struct {
Refund *string `form:"refund"`
// The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
RefundAmount *int64 `form:"refund_amount"`
// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
ShippingCost *CreditNoteShippingCostParams `form:"shipping_cost"`
}

// Returns a list of credit notes.
Expand Down Expand Up @@ -120,6 +128,12 @@ type CreditNotePreviewLineParams struct {
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}

// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
type CreditNotePreviewShippingCostParams struct {
// The ID of the shipping rate to use for this order.
ShippingRate *string `form:"shipping_rate"`
}

// Get a preview of a credit note without creating it.
type CreditNotePreviewParams struct {
Params `form:"*"`
Expand All @@ -141,6 +155,8 @@ type CreditNotePreviewParams struct {
Refund *string `form:"refund"`
// The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
RefundAmount *int64 `form:"refund_amount"`
// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
ShippingCost *CreditNotePreviewShippingCostParams `form:"shipping_cost"`
}

// Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
Expand Down Expand Up @@ -168,6 +184,12 @@ type CreditNotePreviewLinesLineParams struct {
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}

// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
type CreditNotePreviewLinesShippingCostParams struct {
// The ID of the shipping rate to use for this order.
ShippingRate *string `form:"shipping_rate"`
}

// When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.
type CreditNotePreviewLinesParams struct {
ListParams `form:"*"`
Expand All @@ -189,6 +211,8 @@ type CreditNotePreviewLinesParams struct {
Refund *string `form:"refund"`
// The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
RefundAmount *int64 `form:"refund_amount"`
// When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note.
ShippingCost *CreditNotePreviewLinesShippingCostParams `form:"shipping_cost"`
}

// When retrieving a credit note, you'll get a lines property containing the the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
Expand All @@ -205,6 +229,30 @@ type CreditNoteDiscountAmount struct {
Discount *Discount `json:"discount"`
}

// The taxes applied to the shipping rate.
type CreditNoteShippingCostTax struct {
// Amount of tax applied for this rate.
Amount int64 `json:"amount"`
// Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.
//
// Related guide: [Tax Rates](https://stripe.com/docs/billing/taxes/tax-rates).
Rate *TaxRate `json:"rate"`
}

// The details of the cost of shipping, including the ShippingRate applied to the invoice.
type CreditNoteShippingCost struct {
// Total shipping cost before any taxes are applied.
AmountSubtotal int64 `json:"amount_subtotal"`
// Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0.
AmountTax int64 `json:"amount_tax"`
// Total shipping cost after taxes are applied.
AmountTotal int64 `json:"amount_total"`
// The ID of the ShippingRate for this invoice.
ShippingRate *ShippingRate `json:"shipping_rate"`
// The taxes applied to the shipping rate.
Taxes []*CreditNoteShippingCostTax `json:"taxes"`
}

// The aggregate amounts calculated per tax rate for all line items.
type CreditNoteTaxAmount struct {
// The amount, in %s, of the tax.
Expand All @@ -222,6 +270,8 @@ type CreditNote struct {
APIResource
// The integer amount in %s representing the total amount of the credit note, including tax.
Amount int64 `json:"amount"`
// This is the sum of all the shipping amounts.
AmountShipping int64 `json:"amount_shipping"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
Expand Down Expand Up @@ -258,6 +308,8 @@ type CreditNote struct {
Reason CreditNoteReason `json:"reason"`
// Refund related to this credit note.
Refund *Refund `json:"refund"`
// The details of the cost of shipping, including the ShippingRate applied to the invoice.
ShippingCost *CreditNoteShippingCost `json:"shipping_cost"`
// Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
Status CreditNoteStatus `json:"status"`
// The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
Expand Down
2 changes: 1 addition & 1 deletion customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ type CustomerRetrievePaymentMethodParams struct {

// Configuration for eu_bank_transfer funding type.
type CustomerCreateFundingInstructionsBankTransferEUBankTransferParams struct {
// The desired country code of the bank account information. Permitted values include: `DE`, `ES`, `FR`, `IE`, or `NL`.
// The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
Country *string `form:"country"`
}

Expand Down
1 change: 1 addition & 0 deletions customercashbalancetransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type CustomerCashBalanceTransactionType string
const (
CustomerCashBalanceTransactionTypeAppliedToPayment CustomerCashBalanceTransactionType = "applied_to_payment"
CustomerCashBalanceTransactionTypeFunded CustomerCashBalanceTransactionType = "funded"
CustomerCashBalanceTransactionTypeFundingReversed CustomerCashBalanceTransactionType = "funding_reversed"
richardm-stripe marked this conversation as resolved.
Show resolved Hide resolved
CustomerCashBalanceTransactionTypeRefundedFromPayment CustomerCashBalanceTransactionType = "refunded_from_payment"
CustomerCashBalanceTransactionTypeReturnCanceled CustomerCashBalanceTransactionType = "return_canceled"
CustomerCashBalanceTransactionTypeReturnInitiated CustomerCashBalanceTransactionType = "return_initiated"
Expand Down
9 changes: 9 additions & 0 deletions example/generated_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,15 @@ func TestCapabilityUpdate(t *testing.T) {
assert.NotNil(t, result)
}

func TestSubscriptionResume(t *testing.T) {
params := &stripe.SubscriptionResumeParams{
ProrationDate: stripe.Int64(1675400000),
ProrationBehavior: stripe.String("always_invoice"),
}
result, _ := subscription.Resume("sub_xxxxxxxxxxxxx", params)
assert.NotNil(t, result)
}

func TestPersonList(t *testing.T) {
params := &stripe.PersonListParams{
Account: stripe.String("acct_xxxxxxxxxxxxx"),
Expand Down
Loading