Class: Stripe::PaymentIntent
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::PaymentIntent
- Extended by:
- APIOperations::Create, APIOperations::List, APIOperations::NestedResource, APIOperations::Search
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/payment_intent.rb
Overview
A PaymentIntent guides you through the process of collecting a payment from your customer. We recommend that you create exactly one PaymentIntent for each order or customer session in your system. You can reference the PaymentIntent later to see the history of payment attempts for a particular session.
A PaymentIntent transitions through multiple statuses throughout its lifetime as it interfaces with Stripe.js to perform authentication flows and ultimately creates at most one successful charge.
Related guide: Payment Intents API
Defined Under Namespace
Classes: AmountDetails, AutomaticPaymentMethods, Hooks, LastPaymentError, ManagedPayments, NextAction, PaymentDetails, PaymentMethodConfigurationDetails, PaymentMethodOptions, PresentmentDetails, Processing, Shipping, TransferData
Constant Summary collapse
- OBJECT_NAME =
"payment_intent"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Amount intended to be collected by this PaymentIntent.
-
#amount_capturable ⇒ Object
readonly
Amount that can be captured from this PaymentIntent.
-
#amount_details ⇒ Object
readonly
Attribute for field amount_details.
-
#amount_received ⇒ Object
readonly
Amount that this PaymentIntent collects.
-
#application ⇒ Object
readonly
ID of the Connect application that created the PaymentIntent.
-
#application_fee_amount ⇒ Object
readonly
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.
-
#automatic_payment_methods ⇒ Object
readonly
Settings to configure compatible payment methods from the Stripe Dashboard.
-
#canceled_at ⇒ Object
readonly
Populated when
statusiscanceled, this is the time at which the PaymentIntent was canceled. -
#cancellation_reason ⇒ Object
readonly
Reason for cancellation of this PaymentIntent, either user-provided (
duplicate,fraudulent,requested_by_customer, orabandoned) or generated by Stripe internally (failed_invoice,void_invoice,automatic, orexpired). -
#capture_method ⇒ Object
readonly
Controls when the funds will be captured from the customer's account.
-
#client_secret ⇒ Object
readonly
The client secret of this PaymentIntent.
-
#confirmation_method ⇒ Object
readonly
Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#currency ⇒ Object
readonly
Three-letter ISO currency code, in lowercase.
-
#customer ⇒ Object
readonly
ID of the Customer this PaymentIntent belongs to, if one exists.
-
#customer_account ⇒ Object
readonly
ID of the Account representing the customer that this PaymentIntent belongs to, if one exists.
-
#description ⇒ Object
readonly
An arbitrary string attached to the object.
-
#excluded_payment_method_types ⇒ Object
readonly
The list of payment method types to exclude from use with this payment.
-
#hooks ⇒ Object
readonly
Attribute for field hooks.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#last_payment_error ⇒ Object
readonly
The payment error encountered in the previous PaymentIntent confirmation.
-
#latest_charge ⇒ Object
readonly
ID of the latest Charge object created by this PaymentIntent.
-
#livemode ⇒ Object
readonly
If the object exists in live mode, the value is
true. -
#managed_payments ⇒ Object
readonly
Settings for Managed Payments.
-
#metadata ⇒ Object
readonly
Set of key-value pairs that you can attach to an object.
-
#next_action ⇒ Object
readonly
If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source.
-
#object ⇒ Object
readonly
String representing the object's type.
-
#on_behalf_of ⇒ Object
readonly
You can specify the settlement merchant as the connected account using the
on_behalf_ofattribute on the charge. -
#payment_details ⇒ Object
readonly
Attribute for field payment_details.
-
#payment_method ⇒ Object
readonly
ID of the payment method used in this PaymentIntent.
-
#payment_method_configuration_details ⇒ Object
readonly
Information about the payment method configuration used for this PaymentIntent.
-
#payment_method_options ⇒ Object
readonly
Payment-method-specific configuration for this PaymentIntent.
-
#payment_method_types ⇒ Object
readonly
The list of payment method types (e.g. card) that this PaymentIntent is allowed to use.
-
#presentment_details ⇒ Object
readonly
Attribute for field presentment_details.
-
#processing ⇒ Object
readonly
If present, this property tells you about the processing state of the payment.
-
#receipt_email ⇒ Object
readonly
Email address that the receipt for the resulting payment will be sent to.
-
#review ⇒ Object
readonly
ID of the review associated with this PaymentIntent, if any.
-
#setup_future_usage ⇒ Object
readonly
Indicates that you intend to make future payments with this PaymentIntent's payment method.
-
#shipping ⇒ Object
readonly
Shipping information for this PaymentIntent.
-
#source ⇒ Object
readonly
This is a legacy field that will be removed in the future.
-
#statement_descriptor ⇒ Object
readonly
Text that appears on the customer's statement as the statement descriptor for a non-card charge.
-
#statement_descriptor_suffix ⇒ Object
readonly
Provides information about a card charge.
-
#status ⇒ Object
readonly
Status of this PaymentIntent, one of
requires_payment_method,requires_confirmation,requires_action,processing,requires_capture,canceled, orsucceeded. -
#transfer_data ⇒ Object
readonly
The data that automatically creates a Transfer after the payment finalizes.
-
#transfer_group ⇒ Object
readonly
A string that identifies the resulting payment as part of a group.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.apply_customer_balance(intent, params = {}, opts = {}) ⇒ Object
Manually reconcile the remaining amount for a customer_balance PaymentIntent.
-
.cancel(intent, params = {}, opts = {}) ⇒ Object
You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, in rare cases, processing.
-
.capture(intent, params = {}, opts = {}) ⇒ Object
Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
-
.confirm(intent, params = {}, opts = {}) ⇒ Object
Confirm that your customer intends to pay with current or provided payment method.
-
.create(params = {}, opts = {}) ⇒ Object
Creates a PaymentIntent object.
- .field_remappings ⇒ Object
-
.increment_authorization(intent, params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible PaymentIntent.
- .inner_class_types ⇒ Object
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of PaymentIntents.
- .object_name ⇒ Object
- .search(params = {}, opts = {}) ⇒ Object
- .search_auto_paging_each(params = {}, opts = {}, &blk) ⇒ Object
-
.update(intent, params = {}, opts = {}) ⇒ Object
Updates properties on a PaymentIntent object without confirming.
-
.verify_microdeposits(intent, params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a PaymentIntent object.
Instance Method Summary collapse
-
#apply_customer_balance(params = {}, opts = {}) ⇒ Object
Manually reconcile the remaining amount for a customer_balance PaymentIntent.
-
#cancel(params = {}, opts = {}) ⇒ Object
You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, in rare cases, processing.
-
#capture(params = {}, opts = {}) ⇒ Object
Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
-
#confirm(params = {}, opts = {}) ⇒ Object
Confirm that your customer intends to pay with current or provided payment method.
-
#increment_authorization(params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible PaymentIntent.
-
#verify_microdeposits(params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a PaymentIntent object.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::NestedResource
Methods included from APIOperations::Search
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#amount ⇒ Object (readonly)
Amount intended to be collected by this PaymentIntent. A positive integer representing how much to charge in the smallest currency unit (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. The amount value supports up to eight digits (e.g., a value of 99999999 for a USD charge of $999,999.99).
2937 2938 2939 |
# File 'lib/stripe/resources/payment_intent.rb', line 2937 def amount @amount end |
#amount_capturable ⇒ Object (readonly)
Amount that can be captured from this PaymentIntent.
2939 2940 2941 |
# File 'lib/stripe/resources/payment_intent.rb', line 2939 def amount_capturable @amount_capturable end |
#amount_details ⇒ Object (readonly)
Attribute for field amount_details
2941 2942 2943 |
# File 'lib/stripe/resources/payment_intent.rb', line 2941 def amount_details @amount_details end |
#amount_received ⇒ Object (readonly)
Amount that this PaymentIntent collects.
2943 2944 2945 |
# File 'lib/stripe/resources/payment_intent.rb', line 2943 def amount_received @amount_received end |
#application ⇒ Object (readonly)
ID of the Connect application that created the PaymentIntent.
2945 2946 2947 |
# File 'lib/stripe/resources/payment_intent.rb', line 2945 def application @application end |
#application_fee_amount ⇒ Object (readonly)
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 amount captured. For more information, see the PaymentIntents use case for connected accounts.
2947 2948 2949 |
# File 'lib/stripe/resources/payment_intent.rb', line 2947 def application_fee_amount @application_fee_amount end |
#automatic_payment_methods ⇒ Object (readonly)
Settings to configure compatible payment methods from the Stripe Dashboard
2949 2950 2951 |
# File 'lib/stripe/resources/payment_intent.rb', line 2949 def automatic_payment_methods @automatic_payment_methods end |
#canceled_at ⇒ Object (readonly)
Populated when status is canceled, this is the time at which the PaymentIntent was canceled. Measured in seconds since the Unix epoch.
2951 2952 2953 |
# File 'lib/stripe/resources/payment_intent.rb', line 2951 def canceled_at @canceled_at end |
#cancellation_reason ⇒ Object (readonly)
Reason for cancellation of this PaymentIntent, either user-provided (duplicate, fraudulent, requested_by_customer, or abandoned) or generated by Stripe internally (failed_invoice, void_invoice, automatic, or expired).
2953 2954 2955 |
# File 'lib/stripe/resources/payment_intent.rb', line 2953 def cancellation_reason @cancellation_reason end |
#capture_method ⇒ Object (readonly)
Controls when the funds will be captured from the customer's account.
2955 2956 2957 |
# File 'lib/stripe/resources/payment_intent.rb', line 2955 def capture_method @capture_method end |
#client_secret ⇒ Object (readonly)
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, 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 and learn about how client_secret should be handled.
2961 2962 2963 |
# File 'lib/stripe/resources/payment_intent.rb', line 2961 def client_secret @client_secret end |
#confirmation_method ⇒ Object (readonly)
Describes whether we can confirm this PaymentIntent automatically, or if it requires customer action to confirm the payment.
2963 2964 2965 |
# File 'lib/stripe/resources/payment_intent.rb', line 2963 def confirmation_method @confirmation_method end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
2965 2966 2967 |
# File 'lib/stripe/resources/payment_intent.rb', line 2965 def created @created end |
#currency ⇒ Object (readonly)
Three-letter ISO currency code, in lowercase. Must be a supported currency.
2967 2968 2969 |
# File 'lib/stripe/resources/payment_intent.rb', line 2967 def currency @currency end |
#customer ⇒ Object (readonly)
ID of the Customer this PaymentIntent belongs to, if one exists.
Payment methods attached to other Customers cannot be used with this PaymentIntent.
If setup_future_usage is set and this PaymentIntent's payment method is not card_present, then the payment method attaches to the Customer after the PaymentIntent has been confirmed and any required actions from the user are complete. If the payment method is card_present and isn't a digital wallet, then a generated_card payment method representing the card is created and attached to the Customer instead.
2973 2974 2975 |
# File 'lib/stripe/resources/payment_intent.rb', line 2973 def customer @customer end |
#customer_account ⇒ Object (readonly)
ID of the Account representing the customer that this PaymentIntent belongs to, if one exists.
Payment methods attached to other Accounts cannot be used with this PaymentIntent.
If setup_future_usage is set and this PaymentIntent's payment method is not card_present, then the payment method attaches to the Account after the PaymentIntent has been confirmed and any required actions from the user are complete. If the payment method is card_present and isn't a digital wallet, then a generated_card payment method representing the card is created and attached to the Account instead.
2979 2980 2981 |
# File 'lib/stripe/resources/payment_intent.rb', line 2979 def customer_account @customer_account end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
2981 2982 2983 |
# File 'lib/stripe/resources/payment_intent.rb', line 2981 def description @description end |
#excluded_payment_method_types ⇒ Object (readonly)
The list of payment method types to exclude from use with this payment.
2983 2984 2985 |
# File 'lib/stripe/resources/payment_intent.rb', line 2983 def excluded_payment_method_types @excluded_payment_method_types end |
#hooks ⇒ Object (readonly)
Attribute for field hooks
2985 2986 2987 |
# File 'lib/stripe/resources/payment_intent.rb', line 2985 def hooks @hooks end |
#id ⇒ Object (readonly)
Unique identifier for the object.
2987 2988 2989 |
# File 'lib/stripe/resources/payment_intent.rb', line 2987 def id @id end |
#last_payment_error ⇒ Object (readonly)
The payment error encountered in the previous PaymentIntent confirmation. It will be cleared if the PaymentIntent is later updated for any reason.
2989 2990 2991 |
# File 'lib/stripe/resources/payment_intent.rb', line 2989 def last_payment_error @last_payment_error end |
#latest_charge ⇒ Object (readonly)
ID of the latest Charge object created by this PaymentIntent. This property is null until PaymentIntent confirmation is attempted.
2991 2992 2993 |
# File 'lib/stripe/resources/payment_intent.rb', line 2991 def latest_charge @latest_charge end |
#livemode ⇒ Object (readonly)
If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
2993 2994 2995 |
# File 'lib/stripe/resources/payment_intent.rb', line 2993 def livemode @livemode end |
#managed_payments ⇒ Object (readonly)
Settings for Managed Payments.
2995 2996 2997 |
# File 'lib/stripe/resources/payment_intent.rb', line 2995 def managed_payments @managed_payments end |
#metadata ⇒ Object (readonly)
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Learn more about storing information in metadata.
2997 2998 2999 |
# File 'lib/stripe/resources/payment_intent.rb', line 2997 def @metadata end |
#next_action ⇒ Object (readonly)
If present, this property tells you what actions you need to take in order for your customer to fulfill a payment using the provided source.
2999 3000 3001 |
# File 'lib/stripe/resources/payment_intent.rb', line 2999 def next_action @next_action end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
3001 3002 3003 |
# File 'lib/stripe/resources/payment_intent.rb', line 3001 def object @object end |
#on_behalf_of ⇒ Object (readonly)
You can specify the settlement merchant as the
connected account using the on_behalf_of attribute on the charge. See the PaymentIntents use case for connected accounts for details.
3004 3005 3006 |
# File 'lib/stripe/resources/payment_intent.rb', line 3004 def on_behalf_of @on_behalf_of end |
#payment_details ⇒ Object (readonly)
Attribute for field payment_details
3006 3007 3008 |
# File 'lib/stripe/resources/payment_intent.rb', line 3006 def payment_details @payment_details end |
#payment_method ⇒ Object (readonly)
ID of the payment method used in this PaymentIntent.
3008 3009 3010 |
# File 'lib/stripe/resources/payment_intent.rb', line 3008 def payment_method @payment_method end |
#payment_method_configuration_details ⇒ Object (readonly)
Information about the payment method configuration used for this PaymentIntent.
3010 3011 3012 |
# File 'lib/stripe/resources/payment_intent.rb', line 3010 def payment_method_configuration_details @payment_method_configuration_details end |
#payment_method_options ⇒ Object (readonly)
Payment-method-specific configuration for this PaymentIntent.
3012 3013 3014 |
# File 'lib/stripe/resources/payment_intent.rb', line 3012 def @payment_method_options end |
#payment_method_types ⇒ Object (readonly)
The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. A comprehensive list of valid payment method types can be found here.
3014 3015 3016 |
# File 'lib/stripe/resources/payment_intent.rb', line 3014 def payment_method_types @payment_method_types end |
#presentment_details ⇒ Object (readonly)
Attribute for field presentment_details
3016 3017 3018 |
# File 'lib/stripe/resources/payment_intent.rb', line 3016 def presentment_details @presentment_details end |
#processing ⇒ Object (readonly)
If present, this property tells you about the processing state of the payment.
3018 3019 3020 |
# File 'lib/stripe/resources/payment_intent.rb', line 3018 def processing @processing end |
#receipt_email ⇒ Object (readonly)
Email address that the receipt for the resulting payment will be sent to. If receipt_email is specified for a payment in live mode, a receipt will be sent regardless of your email settings.
3020 3021 3022 |
# File 'lib/stripe/resources/payment_intent.rb', line 3020 def receipt_email @receipt_email end |
#review ⇒ Object (readonly)
ID of the review associated with this PaymentIntent, if any.
3022 3023 3024 |
# File 'lib/stripe/resources/payment_intent.rb', line 3022 def review @review end |
#setup_future_usage ⇒ Object (readonly)
Indicates that you intend to make future payments with this PaymentIntent's payment method.
If you provide a Customer with the PaymentIntent, you can use this parameter to attach the payment method to the Customer after the PaymentIntent is confirmed and the customer completes any required actions. If you don't provide a Customer, you can still attach the payment method to a Customer after the transaction completes.
If the payment method is card_present and isn't a digital wallet, Stripe creates and attaches a generated_card payment method representing the card to the Customer instead.
When processing card payments, Stripe uses setup_future_usage to help you comply with regional legislation and network rules, such as SCA.
3030 3031 3032 |
# File 'lib/stripe/resources/payment_intent.rb', line 3030 def setup_future_usage @setup_future_usage end |
#shipping ⇒ Object (readonly)
Shipping information for this PaymentIntent.
3032 3033 3034 |
# File 'lib/stripe/resources/payment_intent.rb', line 3032 def shipping @shipping end |
#source ⇒ Object (readonly)
This is a legacy field that will be removed in the future. It is the ID of the Source object that is associated with this PaymentIntent, if one was supplied.
3034 3035 3036 |
# File 'lib/stripe/resources/payment_intent.rb', line 3034 def source @source end |
#statement_descriptor ⇒ Object (readonly)
Text that appears on the customer's statement as the statement descriptor for a non-card charge. This value overrides the account's default statement descriptor. For information about requirements, including the 22-character limit, see the Statement Descriptor docs.
Setting this value for a card charge returns an error. For card charges, set the statement_descriptor_suffix instead.
3038 3039 3040 |
# File 'lib/stripe/resources/payment_intent.rb', line 3038 def statement_descriptor @statement_descriptor end |
#statement_descriptor_suffix ⇒ Object (readonly)
Provides information about a card charge. Concatenated to the account's statement descriptor prefix to form the complete statement descriptor that appears on the customer's statement.
3040 3041 3042 |
# File 'lib/stripe/resources/payment_intent.rb', line 3040 def statement_descriptor_suffix @statement_descriptor_suffix end |
#status ⇒ Object (readonly)
Status of this PaymentIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, requires_capture, canceled, or succeeded. Read more about each PaymentIntent status.
3042 3043 3044 |
# File 'lib/stripe/resources/payment_intent.rb', line 3042 def status @status end |
#transfer_data ⇒ Object (readonly)
The data that automatically creates a Transfer after the payment finalizes. Learn more about the use case for connected accounts.
3044 3045 3046 |
# File 'lib/stripe/resources/payment_intent.rb', line 3044 def transfer_data @transfer_data end |
#transfer_group ⇒ Object (readonly)
A string that identifies the resulting payment as part of a group. Learn more about the use case for connected accounts.
3046 3047 3048 |
# File 'lib/stripe/resources/payment_intent.rb', line 3046 def transfer_group @transfer_group end |
Class Method Details
.apply_customer_balance(intent, params = {}, opts = {}) ⇒ Object
Manually reconcile the remaining amount for a customer_balance PaymentIntent.
3059 3060 3061 3062 3063 3064 3065 3066 |
# File 'lib/stripe/resources/payment_intent.rb', line 3059 def self.apply_customer_balance(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.cancel(intent, params = {}, opts = {}) ⇒ Object
You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, in rare cases, processing.
After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
You can directly cancel the PaymentIntent for a Checkout Session only when the PaymentIntent has a status of requires_capture. Otherwise, you must expire the Checkout Session.
3087 3088 3089 3090 3091 3092 3093 3094 |
# File 'lib/stripe/resources/payment_intent.rb', line 3087 def self.cancel(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.capture(intent, params = {}, opts = {}) ⇒ Object
Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
Learn more about separate authorization and capture.
3115 3116 3117 3118 3119 3120 3121 3122 |
# File 'lib/stripe/resources/payment_intent.rb', line 3115 def self.capture(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.confirm(intent, params = {}, opts = {}) ⇒ Object
Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment.
If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, the PaymentIntent transitions to the requires_payment_method status or the canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual).
If the confirmation_method is automatic, payment may be attempted using our client SDKs and the PaymentIntent's client_secret. After next_actions are handled by the client, no additional confirmation is required to complete the payment.
If the confirmation_method is manual, all payment attempts must be initiated using a secret key.
If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt.
There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state.
3193 3194 3195 3196 3197 3198 3199 3200 |
# File 'lib/stripe/resources/payment_intent.rb', line 3193 def self.confirm(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Creates a PaymentIntent object.
After the PaymentIntent is created, attach a payment method and confirm to continue the payment. Learn more about the available payment flows with the Payment Intents API.
When you use confirm=true during creation, it's equivalent to creating and confirming the PaymentIntent in the same call. You can use any parameters available in the confirm API when you supply confirm=true.
3212 3213 3214 |
# File 'lib/stripe/resources/payment_intent.rb', line 3212 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts) end |
.field_remappings ⇒ Object
3354 3355 3356 |
# File 'lib/stripe/resources/payment_intent.rb', line 3354 def self.field_remappings @field_remappings = {} end |
.increment_authorization(intent, params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible PaymentIntent. To be eligible, the PaymentIntent's status must be requires_capture and 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. Similar to the initial authorization, incremental authorizations can 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 returns with the updated amount. If the incremental authorization fails, a card_declined error returns, and no other fields on the PaymentIntent or Charge update. The PaymentIntent object remains capturable for the previously authorized amount.
Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines. After it's captured, a PaymentIntent can no longer be incremented.
Learn more about incremental authorizations.
3273 3274 3275 3276 3277 3278 3279 3280 |
# File 'lib/stripe/resources/payment_intent.rb', line 3273 def self.(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.inner_class_types ⇒ Object
3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 |
# File 'lib/stripe/resources/payment_intent.rb', line 3336 def self.inner_class_types @inner_class_types = { amount_details: AmountDetails, automatic_payment_methods: AutomaticPaymentMethods, hooks: Hooks, last_payment_error: LastPaymentError, managed_payments: ManagedPayments, next_action: NextAction, payment_details: PaymentDetails, payment_method_configuration_details: PaymentMethodConfigurationDetails, payment_method_options: PaymentMethodOptions, presentment_details: PresentmentDetails, processing: Processing, shipping: Shipping, transfer_data: TransferData, } end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of PaymentIntents.
3283 3284 3285 |
# File 'lib/stripe/resources/payment_intent.rb', line 3283 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/payment_intents", params: params, opts: opts) end |
.object_name ⇒ Object
24 25 26 |
# File 'lib/stripe/resources/payment_intent.rb', line 24 def self.object_name "payment_intent" end |
.search(params = {}, opts = {}) ⇒ Object
3287 3288 3289 3290 3291 3292 3293 3294 |
# File 'lib/stripe/resources/payment_intent.rb', line 3287 def self.search(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/payment_intents/search", params: params, opts: opts ) end |
.search_auto_paging_each(params = {}, opts = {}, &blk) ⇒ Object
3296 3297 3298 |
# File 'lib/stripe/resources/payment_intent.rb', line 3296 def self.search_auto_paging_each(params = {}, opts = {}, &blk) search(params, opts).auto_paging_each(&blk) end |
.update(intent, params = {}, opts = {}) ⇒ Object
Updates properties on a PaymentIntent object without confirming.
Depending on which properties you update, you might need to confirm the PaymentIntent again. For example, updating the payment_method always requires you to confirm the PaymentIntent again. If you prefer to update and confirm at the same time, we recommend updating properties through the confirm API instead.
3307 3308 3309 3310 3311 3312 3313 3314 |
# File 'lib/stripe/resources/payment_intent.rb', line 3307 def self.update(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.verify_microdeposits(intent, params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a PaymentIntent object.
3327 3328 3329 3330 3331 3332 3333 3334 |
# File 'lib/stripe/resources/payment_intent.rb', line 3327 def self.verify_microdeposits(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
Instance Method Details
#apply_customer_balance(params = {}, opts = {}) ⇒ Object
Manually reconcile the remaining amount for a customer_balance PaymentIntent.
3049 3050 3051 3052 3053 3054 3055 3056 |
# File 'lib/stripe/resources/payment_intent.rb', line 3049 def apply_customer_balance(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/apply_customer_balance", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#cancel(params = {}, opts = {}) ⇒ Object
You can cancel a PaymentIntent object when it's in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, in rare cases, processing.
After it's canceled, no additional charges are made by the PaymentIntent and any operations on the PaymentIntent fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable is automatically refunded.
You can directly cancel the PaymentIntent for a Checkout Session only when the PaymentIntent has a status of requires_capture. Otherwise, you must expire the Checkout Session.
3073 3074 3075 3076 3077 3078 3079 3080 |
# File 'lib/stripe/resources/payment_intent.rb', line 3073 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/cancel", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#capture(params = {}, opts = {}) ⇒ Object
Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture.
Uncaptured PaymentIntents are cancelled a set number of days (7 by default) after their creation.
Learn more about separate authorization and capture.
3101 3102 3103 3104 3105 3106 3107 3108 |
# File 'lib/stripe/resources/payment_intent.rb', line 3101 def capture(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/capture", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#confirm(params = {}, opts = {}) ⇒ Object
Confirm that your customer intends to pay with current or provided payment method. Upon confirmation, the PaymentIntent will attempt to initiate a payment.
If the selected payment method requires additional authentication steps, the PaymentIntent will transition to the requires_action status and suggest additional actions via next_action. If payment fails, the PaymentIntent transitions to the requires_payment_method status or the canceled status if the confirmation limit is reached. If payment succeeds, the PaymentIntent will transition to the succeeded status (or requires_capture, if capture_method is set to manual).
If the confirmation_method is automatic, payment may be attempted using our client SDKs and the PaymentIntent's client_secret. After next_actions are handled by the client, no additional confirmation is required to complete the payment.
If the confirmation_method is manual, all payment attempts must be initiated using a secret key.
If any actions are required for the payment, the PaymentIntent will return to the requires_confirmation state after those actions are completed. Your server needs to then explicitly re-confirm the PaymentIntent to initiate the next payment attempt.
There is a variable upper limit on how many times a PaymentIntent can be confirmed. After this limit is reached, any further calls to this endpoint will transition the PaymentIntent to the canceled state.
3154 3155 3156 3157 3158 3159 3160 3161 |
# File 'lib/stripe/resources/payment_intent.rb', line 3154 def confirm(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/confirm", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#increment_authorization(params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible PaymentIntent. To be eligible, the PaymentIntent's status must be requires_capture and 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. Similar to the initial authorization, incremental authorizations can 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 returns with the updated amount. If the incremental authorization fails, a card_declined error returns, and no other fields on the PaymentIntent or Charge update. The PaymentIntent object remains capturable for the previously authorized amount.
Each PaymentIntent can have a maximum of 10 incremental authorization attempts, including declines. After it's captured, a PaymentIntent can no longer be incremented.
Learn more about incremental authorizations.
3240 3241 3242 3243 3244 3245 3246 3247 |
# File 'lib/stripe/resources/payment_intent.rb', line 3240 def (params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/increment_authorization", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#verify_microdeposits(params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a PaymentIntent object.
3317 3318 3319 3320 3321 3322 3323 3324 |
# File 'lib/stripe/resources/payment_intent.rb', line 3317 def verify_microdeposits(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |