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 for beta branch #1601

Merged
merged 10 commits into from
Feb 2, 2023
Merged
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 74.7.0 - 2023-02-02
* [#1600](https://github.com/stripe/stripe-go/pull/1600) API Updates
* Add support for `Resume` method on resource `Subscription`
* Add support for `PaymentLink` on `CheckoutSessionListParams`
* Add support for `TrialSettings` on `CheckoutSessionSubscriptionDataParams`, `SubscriptionParams`, and `Subscription`
* Add support for new value `BE` on enums `CheckoutSessionPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransferCountry`, `InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransferCountry`, `PaymentIntentPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransferCountry`, and `SubscriptionPaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEuBankTransferCountry`
* Add support for `ShippingCost` on `CreditNoteParams`, `CreditNotePreviewLinesParams`, `CreditNotePreviewParams`, `CreditNote`, `InvoiceParams`, and `Invoice`
* Add support for `AmountShipping` on `CreditNote` and `Invoice`
* Add support for `ShippingDetails` on `InvoiceParams` and `Invoice`
* Add support for `SubscriptionResumeAt` on `InvoiceUpcomingLinesParams` and `InvoiceUpcomingParams`
* Add support for `InvoiceCreation` on `PaymentLinkParams` and `PaymentLink`
* Add support for new value `paused` on enum `SubscriptionStatus`
* Add support for new value `funding_reversed` on enum `CustomerCashBalanceTransactionType`

* [#1562](https://github.com/stripe/stripe-go/pull/1562) add missing verify with micro-deposits next action

## 74.7.0-beta.2 - 2023-01-26
* [#1598](https://github.com/stripe/stripe-go/pull/1598) API Updates for beta branch
* Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v221
v223
3 changes: 2 additions & 1 deletion balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const (
)

// Retrieves the current account balance, based on the authentication that was used to make the request.
// For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
//
// For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances).
type BalanceParams struct {
Params `form:"*"`
}
Expand Down
31 changes: 31 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,17 @@ const (
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionTransactions CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "transactions"
)

// Data features requested to be retrieved upon account creation.
type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch string

// List of values that CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch can take
const (
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchBalances CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "balances"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchInferredBalances CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "inferred_balances"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchOwnership CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "ownership"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchTransactions CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "transactions"
)

// Indicates that you intend to make future payments with this PaymentIntent's payment method.
//
// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes.
Expand Down Expand Up @@ -591,6 +602,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 @@ -1142,6 +1155,8 @@ type CheckoutSessionPaymentMethodOptionsSofortParams struct {
type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
Permissions []*string `form:"permissions"`
// List of data features that you would like to retrieve upon account creation.
Prefetch []*string `form:"prefetch"`
}

// contains details about the Us Bank Account payment method options.
Expand Down Expand Up @@ -1330,6 +1345,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 @@ -1359,6 +1386,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 @@ -1853,6 +1882,8 @@ type CheckoutSessionPaymentMethodOptionsSofort struct {
type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnections struct {
// The list of permissions to request. The `payment_method` permission must be included.
Permissions []CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission `json:"permissions"`
// Data features requested to be retrieved upon account creation.
Prefetch []CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch `json:"prefetch"`
// For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
ReturnURL string `json:"return_url"`
}
Expand Down
8 changes: 8 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ import (
"github.com/stripe/stripe-go/v74/file"
"github.com/stripe/stripe-go/v74/filelink"
financialconnectionsaccount "github.com/stripe/stripe-go/v74/financialconnections/account"
financialconnectionsinferredbalance "github.com/stripe/stripe-go/v74/financialconnections/inferredbalance"
financialconnectionssession "github.com/stripe/stripe-go/v74/financialconnections/session"
financialconnectionstransaction "github.com/stripe/stripe-go/v74/financialconnections/transaction"
giftcardscard "github.com/stripe/stripe-go/v74/giftcards/card"
giftcardstransaction "github.com/stripe/stripe-go/v74/giftcards/transaction"
identityverificationreport "github.com/stripe/stripe-go/v74/identity/verificationreport"
Expand Down Expand Up @@ -191,8 +193,12 @@ type API struct {
Files *file.Client
// FinancialConnectionsAccounts is the client used to invoke /financial_connections/accounts APIs.
FinancialConnectionsAccounts *financialconnectionsaccount.Client
// FinancialConnectionsInferredBalances is the client used to invoke /financial_connections/accounts/{account}/inferred_balances APIs.
FinancialConnectionsInferredBalances *financialconnectionsinferredbalance.Client
// FinancialConnectionsSessions is the client used to invoke /financial_connections/sessions APIs.
FinancialConnectionsSessions *financialconnectionssession.Client
// FinancialConnectionsTransactions is the client used to invoke /financial_connections/transactions APIs.
FinancialConnectionsTransactions *financialconnectionstransaction.Client
// GiftCardsCards is the client used to invoke /gift_cards/cards APIs.
GiftCardsCards *giftcardscard.Client
// GiftCardsTransactions is the client used to invoke /gift_cards/transactions APIs.
Expand Down Expand Up @@ -399,7 +405,9 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.FileLinks = &filelink.Client{B: backends.API, Key: key}
a.Files = &file.Client{B: backends.Uploads, Key: key}
a.FinancialConnectionsAccounts = &financialconnectionsaccount.Client{B: backends.API, Key: key}
a.FinancialConnectionsInferredBalances = &financialconnectionsinferredbalance.Client{B: backends.API, Key: key}
a.FinancialConnectionsSessions = &financialconnectionssession.Client{B: backends.API, Key: key}
a.FinancialConnectionsTransactions = &financialconnectionstransaction.Client{B: backends.API, Key: key}
a.GiftCardsCards = &giftcardscard.Client{B: backends.API, Key: key}
a.GiftCardsTransactions = &giftcardstransaction.Client{B: backends.API, Key: key}
a.IdentityVerificationReports = &identityverificationreport.Client{B: backends.API, Key: key}
Expand Down
54 changes: 52 additions & 2 deletions creditnote.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,20 @@ 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:
//
//
// Refund: create a new refund (using refund_amount) or link an existing refund (using refund).
// Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
// Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).
//
//
// For post-payment credit notes the sum of the refund, credit and outside of Stripe amounts must equal the credit note total.
//
// You may issue multiple credit notes for an invoice. Each credit note will increment the invoice's pre_payment_credit_notes_amount
Expand All @@ -91,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 @@ -122,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 @@ -143,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 @@ -170,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 @@ -191,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 @@ -207,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 @@ -224,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 @@ -260,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
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"
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