Skip to content

Commit

Permalink
API Updates (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcr-stripe authored Jun 1, 2022
1 parent 38b9626 commit 31eae92
Show file tree
Hide file tree
Showing 22 changed files with 188 additions and 77 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v149
v150
20 changes: 18 additions & 2 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ type DestinationParams struct {
Amount *int64 `form:"amount"`
}

// Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information.
type ChargeRadarOptionsParams 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.
Session *string `form:"session"`
}

// An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details.
type ChargeTransferDataParams struct {
// The amount transferred to the destination account, if specified. By default, the entire charge amount is transferred to the destination account.
Expand Down Expand Up @@ -215,7 +221,7 @@ type ChargeParams struct {
// Amount intended to be collected by this payment. 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"`
ApplicationFee *int64 `form:"application_fee"`
// A fee in %s that will be applied to the charge and transferred to the application owner's Stripe account. The request must be made with an OAuth key or the `Stripe-Account` header in order to take an application fee. For more information, see the application fees [documentation](https://stripe.com/docs/connect/direct-charges#collecting-fees).
// A fee in cents (or local equivalent) that will be applied to the charge and transferred to the application owner's Stripe account. The request must be made with an OAuth key or the `Stripe-Account` header in order to take an application fee. For more information, see the application fees [documentation](https://stripe.com/docs/connect/direct-charges#collecting-fees).
ApplicationFeeAmount *int64 `form:"application_fee_amount"`
// Whether to immediately capture the charge. Defaults to `true`. When `false`, the charge issues an authorization (or pre-authorization), and will need to be [captured](https://stripe.com/docs/api#capture_charge) later. Uncaptured charges expire after a set number of days (7 by default). For more information, see the [authorizing charges and settling later](https://stripe.com/docs/charges/placing-a-hold) documentation.
Capture *bool `form:"capture"`
Expand All @@ -232,6 +238,8 @@ type ChargeParams struct {
Level3 *ChargeLevel3Params `form:"level3"`
// The Stripe account ID for which these funds are intended. Automatically set if you use the `destination` parameter. For details, see [Creating Separate Charges and Transfers](https://stripe.com/docs/connect/charges-transfers#on-behalf-of).
OnBehalfOf *string `form:"on_behalf_of"`
// Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information.
RadarOptions *ChargeRadarOptionsParams `form:"radar_options"`
// This is the email address that the receipt for this charge will be sent to. If this field is updated, then a new email receipt will be sent to the updated address.
ReceiptEmail *string `form:"receipt_email"`
// Shipping information for the charge. Helps prevent fraud on charges for physical goods.
Expand Down Expand Up @@ -736,7 +744,7 @@ type ChargePaymentMethodDetailsKlarna struct {
// Can be one of `pay_later`, `pay_now`, `pay_with_financing`, or `pay_in_installments`
PaymentMethodCategory ChargePaymentMethodDetailsKlarnaPaymentMethodCategory `json:"payment_method_category"`
// Preferred language of the Klarna authorization page that the customer is redirected to.
// Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `en-IE`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `es-US`, `fr-FR`, or `en-FR`
// Can be one of `de-AT`, `en-AT`, `nl-BE`, `fr-BE`, `en-BE`, `de-DE`, `en-DE`, `da-DK`, `en-DK`, `es-ES`, `en-ES`, `fi-FI`, `sv-FI`, `en-FI`, `en-GB`, `en-IE`, `it-IT`, `en-IT`, `nl-NL`, `en-NL`, `nb-NO`, `en-NO`, `sv-SE`, `en-SE`, `en-US`, `es-US`, `fr-FR`, `en-FR`, `en-AU`, or `en-NZ`
PreferredLocale string `json:"preferred_locale"`
}

Expand Down Expand Up @@ -882,6 +890,12 @@ type ChargePaymentMethodDetails struct {
WechatPay *ChargePaymentMethodDetailsWechatPay `json:"wechat_pay"`
}

// Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information.
type ChargeRadarOptions 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.
Session string `json:"session"`
}

// An optional dictionary including the account to automatically transfer to as part of a destination charge. [See the Connect documentation](https://stripe.com/docs/connect/destination-charges) for details.
type ChargeTransferData struct {
// The amount transferred to the destination account, if specified. By default, the entire charge amount is transferred to the destination account.
Expand Down Expand Up @@ -965,6 +979,8 @@ type Charge struct {
PaymentMethod string `json:"payment_method"`
// Details about the payment method at the time of the transaction.
PaymentMethodDetails *ChargePaymentMethodDetails `json:"payment_method_details"`
// Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information.
RadarOptions *ChargeRadarOptions `json:"radar_options"`
// This is the email address that the receipt for this charge was sent to.
ReceiptEmail string `json:"receipt_email"`
// This is the transaction number that appears on email receipts sent for this charge. This attribute will be `null` until a receipt has been sent.
Expand Down
4 changes: 2 additions & 2 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ type CheckoutSessionLineItemPriceDataParams struct {
Recurring *CheckoutSessionLineItemPriceDataRecurringParams `form:"recurring"`
// Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
TaxBehavior *string `form:"tax_behavior"`
// A non-negative integer in %s representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required.
// A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required.
UnitAmount *int64 `form:"unit_amount"`
// Same as `unit_amount`, but accepts a decimal value in %s with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}

Expand Down
28 changes: 14 additions & 14 deletions creditnote.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ type CreditNoteLineParams struct {
TaxRates []*string `form:"tax_rates"`
// Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
Type *string `form:"type"`
// The integer unit amount in %s of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
// The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
UnitAmount *int64 `form:"unit_amount"`
// Same as `unit_amount`, but accepts a decimal value in %s with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
}

Expand All @@ -73,23 +73,23 @@ type CreditNoteLineParams struct {
// or post_payment_credit_notes_amount depending on its status at the time of credit note creation.
type CreditNoteParams struct {
Params `form:"*"`
// The integer amount in %s representing the total amount of the credit note.
// The integer amount in cents (or local equivalent) representing the total amount of the credit note.
Amount *int64 `form:"amount"`
// The integer amount in %s representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
// The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
CreditAmount *int64 `form:"credit_amount"`
// ID of the invoice.
Invoice *string `form:"invoice"`
// Line items that make up the credit note.
Lines []*CreditNoteLineParams `form:"lines"`
// Credit note memo.
Memo *string `form:"memo"`
// The integer amount in %s representing the amount that is credited outside of Stripe.
// The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
OutOfBandAmount *int64 `form:"out_of_band_amount"`
// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
Reason *string `form:"reason"`
// ID of an existing refund to link this credit note to.
Refund *string `form:"refund"`
// The integer amount in %s representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
// 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"`
}

Expand All @@ -105,23 +105,23 @@ type CreditNoteListParams struct {
// Get a preview of a credit note without creating it.
type CreditNotePreviewParams struct {
Params `form:"*"`
// The integer amount in %s representing the total amount of the credit note.
// The integer amount in cents (or local equivalent) representing the total amount of the credit note.
Amount *int64 `form:"amount"`
// The integer amount in %s representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
// The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
CreditAmount *int64 `form:"credit_amount"`
// ID of the invoice.
Invoice *string `form:"invoice"`
// Line items that make up the credit note.
Lines []*CreditNoteLineParams `form:"lines"`
// The credit note's memo appears on the credit note PDF.
Memo *string `form:"memo"`
// The integer amount in %s representing the amount that is credited outside of Stripe.
// The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
OutOfBandAmount *int64 `form:"out_of_band_amount"`
// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
Reason *string `form:"reason"`
// ID of an existing refund to link this credit note to.
Refund *string `form:"refund"`
// The integer amount in %s representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
// 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"`
}

Expand All @@ -133,23 +133,23 @@ type CreditNoteVoidParams struct {
// 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 CreditNoteLineItemListPreviewParams struct {
ListParams `form:"*"`
// The integer amount in %s representing the total amount of the credit note.
// The integer amount in cents (or local equivalent) representing the total amount of the credit note.
Amount *int64 `form:"amount"`
// The integer amount in %s representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
// The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
CreditAmount *int64 `form:"credit_amount"`
// ID of the invoice.
Invoice *string `form:"invoice"`
// Line items that make up the credit note.
Lines []*CreditNoteLineParams `form:"lines"`
// The credit note's memo appears on the credit note PDF.
Memo *string `form:"memo"`
// The integer amount in %s representing the amount that is credited outside of Stripe.
// The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
OutOfBandAmount *int64 `form:"out_of_band_amount"`
// Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
Reason *string `form:"reason"`
// ID of an existing refund to link this credit note to.
Refund *string `form:"refund"`
// The integer amount in %s representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
// 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"`
}

Expand Down
2 changes: 1 addition & 1 deletion customer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ type CustomerParams struct {
Params `form:"*"`
// The customer's address.
Address *AddressParams `form:"address"`
// An integer amount in %s that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
// An integer amount in cents (or local equivalent) that represents the customer's current balance, which affect the customer's future invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.
Balance *int64 `form:"balance"`
// Balance information and default balance settings for this customer.
CashBalance *CustomerCashBalanceParams `form:"cash_balance"`
Expand Down
2 changes: 1 addition & 1 deletion customerbalancetransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
type CustomerBalanceTransactionParams struct {
Params `form:"*"`
Customer *string `form:"-"` // Included in URL
// The integer amount in **%s** to apply to the customer's credit balance.
// The integer amount in **cents (or local equivalent)** to apply to the customer's credit balance.
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). If the customer's [`currency`](https://stripe.com/docs/api/customers/object#customer_object-currency) is set, this value must match it. If the customer's `currency` is not set, it will be updated to this value.
Currency *string `form:"currency"`
Expand Down
2 changes: 1 addition & 1 deletion feerefund.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "encoding/json"
type FeeRefundParams struct {
Params `form:"*"`
ApplicationFee *string `form:"-"` // Included in URL
// A positive integer, in _%s_, representing how much of this fee to refund. Can refund only up to the remaining unrefunded amount of the fee.
// A positive integer, in _cents (or local equivalent)_, representing how much of this fee to refund. Can refund only up to the remaining unrefunded amount of the fee.
Amount *int64 `form:"amount"`
}

Expand Down
17 changes: 16 additions & 1 deletion fundinginstructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,22 @@ const (
)

// Zengin Records contain Japan bank account details per the Zengin format.
type FundingInstructionsBankTransferFinancialAddressZengin struct{}
type FundingInstructionsBankTransferFinancialAddressZengin struct {
// The account holder name
AccountHolderName string `json:"account_holder_name"`
// The account number
AccountNumber string `json:"account_number"`
// The bank account type. In Japan, this can only be `futsu` or `toza`.
AccountType string `json:"account_type"`
// The bank code of the account
BankCode string `json:"bank_code"`
// The bank name of the account
BankName string `json:"bank_name"`
// The branch code of the account
BranchCode string `json:"branch_code"`
// The branch name of the account
BranchName string `json:"branch_name"`
}

// A list of financial addresses that can be used to fund a particular balance
type FundingInstructionsBankTransferFinancialAddress struct {
Expand Down
Loading

0 comments on commit 31eae92

Please sign in to comment.