From b200cf517b46914e9cf49415811d1a7e7b80ba60 Mon Sep 17 00:00:00 2001 From: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com> Date: Tue, 21 Jun 2022 14:40:44 -0700 Subject: [PATCH] API Updates for beta branch (#1480) * Fix test assert to allow beta versions (#1478) * Codegen for openapi v157 (#1477) * Bump version to 72.115.0 * Set version to 72.115.0 to simplify merge * Reset version to 72.115.0-beta.1 * Codegen for openapi v158 Co-authored-by: Kamil Pajdzik <99290280+kamil-stripe@users.noreply.github.com> Co-authored-by: Kamil Pajdzik --- CHANGELOG.md | 21 ++++++----- OPENAPI_VERSION | 2 +- account.go | 32 ++++++++++++++++ charge.go | 5 +++ checkout_session.go | 8 ++++ client/api.go | 4 ++ creditnote.go | 6 ++- creditnotelineitem.go | 4 ++ customer.go | 10 ++++- example/generated_examples_test.go | 10 +++++ invoice.go | 23 +++++++++++- invoicelineitem.go | 4 ++ paymentintent.go | 59 ++++++++++++++++++++++++++++++ paymentmethod.go | 16 ++++++-- setupintent.go | 10 +++++ stripe_test.go | 4 +- sub.go | 1 + testhelpers/customer/client.go | 40 ++++++++++++++++++++ testhelpers_customer.go | 17 +++++++++ treasury_creditreversal.go | 2 +- treasury_debitreversal.go | 2 +- treasury_inboundtransfer.go | 4 +- treasury_outboundpayment.go | 4 +- treasury_outboundtransfer.go | 2 +- treasury_transaction.go | 2 +- treasury_transactionentry.go | 2 +- 26 files changed, 266 insertions(+), 28 deletions(-) create mode 100644 testhelpers/customer/client.go create mode 100644 testhelpers_customer.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e8514db0c..68f66cf6b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 72.115.0 - 2022-06-17 +* [#1477](https://github.com/stripe/stripe-go/pull/1477) API Updates + * Add support for `FundCashBalance` test helper method on resource `Customer` + * Add support for `StatementDescriptorPrefixKana` and `StatementDescriptorPrefixKanji` on `AccountSettingsCardPaymentsParams`, `AccountSettingsCardPayments`, and `AccountSettingsPayments` + * Add support for `StatementDescriptorSuffixKana` and `StatementDescriptorSuffixKanji` on `CheckoutSessionPaymentMethodOptionsCardParams`, `CheckoutSessionPaymentMethodOptionsCard`, `PaymentIntentConfirmPaymentMethodOptionsCardParams`, `PaymentIntentPaymentMethodOptionsCardParams`, and `PaymentIntentPaymentMethodOptionsCard` + * Add support for `TotalExcludingTax` on `CreditNote` + * Change type of `CustomerInvoiceSettingsRenderingOptionsParams` from `rendering_options_param` to `emptyStringable(rendering_options_param)` + * Add support for `RenderingOptions` on `CustomerInvoiceSettings` and `Invoice` +* [#1478](https://github.com/stripe/stripe-go/pull/1478) Fix test assert to allow beta versions +* [#1475](https://github.com/stripe/stripe-go/pull/1475) Trigger workflows on beta branches + ## 72.115.0-beta.1 - 2022-06-15 * [#1476](https://github.com/stripe/stripe-go/pull/1476) API Updates for beta branch Add support for NetworkDetails properties on ReceivedCredits/ReceivedDebits resource @@ -41,7 +52,6 @@ * Add support for `HostedInstructionsURL` on `PaymentIntentNextActionDisplayBankTransferInstructions` * Add support for `IDNumberSecondaryProvided` on `Person` * Add support for `CardIssuing` on `TreasuryFinancialAccountFeaturesParams` and `TreasuryFinancialAccountUpdateFeaturesParams` - ## 72.110.0 - 2022-05-23 * [#1465](https://github.com/stripe/stripe-go/pull/1465) API Updates @@ -80,14 +90,12 @@ ## 72.107.0 - 2022-05-11 * [#1459](https://github.com/stripe/stripe-go/pull/1459) API Updates * Add support for `AmountDiscount`, `AmountTax`, and `Product` on `LineItem` - ## 72.106.0 - 2022-05-05 * [#1457](https://github.com/stripe/stripe-go/pull/1457) API Updates * Add support for `DefaultPriceData` on `ProductParams` * Add support for `DefaultPrice` on `ProductParams` and `Product` * Add support for `InstructionsEmail` on `RefundParams` and `Refund` - ## 72.105.0 - 2022-05-05 * [#1455](https://github.com/stripe/stripe-go/pull/1455) API Updates @@ -98,7 +106,6 @@ * [#1454](https://github.com/stripe/stripe-go/pull/1454) API Updates * Add support for `RegisteredAddress` on `AccountIndividualParams`, `PersonParams`, `Person`, `TokenAccountIndividualParams`, and `TokenPersonParams` * Add support for `PaymentMethodData` on `SetupIntentConfirmParams` and `SetupIntentParams` - ## 72.104.0 - 2022-05-03 * [#1453](https://github.com/stripe/stripe-go/pull/1453) API Updates @@ -108,7 +115,6 @@ * Add support for new value `eu_oss_vat` on enums `CheckoutSessionCustomerDetailsTaxIdsType`, `InvoiceCustomerTaxIdsType`, and `TaxIdType` * Add support for `CashBalance` on `Customer` * Add support for `Application` on `Invoice`, `Quote`, `SubscriptionSchedule`, and `Subscription` - ## 72.103.0 - 2022-04-21 * [#1452](https://github.com/stripe/stripe-go/pull/1452) API Updates @@ -220,7 +226,6 @@ * [#1425](https://github.com/stripe/stripe-go/pull/1425) API Updates * Add support for new resources `InvoiceLineProrationDetails` and `InvoiceLineProrationDetailsCreditedItems` * Add support for `ProrationDetails` on `InvoiceLine` - ## 72.90.0 - 2022-03-01 * [#1423](https://github.com/stripe/stripe-go/pull/1423) [#1424](https://github.com/stripe/stripe-go/pull/1424) API Updates @@ -380,7 +385,6 @@ * [#1371](https://github.com/stripe/stripe-go/pull/1371) API Updates * Remove support for `OwnershipDeclarationShownAndSigned` on `TokenAccountParams`. This API was unused. * Add support for `OwnershipDeclarationShownAndSigned` on `TokenAccountCompanyParams` - ## 72.73.0 - 2021-11-01 * [#1368](https://github.com/stripe/stripe-go/pull/1368) API Updates @@ -471,7 +475,6 @@ * Add support for `AfterExpiration`, `ConsentCollection`, and `ExpiresAt` on `CheckoutSessionParams` and `CheckoutSession` * Add support for `Consent` and `RecoveredFrom` on `CheckoutSession` - ## 72.62.0 - 2021-08-27 * [#1329](https://github.com/stripe/stripe-go/pull/1329) API Updates * Add support for `CancellationReason` on `BillingPortalConfigurationFeaturesSubscriptionCancelParams`, `BillingPortalConfigurationFeaturesSubscriptionCancelParams`, and `BillingPortalConfigurationFeaturesSubscriptionCancel` @@ -570,7 +573,6 @@ * Add support for `Object` on `BalanceTransaction` and `Transfer` * Removed a redundant form-encoding conversion for `UpTo` in `PriceTierParams.AppendTo` method - ## 72.48.0 - 2021-06-04 * [#1291](https://github.com/stripe/stripe-go/pull/1291) API Updates * Add new resource `TaxCode`. @@ -2665,3 +2667,4 @@ Version 71 of stripe-go contains some major changes. Many of them are breaking, ## 1.0.0 - 2014-09-22 * Initial version + diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index d377f60ad0..d13b3bd2b4 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v154 \ No newline at end of file +v158 \ No newline at end of file diff --git a/account.go b/account.go index 96ce5e146b..dfb2a399f8 100644 --- a/account.go +++ b/account.go @@ -110,6 +110,16 @@ const ( AccountCapabilitiesPayNowPaymentsPending AccountCapabilitiesPayNowPayments = "pending" ) +// The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. +type AccountCapabilitiesPromptpayPayments string + +// List of values that AccountCapabilitiesPromptpayPayments can take +const ( + AccountCapabilitiesPromptpayPaymentsActive AccountCapabilitiesPromptpayPayments = "active" + AccountCapabilitiesPromptpayPaymentsInactive AccountCapabilitiesPromptpayPayments = "inactive" + AccountCapabilitiesPromptpayPaymentsPending AccountCapabilitiesPromptpayPayments = "pending" +) + // The status of the banking capability, or whether the account can have bank accounts. type AccountCapabilitiesTreasury string @@ -447,6 +457,12 @@ type AccountCapabilitiesPayNowPaymentsParams struct { Requested *bool `form:"requested"` } +// The promptpay_payments capability. +type AccountCapabilitiesPromptpayPaymentsParams struct { + // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. + Requested *bool `form:"requested"` +} + // The sepa_debit_payments capability. type AccountCapabilitiesSEPADebitPaymentsParams struct { // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. @@ -539,6 +555,8 @@ type AccountCapabilitiesParams struct { P24Payments *AccountCapabilitiesP24PaymentsParams `form:"p24_payments"` // The paynow_payments capability. PayNowPayments *AccountCapabilitiesPayNowPaymentsParams `form:"paynow_payments"` + // The promptpay_payments capability. + PromptpayPayments *AccountCapabilitiesPromptpayPaymentsParams `form:"promptpay_payments"` // The sepa_debit_payments capability. SEPADebitPayments *AccountCapabilitiesSEPADebitPaymentsParams `form:"sepa_debit_payments"` // The sofort_payments capability. @@ -749,6 +767,10 @@ type AccountSettingsCardPaymentsParams struct { DeclineOn *AccountDeclineSettingsParams `form:"decline_on"` // The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. StatementDescriptorPrefix *string `form:"statement_descriptor_prefix"` + // The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. + StatementDescriptorPrefixKana *string `form:"statement_descriptor_prefix_kana"` + // The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. + StatementDescriptorPrefixKanji *string `form:"statement_descriptor_prefix_kanji"` } // AccountSettingsDashboardParams represent allowed parameters to configure settings for the @@ -941,6 +963,8 @@ type AccountCapabilities struct { P24Payments AccountCapabilityStatus `json:"p24_payments"` // The status of the paynow payments capability of the account, or whether the account can directly process paynow charges. PayNowPayments AccountCapabilitiesPayNowPayments `json:"paynow_payments"` + // The status of the promptpay payments capability of the account, or whether the account can directly process promptpay charges. + PromptpayPayments AccountCapabilitiesPromptpayPayments `json:"promptpay_payments"` // The status of the SEPA Direct Debits payments capability of the account, or whether the account can directly process SEPA Direct Debits charges. SEPADebitPayments AccountCapabilityStatus `json:"sepa_debit_payments"` // The status of the Sofort payments capability of the account, or whether the account can directly process Sofort charges. @@ -1150,6 +1174,10 @@ type AccountSettingsCardPayments struct { DeclineOn *AccountDeclineOn `json:"decline_on"` // The default text that appears on credit card statements when a charge is made. This field prefixes any dynamic `statement_descriptor` specified on the charge. `statement_descriptor_prefix` is useful for maximizing descriptor space for the dynamic portion. StatementDescriptorPrefix string `json:"statement_descriptor_prefix"` + // The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. + StatementDescriptorPrefixKana string `json:"statement_descriptor_prefix_kana"` + // The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. + StatementDescriptorPrefixKanji string `json:"statement_descriptor_prefix_kanji"` } type AccountSettingsDashboard struct { // The display name for this account. This is used on the Stripe Dashboard to differentiate between accounts. @@ -1164,6 +1192,10 @@ type AccountSettingsPayments struct { StatementDescriptorKana string `json:"statement_descriptor_kana"` // The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only) StatementDescriptorKanji string `json:"statement_descriptor_kanji"` + // The Kana variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kana` specified on the charge. `statement_descriptor_prefix_kana` is useful for maximizing descriptor space for the dynamic portion. + StatementDescriptorPrefixKana string `json:"statement_descriptor_prefix_kana"` + // The Kanji variation of the default text that appears on credit card statements when a charge is made (Japan only). This field prefixes any dynamic `statement_descriptor_suffix_kanji` specified on the charge. `statement_descriptor_prefix_kanji` is useful for maximizing descriptor space for the dynamic portion. + StatementDescriptorPrefixKanji string `json:"statement_descriptor_prefix_kanji"` } type AccountPayoutSchedule struct { // The number of days charges for the account will be held before being paid out. diff --git a/charge.go b/charge.go index f50928121e..c4bd500cb6 100644 --- a/charge.go +++ b/charge.go @@ -782,6 +782,10 @@ type ChargePaymentMethodDetailsPayNow struct { // Reference number associated with this PayNow payment Reference string `json:"reference"` } +type ChargePaymentMethodDetailsPromptpay struct { + // Bill reference generated by PromptPay + Reference string `json:"reference"` +} type ChargePaymentMethodDetailsSepaCreditTransfer struct { // Name of the bank associated with the bank account. BankName string `json:"bank_name"` @@ -877,6 +881,7 @@ type ChargePaymentMethodDetails struct { OXXO *ChargePaymentMethodDetailsOXXO `json:"oxxo"` P24 *ChargePaymentMethodDetailsP24 `json:"p24"` PayNow *ChargePaymentMethodDetailsPayNow `json:"paynow"` + Promptpay *ChargePaymentMethodDetailsPromptpay `json:"promptpay"` SepaCreditTransfer *ChargePaymentMethodDetailsSepaCreditTransfer `json:"sepa_credit_transfer"` SepaDebit *ChargePaymentMethodDetailsSepaDebit `json:"sepa_debit"` Sofort *ChargePaymentMethodDetailsSofort `json:"sofort"` diff --git a/checkout_session.go b/checkout_session.go index 9c7094102f..36d54bddd6 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -821,6 +821,10 @@ type CheckoutSessionPaymentMethodOptionsCardParams struct { // // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). SetupFutureUsage *string `form:"setup_future_usage"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters. + StatementDescriptorSuffixKana *string `form:"statement_descriptor_suffix_kana"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. + StatementDescriptorSuffixKanji *string `form:"statement_descriptor_suffix_kanji"` } // contains details about the EPS payment method options. @@ -1449,6 +1453,10 @@ type CheckoutSessionPaymentMethodOptionsCard struct { // // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). SetupFutureUsage CheckoutSessionPaymentMethodOptionsCardSetupFutureUsage `json:"setup_future_usage"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters. + StatementDescriptorSuffixKana string `json:"statement_descriptor_suffix_kana"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. + StatementDescriptorSuffixKanji string `json:"statement_descriptor_suffix_kanji"` } type CheckoutSessionPaymentMethodOptionsEPS struct { // Indicates that you intend to make future payments with this PaymentIntent's payment method. diff --git a/client/api.go b/client/api.go index e4fdf9d57c..30022197b0 100644 --- a/client/api.go +++ b/client/api.go @@ -88,6 +88,7 @@ import ( terminalconnectiontoken "github.com/stripe/stripe-go/v72/terminal/connectiontoken" terminallocation "github.com/stripe/stripe-go/v72/terminal/location" terminalreader "github.com/stripe/stripe-go/v72/terminal/reader" + testhelperscustomer "github.com/stripe/stripe-go/v72/testhelpers/customer" testhelpersrefund "github.com/stripe/stripe-go/v72/testhelpers/refund" testhelpersterminalreader "github.com/stripe/stripe-go/v72/testhelpers/terminal/reader" testhelperstestclock "github.com/stripe/stripe-go/v72/testhelpers/testclock" @@ -274,6 +275,8 @@ type API struct { TerminalLocations *terminallocation.Client // TerminalReaders is the client used to invoke /terminal/readers APIs. TerminalReaders *terminalreader.Client + // TestHelpersCustomers is the client used to invoke /customers APIs. + TestHelpersCustomers *testhelperscustomer.Client // TestHelpersRefunds is the client used to invoke /refunds APIs. TestHelpersRefunds *testhelpersrefund.Client // TestHelpersTerminalReaders is the client used to invoke /terminal/readers APIs. @@ -413,6 +416,7 @@ func (a *API) Init(key string, backends *stripe.Backends) { a.TerminalConnectionTokens = &terminalconnectiontoken.Client{B: backends.API, Key: key} a.TerminalLocations = &terminallocation.Client{B: backends.API, Key: key} a.TerminalReaders = &terminalreader.Client{B: backends.API, Key: key} + a.TestHelpersCustomers = &testhelperscustomer.Client{B: backends.API, Key: key} a.TestHelpersRefunds = &testhelpersrefund.Client{B: backends.API, Key: key} a.TestHelpersTerminalReaders = &testhelpersterminalreader.Client{B: backends.API, Key: key} a.TestHelpersTestClocks = &testhelperstestclock.Client{B: backends.API, Key: key} diff --git a/creditnote.go b/creditnote.go index bcfdd31408..44d79fa493 100644 --- a/creditnote.go +++ b/creditnote.go @@ -223,12 +223,16 @@ type CreditNote struct { Refund *Refund `json:"refund"` // 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 tax and invoice level discounts. + // The integer amount in %s representing the amount of the credit note, excluding exclusive tax and invoice level discounts. Subtotal int64 `json:"subtotal"` + // The integer amount in %s representing the amount of the credit note, excluding all tax and invoice level discounts. + SubtotalExcludingTax int64 `json:"subtotal_excluding_tax"` // The aggregate amounts calculated per tax rate for all line items. TaxAmounts []*CreditNoteTaxAmount `json:"tax_amounts"` // The integer amount in %s representing the total amount of the credit note, including tax and all discount. Total int64 `json:"total"` + // The integer amount in %s representing the total amount of the credit note, excluding tax, but including discounts. + TotalExcludingTax int64 `json:"total_excluding_tax"` // Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid. Type CreditNoteType `json:"type"` // The time that the credit note was voided. diff --git a/creditnotelineitem.go b/creditnotelineitem.go index 408dec3edc..1fe93f8d68 100644 --- a/creditnotelineitem.go +++ b/creditnotelineitem.go @@ -28,6 +28,8 @@ type CreditNoteLineItemDiscountAmount struct { type CreditNoteLineItem struct { // The integer amount in %s representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts. Amount int64 `json:"amount"` + // The integer amount in %s representing the amount being credited for this line item, excluding all tax and discounts. + AmountExcludingTax int64 `json:"amount_excluding_tax"` // Description of the item being credited. Description string `json:"description"` // The integer amount in %s representing the discount being credited for this line item. @@ -54,6 +56,8 @@ type CreditNoteLineItem struct { UnitAmount int64 `json:"unit_amount"` // Same as `unit_amount`, but contains a decimal value with at most 12 decimal places. UnitAmountDecimal float64 `json:"unit_amount_decimal,string"` + // The amount in %s representing the unit amount being credited for this line item, excluding all tax and discounts. + UnitAmountExcludingTax float64 `json:"unit_amount_excluding_tax,string"` } // CreditNoteLineItemList is a list of CreditNoteLineItems as retrieved from a list endpoint. diff --git a/customer.go b/customer.go index 8005a30462..9e79296119 100644 --- a/customer.go +++ b/customer.go @@ -92,7 +92,7 @@ type CustomerInvoiceCustomFieldParams struct { // Default options for invoice PDF rendering for this customer. type CustomerInvoiceSettingsRenderingOptionsParams struct { - // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. AmountTaxDisplay *string `form:"amount_tax_display"` } @@ -239,6 +239,12 @@ type CustomerInvoiceCustomField struct { Name *string `form:"name"` Value *string `form:"value"` } + +// Default options for invoice PDF rendering for this customer. +type CustomerInvoiceSettingsRenderingOptions struct { + // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + AmountTaxDisplay string `json:"amount_tax_display"` +} type CustomerInvoiceSettings struct { // Default custom fields to be displayed on invoices for this customer. CustomFields []*CustomerInvoiceCustomField `json:"custom_fields"` @@ -246,6 +252,8 @@ type CustomerInvoiceSettings struct { DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"` // Default footer to be displayed on invoices for this customer. Footer string `json:"footer"` + // Default options for invoice PDF rendering for this customer. + RenderingOptions *CustomerInvoiceSettingsRenderingOptions `json:"rendering_options"` } // Mailing and shipping address for the customer. Appears on invoices emailed to this customer. diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index 7c4182a819..a938b63fed 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -59,6 +59,7 @@ import ( terminal_connectiontoken "github.com/stripe/stripe-go/v72/terminal/connectiontoken" terminal_location "github.com/stripe/stripe-go/v72/terminal/location" terminal_reader "github.com/stripe/stripe-go/v72/terminal/reader" + testhelpers_customer "github.com/stripe/stripe-go/v72/testhelpers/customer" testhelpers_refund "github.com/stripe/stripe-go/v72/testhelpers/refund" testhelpers_testclock "github.com/stripe/stripe-go/v72/testhelpers/testclock" testhelpers_treasury_inboundtransfer "github.com/stripe/stripe-go/v72/testhelpers/treasury/inboundtransfer" @@ -445,6 +446,15 @@ func TestCashBalanceUpdate(t *testing.T) { assert.NotNil(t, result) } +func TestTestHelpersCustomerFundCashBalance(t *testing.T) { + params := &stripe.TestHelpersCustomerFundCashBalanceParams{ + Amount: stripe.Int64(30), + Currency: stripe.String(string(stripe.CurrencyEUR)), + } + result, _ := testhelpers_customer.FundCashBalance("cus_123", params) + assert.NotNil(t, result) +} + func TestCustomerList(t *testing.T) { params := &stripe.CustomerListParams{} params.Limit = stripe.Int64(3) diff --git a/invoice.go b/invoice.go index bdfd414566..dc25f27e89 100644 --- a/invoice.go +++ b/invoice.go @@ -123,6 +123,7 @@ const ( InvoicePaymentSettingsPaymentMethodTypeKonbini InvoicePaymentSettingsPaymentMethodType = "konbini" InvoicePaymentSettingsPaymentMethodTypeLink InvoicePaymentSettingsPaymentMethodType = "link" InvoicePaymentSettingsPaymentMethodTypePayNow InvoicePaymentSettingsPaymentMethodType = "paynow" + InvoicePaymentSettingsPaymentMethodTypePromptpay InvoicePaymentSettingsPaymentMethodType = "promptpay" InvoicePaymentSettingsPaymentMethodTypeSepaCreditTransfer InvoicePaymentSettingsPaymentMethodType = "sepa_credit_transfer" InvoicePaymentSettingsPaymentMethodTypeSepaDebit InvoicePaymentSettingsPaymentMethodType = "sepa_debit" InvoicePaymentSettingsPaymentMethodTypeSofort InvoicePaymentSettingsPaymentMethodType = "sofort" @@ -281,6 +282,12 @@ type InvoicePaymentSettingsParams struct { PaymentMethodTypes []*string `form:"payment_method_types"` } +// Options for invoice PDF rendering. +type InvoiceRenderingOptionsParams struct { + // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts. + AmountTaxDisplay *string `form:"amount_tax_display"` +} + // If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. type InvoiceTransferDataParams struct { // The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. @@ -329,6 +336,8 @@ type InvoiceParams struct { PaymentSettings *InvoicePaymentSettingsParams `form:"payment_settings"` // How to handle pending invoice items on invoice creation. One of `include`, `exclude`, or `include_and_require`. `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. `include_and_require` will include any pending invoice items, if no pending invoice items exist then the request will fail. `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. Defaults to `include_and_require` if the parameter is omitted. PendingInvoiceItemsBehavior *string `form:"pending_invoice_items_behavior"` + // Options for invoice PDF rendering. + RenderingOptions *InvoiceRenderingOptionsParams `form:"rendering_options"` // The identifier of the unstarted schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. Schedule *string `form:"schedule"` // Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`. @@ -615,6 +624,12 @@ type InvoicePaymentSettings struct { // The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice). PaymentMethodTypes []InvoicePaymentSettingsPaymentMethodType `json:"payment_method_types"` } + +// Options for invoice PDF rendering. +type InvoiceRenderingOptions struct { + // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. + AmountTaxDisplay string `json:"amount_tax_display"` +} type InvoiceStatusTransitions struct { // The time that the invoice draft was finalized. FinalizedAt int64 `json:"finalized_at"` @@ -811,6 +826,8 @@ type Invoice struct { Quote *Quote `json:"quote"` // This is the transaction number that appears on email receipts sent for this invoice. ReceiptNumber string `json:"receipt_number"` + // Options for invoice PDF rendering. + RenderingOptions *InvoiceRenderingOptions `json:"rendering_options"` // Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. StartingBalance int64 `json:"starting_balance"` // Extra information about an invoice for the customer's credit card statement. @@ -822,8 +839,10 @@ type Invoice struct { Subscription *Subscription `json:"subscription"` // Only set for upcoming invoices that preview prorations. The time used to calculate prorations. SubscriptionProrationDate int64 `json:"subscription_proration_date"` - // Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated + // Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated Subtotal int64 `json:"subtotal"` + // The integer amount in %s representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated + SubtotalExcludingTax int64 `json:"subtotal_excluding_tax"` // The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice. Tax int64 `json:"tax"` // ID of the test clock this invoice belongs to. @@ -833,6 +852,8 @@ type Invoice struct { Total int64 `json:"total"` // The aggregate amounts calculated per discount across all line items. TotalDiscountAmounts []*InvoiceDiscountAmount `json:"total_discount_amounts"` + // The integer amount in %s representing the total amount of the invoice including all discounts but excluding all tax. + TotalExcludingTax int64 `json:"total_excluding_tax"` // The aggregate amounts calculated per tax rate for all line items. TotalTaxAmounts []*InvoiceTaxAmount `json:"total_tax_amounts"` // The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice. diff --git a/invoicelineitem.go b/invoicelineitem.go index da69d2dc7d..82e51d3a2c 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -39,6 +39,8 @@ type InvoiceLineProrationDetails struct { type InvoiceLine struct { // The amount, in %s. Amount int64 `json:"amount"` + // The integer amount in %s representing the amount for this line item, excluding all tax and discounts. + AmountExcludingTax int64 `json:"amount_excluding_tax"` // 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). Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. @@ -81,6 +83,8 @@ type InvoiceLine struct { // A string identifying the type of the source of this line item, either an `invoiceitem` or a `subscription`. Type InvoiceLineType `json:"type"` UnifiedProration bool `json:"unified_proration"` + // The amount in %s representing the unit amount for this line item, excluding all tax and discounts. + UnitAmountExcludingTax float64 `json:"unit_amount_excluding_tax,string"` } // Period is a structure representing a start and end dates. diff --git a/paymentintent.go b/paymentintent.go index 84393ef708..b31aab5dc1 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -525,6 +525,18 @@ const ( PaymentIntentPaymentMethodOptionsPayNowSetupFutureUsageNone PaymentIntentPaymentMethodOptionsPayNowSetupFutureUsage = "none" ) +// 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. +// +// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). +type PaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage string + +// List of values that PaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage can take +const ( + PaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsageNone PaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage = "none" +) + // 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. @@ -702,6 +714,9 @@ type PaymentIntentPaymentMethodDataLinkParams struct{} // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type PaymentIntentPaymentMethodDataPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type PaymentIntentPaymentMethodDataPromptpayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type PaymentIntentPaymentMethodDataRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -773,6 +788,8 @@ type PaymentIntentPaymentMethodDataParams struct { P24 *PaymentMethodP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *PaymentIntentPaymentMethodDataPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + Promptpay *PaymentIntentPaymentMethodDataPromptpayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentIntentPaymentMethodDataRadarOptionsParams `form:"radar_options"` // If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. @@ -999,6 +1016,10 @@ type PaymentIntentPaymentMethodOptionsCardParams struct { // // If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. SetupFutureUsage *string `form:"setup_future_usage"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters. + StatementDescriptorSuffixKana *string `form:"statement_descriptor_suffix_kana"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. + StatementDescriptorSuffixKanji *string `form:"statement_descriptor_suffix_kanji"` } // If this is a `card_present` PaymentMethod, this sub-hash contains details about the Card Present payment method options. @@ -1203,6 +1224,18 @@ type PaymentIntentPaymentMethodOptionsPayNowParams struct { SetupFutureUsage *string `form:"setup_future_usage"` } +// If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. +type PaymentIntentPaymentMethodOptionsPromptpayParams struct { + // 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. + // + // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + // + // If `setup_future_usage` is already set and you are performing a request using a publishable key, you may only update the value from `on_session` to `off_session`. + SetupFutureUsage *string `form:"setup_future_usage"` +} + // Additional fields for Mandate creation type PaymentIntentPaymentMethodOptionsSepaDebitMandateOptionsParams struct{} @@ -1330,6 +1363,8 @@ type PaymentIntentPaymentMethodOptionsParams struct { P24 *PaymentIntentPaymentMethodOptionsP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this sub-hash contains details about the PayNow payment method options. PayNow *PaymentIntentPaymentMethodOptionsPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this sub-hash contains details about the PromptPay payment method options. + Promptpay *PaymentIntentPaymentMethodOptionsPromptpayParams `form:"promptpay"` // If this is a `sepa_debit` PaymentIntent, this sub-hash contains details about the SEPA Debit payment method options. SepaDebit *PaymentIntentPaymentMethodOptionsSepaDebitParams `form:"sepa_debit"` // If this is a `sofort` PaymentMethod, this sub-hash contains details about the SOFORT payment method options. @@ -1809,6 +1844,16 @@ type PaymentIntentNextActionPayNowDisplayQRCode struct { // The image_url_svg string used to render QR code ImageURLSVG string `json:"image_url_svg"` } +type PaymentIntentNextActionPromptpayDisplayQRCode struct { + // The raw data string used to generate QR code, it should be used together with QR code library. + Data string `json:"data"` + // The URL to the hosted PromptPay instructions page, which allows customers to view the PromptPay QR code. + HostedInstructionsURL string `json:"hosted_instructions_url"` + // ​​The image_url_png string used to render QR code, can be used as + ImageURLPNG string `json:"image_url_png"` + // ​​The image_url_svg string used to render QR code, can be used as + ImageURLSVG string `json:"image_url_svg"` +} type PaymentIntentNextActionRedirectToURL struct { // If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion. ReturnURL string `json:"return_url"` @@ -1866,6 +1911,7 @@ type PaymentIntentNextAction struct { KonbiniDisplayDetails *PaymentIntentNextActionKonbiniDisplayDetails `json:"konbini_display_details"` OXXODisplayDetails *PaymentIntentNextActionOXXODisplayDetails `json:"oxxo_display_details"` PayNowDisplayQRCode *PaymentIntentNextActionPayNowDisplayQRCode `json:"paynow_display_qr_code"` + PromptpayDisplayQRCode *PaymentIntentNextActionPromptpayDisplayQRCode `json:"promptpay_display_qr_code"` RedirectToURL *PaymentIntentNextActionRedirectToURL `json:"redirect_to_url"` // Type of the next action to perform, one of `redirect_to_url`, `use_stripe_sdk`, `alipay_handle_redirect`, `oxxo_display_details`, or `verify_with_microdeposits`. Type PaymentIntentNextActionType `json:"type"` @@ -2028,6 +2074,10 @@ type PaymentIntentPaymentMethodOptionsCard struct { // // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). SetupFutureUsage PaymentIntentPaymentMethodOptionsCardSetupFutureUsage `json:"setup_future_usage"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kana prefix (shortened Kana descriptor) or Kana statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 22 characters. + StatementDescriptorSuffixKana string `json:"statement_descriptor_suffix_kana"` + // Provides information about a card payment that customers see on their statements. Concatenated with the Kanji prefix (shortened Kanji descriptor) or Kanji statement descriptor that's set on the account to form the complete statement descriptor. Maximum 17 characters. On card statements, the *concatenation* of both prefix and suffix (including separators) will appear truncated to 17 characters. + StatementDescriptorSuffixKanji string `json:"statement_descriptor_suffix_kanji"` } // PaymentIntentPaymentMethodOptionsCardPresent is the set of Card Present-specific options associated @@ -2178,6 +2228,14 @@ type PaymentIntentPaymentMethodOptionsPayNow struct { // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). SetupFutureUsage PaymentIntentPaymentMethodOptionsPayNowSetupFutureUsage `json:"setup_future_usage"` } +type PaymentIntentPaymentMethodOptionsPromptpay struct { + // 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. + // + // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + SetupFutureUsage PaymentIntentPaymentMethodOptionsPromptpaySetupFutureUsage `json:"setup_future_usage"` +} type PaymentIntentPaymentMethodOptionsSepaDebitMandateOptions struct{} // PaymentIntentPaymentMethodOptionsSepaDebit is the set of SEPA Debit-specific options associated @@ -2256,6 +2314,7 @@ type PaymentIntentPaymentMethodOptions struct { OXXO *PaymentIntentPaymentMethodOptionsOXXO `json:"oxxo"` P24 *PaymentIntentPaymentMethodOptionsP24 `json:"p24"` PayNow *PaymentIntentPaymentMethodOptionsPayNow `json:"paynow"` + Promptpay *PaymentIntentPaymentMethodOptionsPromptpay `json:"promptpay"` SepaDebit *PaymentIntentPaymentMethodOptionsSepaDebit `json:"sepa_debit"` Sofort *PaymentIntentPaymentMethodOptionsSofort `json:"sofort"` USBankAccount *PaymentIntentPaymentMethodOptionsUSBankAccount `json:"us_bank_account"` diff --git a/paymentmethod.go b/paymentmethod.go index 412e551b7d..918e8a0042 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -89,6 +89,7 @@ const ( PaymentMethodTypeOXXO PaymentMethodType = "oxxo" PaymentMethodTypeP24 PaymentMethodType = "p24" PaymentMethodTypePayNow PaymentMethodType = "paynow" + PaymentMethodTypePromptpay PaymentMethodType = "promptpay" PaymentMethodTypeSepaDebit PaymentMethodType = "sepa_debit" PaymentMethodTypeSofort PaymentMethodType = "sofort" PaymentMethodTypeUSBankAccount PaymentMethodType = "us_bank_account" @@ -258,6 +259,9 @@ type PaymentMethodP24Params struct { // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type PaymentMethodPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type PaymentMethodPromptpayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type PaymentMethodRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -344,6 +348,8 @@ type PaymentMethodParams struct { P24 *PaymentMethodP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *PaymentMethodPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + Promptpay *PaymentMethodPromptpayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentMethodRadarOptionsParams `form:"radar_options"` // This is a legacy parameter that will be removed in the future. It is a hash that does not accept any keys. @@ -584,6 +590,7 @@ type PaymentMethodP24 struct { Bank string `json:"bank"` } type PaymentMethodPayNow struct{} +type PaymentMethodPromptpay struct{} // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type PaymentMethodRadarOptions struct { @@ -683,10 +690,11 @@ type PaymentMethod struct { // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Metadata map[string]string `json:"metadata"` // String representing the object's type. Objects of the same type share the same value. - Object string `json:"object"` - OXXO *PaymentMethodOXXO `json:"oxxo"` - P24 *PaymentMethodP24 `json:"p24"` - PayNow *PaymentMethodPayNow `json:"paynow"` + Object string `json:"object"` + OXXO *PaymentMethodOXXO `json:"oxxo"` + P24 *PaymentMethodP24 `json:"p24"` + PayNow *PaymentMethodPayNow `json:"paynow"` + Promptpay *PaymentMethodPromptpay `json:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentMethodRadarOptions `json:"radar_options"` SepaDebit *PaymentMethodSepaDebit `json:"sepa_debit"` diff --git a/setupintent.go b/setupintent.go index 45911ce9aa..489d9ed5a4 100644 --- a/setupintent.go +++ b/setupintent.go @@ -347,6 +347,9 @@ type SetupIntentPaymentMethodDataP24Params struct { // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type SetupIntentPaymentMethodDataPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type SetupIntentPaymentMethodDataPromptpayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type SetupIntentPaymentMethodDataRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -431,6 +434,8 @@ type SetupIntentPaymentMethodDataParams struct { P24 *SetupIntentPaymentMethodDataP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *SetupIntentPaymentMethodDataPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + Promptpay *SetupIntentPaymentMethodDataPromptpayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *SetupIntentPaymentMethodDataRadarOptionsParams `form:"radar_options"` // If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. @@ -752,6 +757,9 @@ type SetupIntentConfirmPaymentMethodDataP24Params struct { // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. type SetupIntentConfirmPaymentMethodDataPayNowParams struct{} +// If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. +type SetupIntentConfirmPaymentMethodDataPromptpayParams struct{} + // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. type SetupIntentConfirmPaymentMethodDataRadarOptionsParams struct { // A [Radar Session](https://stripe.com/docs/radar/radar-session) is a snapshot of the browser metadata and device details that help Radar make more accurate predictions on your payments. @@ -836,6 +844,8 @@ type SetupIntentConfirmPaymentMethodDataParams struct { P24 *SetupIntentConfirmPaymentMethodDataP24Params `form:"p24"` // If this is a `paynow` PaymentMethod, this hash contains details about the PayNow payment method. PayNow *SetupIntentConfirmPaymentMethodDataPayNowParams `form:"paynow"` + // If this is a `promptpay` PaymentMethod, this hash contains details about the PromptPay payment method. + Promptpay *SetupIntentConfirmPaymentMethodDataPromptpayParams `form:"promptpay"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *SetupIntentConfirmPaymentMethodDataRadarOptionsParams `form:"radar_options"` // If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account. diff --git a/stripe_test.go b/stripe_test.go index 6710e96fa9..ce5345452d 100644 --- a/stripe_test.go +++ b/stripe_test.go @@ -1022,7 +1022,7 @@ func TestUserAgent(t *testing.T) { // We keep out version constant private to the package, so use a regexp // match instead. - expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[1-9][0-9.]+[0-9]$`) + expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[.\-\w\d]+$`) match := expectedPattern.MatchString(req.Header.Get("User-Agent")) assert.True(t, match) @@ -1049,7 +1049,7 @@ func TestUserAgentWithAppInfo(t *testing.T) { // We keep out version constant private to the package, so use a regexp // match instead. - expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[1-9][0-9.]+[0-9] MyAwesomePlugin/1.2.34 \(https://myawesomeplugin.info\)$`) + expectedPattern := regexp.MustCompile(`^Stripe/v1 GoBindings/[.\-\w\d]+ MyAwesomePlugin/1.2.34 \(https://myawesomeplugin.info\)$`) match := expectedPattern.MatchString(req.Header.Get("User-Agent")) assert.True(t, match) diff --git a/sub.go b/sub.go index 8ac1d53ce1..b28880f136 100644 --- a/sub.go +++ b/sub.go @@ -116,6 +116,7 @@ const ( SubscriptionPaymentSettingsPaymentMethodTypeKonbini SubscriptionPaymentSettingsPaymentMethodType = "konbini" SubscriptionPaymentSettingsPaymentMethodTypeLink SubscriptionPaymentSettingsPaymentMethodType = "link" SubscriptionPaymentSettingsPaymentMethodTypePayNow SubscriptionPaymentSettingsPaymentMethodType = "paynow" + SubscriptionPaymentSettingsPaymentMethodTypePromptpay SubscriptionPaymentSettingsPaymentMethodType = "promptpay" SubscriptionPaymentSettingsPaymentMethodTypeSepaCreditTransfer SubscriptionPaymentSettingsPaymentMethodType = "sepa_credit_transfer" SubscriptionPaymentSettingsPaymentMethodTypeSepaDebit SubscriptionPaymentSettingsPaymentMethodType = "sepa_debit" SubscriptionPaymentSettingsPaymentMethodTypeSofort SubscriptionPaymentSettingsPaymentMethodType = "sofort" diff --git a/testhelpers/customer/client.go b/testhelpers/customer/client.go new file mode 100644 index 0000000000..dde5f3b619 --- /dev/null +++ b/testhelpers/customer/client.go @@ -0,0 +1,40 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package customer provides the /customers APIs +package customer + +import ( + "net/http" + + stripe "github.com/stripe/stripe-go/v72" +) + +// Client is used to invoke /customers APIs. +type Client struct { + B stripe.Backend + Key string +} + +// FundCashBalance is the method for the `POST /v1/test_helpers/customers/{customer}/fund_cash_balance` API. +func FundCashBalance(id string, params *stripe.TestHelpersCustomerFundCashBalanceParams) (*stripe.Customer, error) { + return getC().FundCashBalance(id, params) +} + +// FundCashBalance is the method for the `POST /v1/test_helpers/customers/{customer}/fund_cash_balance` API. +func (c Client) FundCashBalance(id string, params *stripe.TestHelpersCustomerFundCashBalanceParams) (*stripe.Customer, error) { + path := stripe.FormatURLPath( + "/v1/test_helpers/customers/%s/fund_cash_balance", + id, + ) + customer := &stripe.Customer{} + err := c.B.Call(http.MethodPost, path, c.Key, params, customer) + return customer, err +} + +func getC() Client { + return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} +} diff --git a/testhelpers_customer.go b/testhelpers_customer.go new file mode 100644 index 0000000000..a1cc2582b9 --- /dev/null +++ b/testhelpers_customer.go @@ -0,0 +1,17 @@ +// +// +// File generated from our OpenAPI spec +// +// + +package stripe + +// Create an incoming testmode bank transfer +type TestHelpersCustomerFundCashBalanceParams struct { + Params `form:"*"` + // Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal) (e.g., 100 cents to charge $1.00 or 100 to charge ¥100, a zero-decimal currency). The minimum amount is $0.50 US or [equivalent in charge currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts). The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99). + Amount *int64 `form:"amount"` + // 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). + Currency *string `form:"currency"` + Reference *string `form:"reference"` +} diff --git a/treasury_creditreversal.go b/treasury_creditreversal.go index 4293204147..edd265b365 100644 --- a/treasury_creditreversal.go +++ b/treasury_creditreversal.go @@ -56,7 +56,7 @@ type TreasuryCreditReversal struct { Currency Currency `json:"currency"` // The FinancialAccount to reverse funds from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_debitreversal.go b/treasury_debitreversal.go index 5f7dd2415d..359299c989 100644 --- a/treasury_debitreversal.go +++ b/treasury_debitreversal.go @@ -64,7 +64,7 @@ type TreasuryDebitReversal struct { Currency Currency `json:"currency"` // The FinancialAccount to reverse funds from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_inboundtransfer.go b/treasury_inboundtransfer.go index 52676f28e5..3647e22399 100644 --- a/treasury_inboundtransfer.go +++ b/treasury_inboundtransfer.go @@ -151,7 +151,7 @@ type TreasuryInboundTransferStatusTransitions struct { SucceededAt int64 `json:"succeeded_at"` } -// Use InboundTransfers to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. +// Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. type TreasuryInboundTransfer struct { APIResource // Amount (in cents) transferred. @@ -168,7 +168,7 @@ type TreasuryInboundTransfer struct { FailureDetails *TreasuryInboundTransferFailureDetails `json:"failure_details"` // The FinancialAccount that received the funds. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index 867ad8fae7..116618c99b 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -257,7 +257,7 @@ type TreasuryOutboundPayment struct { 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). Currency Currency `json:"currency"` - // ID of the customer to whom an OutboundPayment is sent. + // ID of the [customer](https://stripe.com/docs/api/customers) to whom an OutboundPayment is sent. Customer string `json:"customer"` // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` @@ -271,7 +271,7 @@ type TreasuryOutboundPayment struct { ExpectedArrivalDate int64 `json:"expected_arrival_date"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index 9c421d10db..f8f05060fc 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -222,7 +222,7 @@ type TreasuryOutboundTransfer struct { ExpectedArrivalDate int64 `json:"expected_arrival_date"` // The FinancialAccount that funds were pulled from. FinancialAccount string `json:"financial_account"` - // A hosted transaction receipt URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. + // A [hosted transaction receipt](https://stripe.com/docs/treasury/moving-money/regulatory-receipts) URL that is provided when money movement is considered regulated under Stripe's money transmission licenses. HostedRegulatoryReceiptURL string `json:"hosted_regulatory_receipt_url"` // Unique identifier for the object. ID string `json:"id"` diff --git a/treasury_transaction.go b/treasury_transaction.go index 4569120c0f..2b218b129c 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -94,7 +94,7 @@ type TreasuryTransactionFlowDetails struct { CreditReversal *TreasuryCreditReversal `json:"credit_reversal"` // You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. DebitReversal *TreasuryDebitReversal `json:"debit_reversal"` - // Use InboundTransfers to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + // Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. InboundTransfer *TreasuryInboundTransfer `json:"inbound_transfer"` // When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization` // object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index 5b8805e020..b671979852 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -101,7 +101,7 @@ type TreasuryTransactionEntryFlowDetails struct { CreditReversal *TreasuryCreditReversal `json:"credit_reversal"` // You can reverse some [ReceivedDebits](https://stripe.com/docs/api#received_debits) depending on their network and source flow. Reversing a ReceivedDebit leads to the creation of a new object known as a DebitReversal. DebitReversal *TreasuryDebitReversal `json:"debit_reversal"` - // Use InboundTransfers to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + // Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. InboundTransfer *TreasuryInboundTransfer `json:"inbound_transfer"` // When an [issued card](https://stripe.com/docs/issuing) is used to make a purchase, an Issuing `Authorization` // object is created. [Authorizations](https://stripe.com/docs/issuing/purchases/authorizations) must be approved for the