diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index a75e729f5a..b87b42e0c7 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v216 \ No newline at end of file +v217 \ No newline at end of file diff --git a/balance.go b/balance.go index b2e52693fd..66c06a29b1 100644 --- a/balance.go +++ b/balance.go @@ -17,8 +17,7 @@ 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:"*"` } diff --git a/creditnote.go b/creditnote.go index 60d5920f5b..be442a925e 100644 --- a/creditnote.go +++ b/creditnote.go @@ -61,10 +61,12 @@ type CreditNoteLineParams struct { // 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 diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index 8e9d2ab167..3d398b25f0 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -52,6 +52,9 @@ import ( shippingrate "github.com/stripe/stripe-go/v74/shippingrate" sigma_scheduledqueryrun "github.com/stripe/stripe-go/v74/sigma/scheduledqueryrun" source "github.com/stripe/stripe-go/v74/source" + subscription "github.com/stripe/stripe-go/v74/subscription" + subscriptionitem "github.com/stripe/stripe-go/v74/subscriptionitem" + subscriptionschedule "github.com/stripe/stripe-go/v74/subscriptionschedule" taxcode "github.com/stripe/stripe-go/v74/taxcode" taxid "github.com/stripe/stripe-go/v74/taxid" taxrate "github.com/stripe/stripe-go/v74/taxrate" @@ -82,7 +85,6 @@ import ( treasury_transaction "github.com/stripe/stripe-go/v74/treasury/transaction" treasury_transactionentry "github.com/stripe/stripe-go/v74/treasury/transactionentry" usagerecord "github.com/stripe/stripe-go/v74/usagerecord" - usagerecordsummary "github.com/stripe/stripe-go/v74/usagerecordsummary" webhookendpoint "github.com/stripe/stripe-go/v74/webhookendpoint" ) @@ -1988,12 +1990,50 @@ func TestSourceUpdate(t *testing.T) { assert.NotNil(t, result) } -func TestUsageRecordSummaryList(t *testing.T) { - params := &stripe.UsageRecordSummaryListParams{ +func TestSubscriptionItemList(t *testing.T) { + params := &stripe.SubscriptionItemListParams{ + Subscription: stripe.String("sub_xxxxxxxxxxxxx"), + } + result := subscriptionitem.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestSubscriptionItemCreate(t *testing.T) { + params := &stripe.SubscriptionItemParams{ + Subscription: stripe.String("sub_xxxxxxxxxxxxx"), + Price: stripe.String("price_xxxxxxxxxxxxx"), + Quantity: stripe.Int64(2), + } + result, _ := subscriptionitem.New(params) + assert.NotNil(t, result) +} + +func TestSubscriptionItemDelete(t *testing.T) { + params := &stripe.SubscriptionItemParams{} + result, _ := subscriptionitem.Del("si_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionItemRetrieve(t *testing.T) { + params := &stripe.SubscriptionItemParams{} + result, _ := subscriptionitem.Get("si_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionItemUpdate(t *testing.T) { + params := &stripe.SubscriptionItemParams{} + params.AddMetadata("order_id", "6735") + result, _ := subscriptionitem.Update("si_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionItemUsageRecordSummaries(t *testing.T) { + params := &stripe.SubscriptionItemUsageRecordSummariesParams{ SubscriptionItem: stripe.String("si_xxxxxxxxxxxxx"), } params.Limit = stripe.Int64(3) - result := usagerecordsummary.List(params) + result := subscriptionitem.UsageRecordSummaries(params) assert.NotNil(t, result) assert.Nil(t, result.Err()) } @@ -2007,6 +2047,112 @@ func TestUsageRecordCreate(t *testing.T) { assert.NotNil(t, result) } +func TestSubscriptionScheduleList(t *testing.T) { + params := &stripe.SubscriptionScheduleListParams{} + params.Limit = stripe.Int64(3) + result := subscriptionschedule.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestSubscriptionScheduleCreate(t *testing.T) { + params := &stripe.SubscriptionScheduleParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + StartDate: stripe.Int64(1652909005), + EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), + Phases: []*stripe.SubscriptionSchedulePhaseParams{ + &stripe.SubscriptionSchedulePhaseParams{ + Items: []*stripe.SubscriptionSchedulePhaseItemParams{ + &stripe.SubscriptionSchedulePhaseItemParams{ + Price: stripe.String("price_xxxxxxxxxxxxx"), + Quantity: stripe.Int64(1), + }, + }, + Iterations: stripe.Int64(12), + }, + }, + } + result, _ := subscriptionschedule.New(params) + assert.NotNil(t, result) +} + +func TestSubscriptionScheduleRetrieve(t *testing.T) { + params := &stripe.SubscriptionScheduleParams{} + result, _ := subscriptionschedule.Get("sub_sched_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionScheduleUpdate(t *testing.T) { + params := &stripe.SubscriptionScheduleParams{ + EndBehavior: stripe.String(string(stripe.SubscriptionScheduleEndBehaviorRelease)), + } + result, _ := subscriptionschedule.Update("sub_sched_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionScheduleCancel(t *testing.T) { + params := &stripe.SubscriptionScheduleCancelParams{} + result, _ := subscriptionschedule.Cancel("sub_sched_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionScheduleRelease(t *testing.T) { + params := &stripe.SubscriptionScheduleReleaseParams{} + result, _ := subscriptionschedule.Release("sub_sched_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionList(t *testing.T) { + params := &stripe.SubscriptionListParams{} + params.Limit = stripe.Int64(3) + result := subscription.List(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + +func TestSubscriptionCreate(t *testing.T) { + params := &stripe.SubscriptionParams{ + Customer: stripe.String("cus_xxxxxxxxxxxxx"), + Items: []*stripe.SubscriptionItemsParams{ + &stripe.SubscriptionItemsParams{ + Price: stripe.String("price_xxxxxxxxxxxxx"), + }, + }, + } + result, _ := subscription.New(params) + assert.NotNil(t, result) +} + +func TestSubscriptionCancel(t *testing.T) { + params := &stripe.SubscriptionCancelParams{} + result, _ := subscription.Cancel("sub_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionRetrieve(t *testing.T) { + params := &stripe.SubscriptionParams{} + result, _ := subscription.Get("sub_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionUpdate(t *testing.T) { + params := &stripe.SubscriptionParams{} + params.AddMetadata("order_id", "6735") + result, _ := subscription.Update("sub_xxxxxxxxxxxxx", params) + assert.NotNil(t, result) +} + +func TestSubscriptionSearch(t *testing.T) { + params := &stripe.SubscriptionSearchParams{ + SearchParams: stripe.SearchParams{ + Query: "status:'active' AND metadata['order_id']:'6735'", + }, + } + result := subscription.Search(params) + assert.NotNil(t, result) + assert.Nil(t, result.Err()) +} + func TestTaxCodeList(t *testing.T) { params := &stripe.TaxCodeListParams{} params.Limit = stripe.Int64(3) diff --git a/financialconnections_account.go b/financialconnections_account.go index f23e581936..0c7c84b862 100644 --- a/financialconnections_account.go +++ b/financialconnections_account.go @@ -78,16 +78,16 @@ const ( // If `category` is `cash`, one of: // -// - `checking` -// - `savings` -// - `other` +// - `checking` +// - `savings` +// - `other` // // If `category` is `credit`, one of: // -// - `mortgage` -// - `line_of_credit` -// - `credit_card` -// - `other` +// - `mortgage` +// - `line_of_credit` +// - `credit_card` +// - `other` // // If `category` is `investment` or `other`, this will be `other`. type FinancialConnectionsAccountSubcategory string diff --git a/issuing_cardholder.go b/issuing_cardholder.go index 949cf2edf7..6f3a700317 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -169,6 +169,20 @@ type IssuingCardholderCompany struct { TaxIDProvided bool `json:"tax_id_provided"` } +// Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). +type IssuingCardholderIndividualCardIssuingUserTermsAcceptance struct { + // The Unix timestamp marking when the cardholder accepted the Authorized User Terms. + Date int64 `json:"date"` + // The IP address from which the cardholder accepted the Authorized User Terms. + IP string `json:"ip"` + // The user agent of the browser from which the cardholder accepted the Authorized User Terms. + UserAgent string `json:"user_agent"` +} +type IssuingCardholderIndividualCardIssuing struct { + // Information about cardholder acceptance of [Authorized User Terms](https://stripe.com/docs/issuing/cards). + UserTermsAcceptance *IssuingCardholderIndividualCardIssuingUserTermsAcceptance `json:"user_terms_acceptance"` +} + // The date of birth of this cardholder. type IssuingCardholderIndividualDOB struct { // The day of birth, between 1 and 31. @@ -195,6 +209,7 @@ type IssuingCardholderIndividualVerification struct { // Additional information about an `individual` cardholder. type IssuingCardholderIndividual struct { + CardIssuing *IssuingCardholderIndividualCardIssuing `json:"card_issuing"` // The date of birth of this cardholder. DOB *IssuingCardholderIndividualDOB `json:"dob"` // The first name of this cardholder. diff --git a/paymentmethod.go b/paymentmethod.go index 89800b8f6c..ad0a3c6d68 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -529,7 +529,7 @@ type PaymentMethodCardNetworks struct { Preferred PaymentMethodCardNetworksPreferred `json:"preferred"` } -// Contains details on how this Card maybe be used for 3D Secure authentication. +// Contains details on how this Card may be used for 3D Secure authentication. type PaymentMethodCardThreeDSecureUsage struct { // Whether 3D Secure is supported on this card. Supported bool `json:"supported"` @@ -593,7 +593,7 @@ type PaymentMethodCard struct { Last4 string `json:"last4"` // Contains information about card networks that can be used to process the payment. Networks *PaymentMethodCardNetworks `json:"networks"` - // Contains details on how this Card maybe be used for 3D Secure authentication. + // Contains details on how this Card may be used for 3D Secure authentication. ThreeDSecureUsage *PaymentMethodCardThreeDSecureUsage `json:"three_d_secure_usage"` // If this Card is part of a card wallet, this contains the details of the card wallet. Wallet *PaymentMethodCardWallet `json:"wallet"` diff --git a/plan.go b/plan.go index bbf41d12b8..1df6c33820 100644 --- a/plan.go +++ b/plan.go @@ -99,7 +99,7 @@ type PlanProductParams struct { StatementDescriptor *string `form:"statement_descriptor"` // A [tax code](https://stripe.com/docs/tax/tax-categories) ID. TaxCode *string `form:"tax_code"` - // A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. + // A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. UnitLabel *string `form:"unit_label"` } diff --git a/price.go b/price.go index d61741ae61..e25a435d45 100644 --- a/price.go +++ b/price.go @@ -213,7 +213,7 @@ type PriceProductDataParams struct { StatementDescriptor *string `form:"statement_descriptor"` // A [tax code](https://stripe.com/docs/tax/tax-categories) ID. TaxCode *string `form:"tax_code"` - // A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. + // A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. UnitLabel *string `form:"unit_label"` } diff --git a/product.go b/product.go index eed301f55b..f3a05044ef 100644 --- a/product.go +++ b/product.go @@ -150,7 +150,7 @@ type ProductParams struct { TaxCode *string `form:"tax_code"` // The type of the product. Defaults to `service` if not explicitly specified, enabling use of this product with Subscriptions and Plans. Set this parameter to `good` to use this product with Orders and SKUs. On API versions before `2018-02-05`, this field defaults to `good` for compatibility reasons. Type *string `form:"type"` - // A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. May only be set if `type=service`. + // A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. May only be set if `type=service`. UnitLabel *string `form:"unit_label"` // A URL of a publicly-accessible webpage for this product. URL *string `form:"url"` @@ -234,7 +234,7 @@ type Product struct { TaxCode *TaxCode `json:"tax_code"` // The type of the product. The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans. Type ProductType `json:"type"` - // A label that represents units of this product in Stripe and on customers' receipts and invoices. When set, this will be included in associated invoice line item descriptions. + // A label that represents units of this product. When set, this will be included in customers' receipts, invoices, Checkout, and the customer portal. UnitLabel string `json:"unit_label"` // Time at which the object was last updated. Measured in seconds since the Unix epoch. Updated int64 `json:"updated"` diff --git a/reporting_reportrun.go b/reporting_reportrun.go index 692f8dd030..01ab033978 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -7,9 +7,8 @@ package stripe // Status of this report run. This will be `pending` when the run is initially created. -// -// When the run finishes, this will be set to `succeeded` and the `result` field will be populated. -// Rarely, we may encounter an error, at which point this will be set to `failed` and the `error` field will be populated. +// When the run finishes, this will be set to `succeeded` and the `result` field will be populated. +// Rarely, we may encounter an error, at which point this will be set to `failed` and the `error` field will be populated. type ReportingReportRunStatus string // List of values that ReportingReportRunStatus can take