Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1448

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ type ChargePaymentMethodDetailsCardPresent struct {
Funding CardFunding `json:"funding"`
// ID of a card PaymentMethod generated from the card_present PaymentMethod that may be attached to a Customer for future transactions. Only present if it was possible to generate a card PaymentMethod.
GeneratedCard string `json:"generated_card"`
// Whether this [PaymentIntent](https://stripe.com/docs/api/payment_intents) is eligible for incremental authorizations. Request support using [request_incremental_authorization_support] /docs/api/payment_intents/create#create_payment_intent-payment_method_options-card_present-request_incremental_authorization_support.
IncrementalAuthorizationSupported bool `json:"incremental_authorization_supported"`
// The last four digits of the card.
Last4 string `json:"last4"`
// Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
Expand Down
52 changes: 50 additions & 2 deletions paymentintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,8 @@ type PaymentIntentPaymentMethodOptionsCardParams struct {
type PaymentIntentPaymentMethodOptionsCardPresentParams struct {
// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity)
RequestExtendedAuthorization *bool `form:"request_extended_authorization"`
// Request ability to [increment](docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support.
RequestIncrementalAuthorizationSupport *bool `form:"request_incremental_authorization_support"`
}

// If this is a `eps` PaymentMethod, this sub-hash contains details about the EPS payment method options.
Expand Down Expand Up @@ -1289,6 +1291,50 @@ type PaymentIntentCaptureParams struct {
TransferData *PaymentIntentTransferDataParams `form:"transfer_data"`
}

// The parameters used to automatically create a Transfer when the payment is captured.
// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts).
type PaymentIntentIncrementAuthorizationTransferDataParams struct {
// The amount that will be transferred automatically when a charge succeeds.
Amount *int64 `form:"amount"`
}

// Perform an incremental authorization on an eligible
// [PaymentIntent](https://stripe.com/docs/api/payment_intents/object). To be eligible, the
// PaymentIntent's status must be requires_capture and
// [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported)
// must be true.
//
// Incremental authorizations attempt to increase the authorized amount on
// your customer's card to the new, higher amount provided. As with the
// initial authorization, incremental authorizations may be declined. A
// single PaymentIntent can call this endpoint multiple times to further
// increase the authorized amount.
//
// If the incremental authorization succeeds, the PaymentIntent object is
// returned with the updated
// [amount](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-amount).
// If the incremental authorization fails, a
// [card_declined](https://stripe.com/docs/error-codes#card-declined) error is returned, and no
// fields on the PaymentIntent or Charge are updated. The PaymentIntent
// object remains capturable for the previously authorized amount.
//
// Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines.
// Once captured, a PaymentIntent can no longer be incremented.
//
// Learn more about [incremental authorizations](https://stripe.com/docs/terminal/features/incremental-authorizations).
type PaymentIntentIncrementAuthorizationParams struct {
Params `form:"*"`
// The updated total amount you intend to collect from the cardholder. This amount must be greater than the currently authorized amount.
Amount *int64 `form:"amount"`
// The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts).
ApplicationFeeAmount *int64 `form:"application_fee_amount"`
// An arbitrary string attached to the object. Often useful for displaying to users.
Description *string `form:"description"`
// The parameters used to automatically create a Transfer when the payment is captured.
// For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts).
TransferData *PaymentIntentIncrementAuthorizationTransferDataParams `form:"transfer_data"`
}

// Verifies microdeposits on a PaymentIntent object.
type PaymentIntentVerifyMicrodepositsParams struct {
Params `form:"*"`
Expand Down Expand Up @@ -1626,6 +1672,8 @@ type PaymentIntentPaymentMethodOptionsCard struct {
type PaymentIntentPaymentMethodOptionsCardPresent struct {
// Request ability to capture this payment beyond the standard [authorization validity window](https://stripe.com/docs/terminal/features/extended-authorizations#authorization-validity)
RequestExtendedAuthorization bool `json:"request_extended_authorization"`
// Request ability to [increment](docs/terminal/features/incremental-authorizations) this PaymentIntent if the combination of MCC and card brand is eligible. Check [incremental_authorization_supported](https://stripe.com/docs/api/charges/object#charge_object-payment_method_details-card_present-incremental_authorization_supported) in the [Confirm](https://stripe.com/docs/api/payment_intents/confirm) response to verify support.
RequestIncrementalAuthorizationSupport bool `json:"request_incremental_authorization_support"`
}
type PaymentIntentPaymentMethodOptionsEPS struct {
// Indicates that you intend to make future payments with this PaymentIntent's payment method.
Expand Down Expand Up @@ -1866,9 +1914,9 @@ type PaymentIntent struct {
Charges *ChargeList `json:"charges"`
// The client secret of this PaymentIntent. Used for client-side retrieval using a publishable key.
//
// The client secret can be used to complete a payment from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
// The client secret can be used to complete a payment from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
//
// Refer to our docs to [accept a payment](https://stripe.com/docs/payments/accept-a-payment?integration=elements) and learn about how `client_secret` should be handled.
// Refer to our docs to [accept a payment](https://stripe.com/docs/payments/accept-a-payment?ui=elements) and learn about how `client_secret` should be handled.
ClientSecret string `json:"client_secret"`
ConfirmationMethod PaymentIntentConfirmationMethod `json:"confirmation_method"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Expand Down
16 changes: 16 additions & 0 deletions paymentintent/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,22 @@ func (c Client) Confirm(id string, params *stripe.PaymentIntentConfirmParams) (*
return paymentintent, err
}

// IncrementAuthorization is the method for the `POST /v1/payment_intents/{intent}/increment_authorization` API.
func IncrementAuthorization(id string, params *stripe.PaymentIntentIncrementAuthorizationParams) (*stripe.PaymentIntent, error) {
return getC().IncrementAuthorization(id, params)
}

// IncrementAuthorization is the method for the `POST /v1/payment_intents/{intent}/increment_authorization` API.
func (c Client) IncrementAuthorization(id string, params *stripe.PaymentIntentIncrementAuthorizationParams) (*stripe.PaymentIntent, error) {
path := stripe.FormatURLPath(
"/v1/payment_intents/%s/increment_authorization",
id,
)
paymentintent := &stripe.PaymentIntent{}
err := c.B.Call(http.MethodPost, path, c.Key, params, paymentintent)
return paymentintent, err
}

// VerifyMicrodeposits is the method for the `POST /v1/payment_intents/{intent}/verify_microdeposits` API.
func VerifyMicrodeposits(id string, params *stripe.PaymentIntentVerifyMicrodepositsParams) (*stripe.PaymentIntent, error) {
return getC().VerifyMicrodeposits(id, params)
Expand Down
2 changes: 1 addition & 1 deletion paymentmethod.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ type PaymentMethodUSBankAccount struct {
type PaymentMethodWechatPay struct{}

// PaymentMethod objects represent your customer's payment instruments.
// They can be used with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or saved to
// You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to
// Customer objects to store instrument details for future payments.
//
// Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).
Expand Down
2 changes: 1 addition & 1 deletion setupintent.go
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ type SetupIntent struct {
CancellationReason SetupIntentCancellationReason `json:"cancellation_reason"`
// The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.
//
// The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
// The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.
ClientSecret string `json:"client_secret"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
Expand Down