Class: Stripe::PaymentIntent
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::PaymentIntent
- Extended by:
- APIOperations::Create, APIOperations::List, 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](stripe.com/docs/payments/intents#intent-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](stripe.com/docs/payments/payment-intents)
Defined Under Namespace
Classes: AmountDetails, ApplyCustomerBalanceParams, AsyncWorkflows, AutomaticPaymentMethods, CancelParams, CaptureParams, ConfirmParams, CreateParams, DecrementAuthorizationParams, IncrementAuthorizationParams, LastPaymentError, ListParams, NextAction, PaymentDetails, PaymentMethodConfigurationDetails, PaymentMethodOptions, Processing, RetrieveParams, SearchParams, Shipping, TransferData, TriggerActionParams, UpdateParams, VerifyMicrodepositsParams
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.
-
#async_workflows ⇒ Object
readonly
Attribute for field async_workflows.
-
#automatic_payment_methods ⇒ Object
readonly
Settings to configure compatible payment methods from the [Stripe Dashboard](dashboard.stripe.com/settings/payment_methods).
-
#canceled_at ⇒ Object
readonly
Populated when ‘status` is `canceled`, 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`, or `abandoned`) or generated by Stripe internally (`failed_invoice`, `void_invoice`, or `automatic`).
-
#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](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#customer ⇒ Object
readonly
ID of the Customer this PaymentIntent belongs to, if one exists.
-
#description ⇒ Object
readonly
An arbitrary string attached to the object.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#invoice ⇒ Object
readonly
ID of the invoice that created this PaymentIntent, if it exists.
-
#last_payment_error ⇒ Object
readonly
The payment error encountered in the previous PaymentIntent confirmation.
-
#latest_charge ⇒ Object
readonly
ID of the latest [Charge object](stripe.com/docs/api/charges) created by this PaymentIntent.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) 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
The account (if any) for which the funds of the PaymentIntent are intended.
-
#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](stripe.com/docs/api/payment_method_configurations) 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.
-
#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.
-
#secret_key_confirmation ⇒ Object
readonly
Indicates whether confirmation for this PaymentIntent using a secret key is ‘required` or `optional`.
-
#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`, or `succeeded`.
-
#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](stripe.com/docs/payments/intents), 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.
-
.decrement_authorization(intent, params = {}, opts = {}) ⇒ Object
Perform a decremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object).
-
.increment_authorization(intent, params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/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
-
.trigger_action(intent, params = {}, opts = {}) ⇒ Object
Trigger an external action on a PaymentIntent.
-
.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](stripe.com/docs/payments/intents), 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.
-
#decrement_authorization(params = {}, opts = {}) ⇒ Object
Perform a decremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object).
-
#increment_authorization(params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object).
-
#trigger_action(params = {}, opts = {}) ⇒ Object
Trigger an external action on a 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::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
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #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](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](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).
12838 12839 12840 |
# File 'lib/stripe/resources/payment_intent.rb', line 12838 def amount @amount end |
#amount_capturable ⇒ Object (readonly)
Amount that can be captured from this PaymentIntent.
12840 12841 12842 |
# File 'lib/stripe/resources/payment_intent.rb', line 12840 def amount_capturable @amount_capturable end |
#amount_details ⇒ Object (readonly)
Attribute for field amount_details
12842 12843 12844 |
# File 'lib/stripe/resources/payment_intent.rb', line 12842 def amount_details @amount_details end |
#amount_received ⇒ Object (readonly)
Amount that this PaymentIntent collects.
12844 12845 12846 |
# File 'lib/stripe/resources/payment_intent.rb', line 12844 def amount_received @amount_received end |
#application ⇒ Object (readonly)
ID of the Connect application that created the PaymentIntent.
12846 12847 12848 |
# File 'lib/stripe/resources/payment_intent.rb', line 12846 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 payment amount. For more information, see the PaymentIntents [use case for connected accounts](stripe.com/docs/payments/connected-accounts).
12848 12849 12850 |
# File 'lib/stripe/resources/payment_intent.rb', line 12848 def application_fee_amount @application_fee_amount end |
#async_workflows ⇒ Object (readonly)
Attribute for field async_workflows
12850 12851 12852 |
# File 'lib/stripe/resources/payment_intent.rb', line 12850 def async_workflows @async_workflows end |
#automatic_payment_methods ⇒ Object (readonly)
Settings to configure compatible payment methods from the [Stripe Dashboard](dashboard.stripe.com/settings/payment_methods)
12852 12853 12854 |
# File 'lib/stripe/resources/payment_intent.rb', line 12852 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.
12854 12855 12856 |
# File 'lib/stripe/resources/payment_intent.rb', line 12854 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`, or `automatic`).
12856 12857 12858 |
# File 'lib/stripe/resources/payment_intent.rb', line 12856 def cancellation_reason @cancellation_reason end |
#capture_method ⇒ Object (readonly)
Controls when the funds will be captured from the customer’s account.
12858 12859 12860 |
# File 'lib/stripe/resources/payment_intent.rb', line 12858 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](stripe.com/docs/payments/accept-a-payment?ui=elements) and learn about how ‘client_secret` should be handled.
12864 12865 12866 |
# File 'lib/stripe/resources/payment_intent.rb', line 12864 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.
12866 12867 12868 |
# File 'lib/stripe/resources/payment_intent.rb', line 12866 def confirmation_method @confirmation_method end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
12868 12869 12870 |
# File 'lib/stripe/resources/payment_intent.rb', line 12868 def created @created end |
#currency ⇒ Object (readonly)
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).
12870 12871 12872 |
# File 'lib/stripe/resources/payment_intent.rb', line 12870 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](stripe.com/docs/api#payment_intent_object-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](docs.stripe.com/api/charges/object#charge_object-payment_method_details-card_present-generated_card) payment method representing the card is created and attached to the Customer instead.
12876 12877 12878 |
# File 'lib/stripe/resources/payment_intent.rb', line 12876 def customer @customer end |
#description ⇒ Object (readonly)
An arbitrary string attached to the object. Often useful for displaying to users.
12878 12879 12880 |
# File 'lib/stripe/resources/payment_intent.rb', line 12878 def description @description end |
#id ⇒ Object (readonly)
Unique identifier for the object.
12880 12881 12882 |
# File 'lib/stripe/resources/payment_intent.rb', line 12880 def id @id end |
#invoice ⇒ Object (readonly)
ID of the invoice that created this PaymentIntent, if it exists.
12882 12883 12884 |
# File 'lib/stripe/resources/payment_intent.rb', line 12882 def invoice @invoice 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.
12884 12885 12886 |
# File 'lib/stripe/resources/payment_intent.rb', line 12884 def last_payment_error @last_payment_error end |
#latest_charge ⇒ Object (readonly)
ID of the latest [Charge object](stripe.com/docs/api/charges) created by this PaymentIntent. This property is ‘null` until PaymentIntent confirmation is attempted.
12886 12887 12888 |
# File 'lib/stripe/resources/payment_intent.rb', line 12886 def latest_charge @latest_charge end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
12888 12889 12890 |
# File 'lib/stripe/resources/payment_intent.rb', line 12888 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](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. Learn more about [storing information in metadata](stripe.com/docs/payments/payment-intents/creating-payment-intents#storing-information-in-metadata).
12890 12891 12892 |
# File 'lib/stripe/resources/payment_intent.rb', line 12890 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.
12892 12893 12894 |
# File 'lib/stripe/resources/payment_intent.rb', line 12892 def next_action @next_action end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
12894 12895 12896 |
# File 'lib/stripe/resources/payment_intent.rb', line 12894 def object @object end |
#on_behalf_of ⇒ Object (readonly)
The account (if any) for which the funds of the PaymentIntent are intended. See the PaymentIntents [use case for connected accounts](stripe.com/docs/payments/connected-accounts) for details.
12896 12897 12898 |
# File 'lib/stripe/resources/payment_intent.rb', line 12896 def on_behalf_of @on_behalf_of end |
#payment_details ⇒ Object (readonly)
Attribute for field payment_details
12898 12899 12900 |
# File 'lib/stripe/resources/payment_intent.rb', line 12898 def payment_details @payment_details end |
#payment_method ⇒ Object (readonly)
ID of the payment method used in this PaymentIntent.
12900 12901 12902 |
# File 'lib/stripe/resources/payment_intent.rb', line 12900 def payment_method @payment_method end |
#payment_method_configuration_details ⇒ Object (readonly)
Information about the [payment method configuration](stripe.com/docs/api/payment_method_configurations) used for this PaymentIntent.
12902 12903 12904 |
# File 'lib/stripe/resources/payment_intent.rb', line 12902 def payment_method_configuration_details @payment_method_configuration_details end |
#payment_method_options ⇒ Object (readonly)
Payment-method-specific configuration for this PaymentIntent.
12904 12905 12906 |
# File 'lib/stripe/resources/payment_intent.rb', line 12904 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.
12906 12907 12908 |
# File 'lib/stripe/resources/payment_intent.rb', line 12906 def payment_method_types @payment_method_types end |
#processing ⇒ Object (readonly)
If present, this property tells you about the processing state of the payment.
12908 12909 12910 |
# File 'lib/stripe/resources/payment_intent.rb', line 12908 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](dashboard.stripe.com/account/emails).
12910 12911 12912 |
# File 'lib/stripe/resources/payment_intent.rb', line 12910 def receipt_email @receipt_email end |
#review ⇒ Object (readonly)
ID of the review associated with this PaymentIntent, if any.
12912 12913 12914 |
# File 'lib/stripe/resources/payment_intent.rb', line 12912 def review @review end |
#secret_key_confirmation ⇒ Object (readonly)
Indicates whether confirmation for this PaymentIntent using a secret key is ‘required` or `optional`.
12914 12915 12916 |
# File 'lib/stripe/resources/payment_intent.rb', line 12914 def secret_key_confirmation @secret_key_confirmation 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](/payments/save-during-payment) 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](/api/payment_methods/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](/api/charges/object#charge_object-payment_method_details-card_present-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](/strong-customer-authentication).
12922 12923 12924 |
# File 'lib/stripe/resources/payment_intent.rb', line 12922 def setup_future_usage @setup_future_usage end |
#shipping ⇒ Object (readonly)
Shipping information for this PaymentIntent.
12924 12925 12926 |
# File 'lib/stripe/resources/payment_intent.rb', line 12924 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.
12926 12927 12928 |
# File 'lib/stripe/resources/payment_intent.rb', line 12926 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](docs.stripe.com/get-started/account/statement-descriptors).
Setting this value for a card charge returns an error. For card charges, set the [statement_descriptor_suffix](docs.stripe.com/get-started/account/statement-descriptors#dynamic) instead.
12930 12931 12932 |
# File 'lib/stripe/resources/payment_intent.rb', line 12930 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](docs.stripe.com/get-started/account/statement-descriptors#static) to form the complete statement descriptor that appears on the customer’s statement.
12932 12933 12934 |
# File 'lib/stripe/resources/payment_intent.rb', line 12932 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](stripe.com/docs/payments/intents#intent-statuses).
12934 12935 12936 |
# File 'lib/stripe/resources/payment_intent.rb', line 12934 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](stripe.com/docs/payments/connected-accounts).
12936 12937 12938 |
# File 'lib/stripe/resources/payment_intent.rb', line 12936 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](stripe.com/docs/connect/separate-charges-and-transfers).
12938 12939 12940 |
# File 'lib/stripe/resources/payment_intent.rb', line 12938 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.
12951 12952 12953 12954 12955 12956 12957 12958 |
# File 'lib/stripe/resources/payment_intent.rb', line 12951 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](stripe.com/docs/payments/intents), 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’t cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](stripe.com/docs/api/checkout/sessions/expire) instead.
12979 12980 12981 12982 12983 12984 12985 12986 |
# File 'lib/stripe/resources/payment_intent.rb', line 12979 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](stripe.com/docs/payments/capture-later).
13007 13008 13009 13010 13011 13012 13013 13014 |
# File 'lib/stripe/resources/payment_intent.rb', line 13007 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](stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent’s [client_secret](stripe.com/docs/api#payment_intent_object-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.
13075 13076 13077 13078 13079 13080 13081 13082 |
# File 'lib/stripe/resources/payment_intent.rb', line 13075 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](stripe.com/docs/api/payment_intents/confirm) to continue the payment. Learn more about <a href=“/docs/payments/payment-intents”>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](stripe.com/docs/api/payment_intents/confirm) when you supply confirm=true.
13094 13095 13096 |
# File 'lib/stripe/resources/payment_intent.rb', line 13094 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/payment_intents", params: params, opts: opts) end |
.decrement_authorization(intent, params = {}, opts = {}) ⇒ Object
Perform a decremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object). To be eligible, the PaymentIntent’s status must be requires_capture and [decremental_authorization.status](stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization) must be available.
Decremental authorizations decrease the authorized amount on your customer’s card to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
After decrement, the PaymentIntent object returns with the updated [amount](stripe.com/docs/api/payment_intents/object#payment_intent_object-amount). The PaymentIntent will now be capturable up to the new authorized amount.
Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines. After it’s fully captured, a PaymentIntent can no longer be decremented.
13139 13140 13141 13142 13143 13144 13145 13146 |
# File 'lib/stripe/resources/payment_intent.rb', line 13139 def self.(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(intent) }), params: params, opts: opts ) end |
.increment_authorization(intent, params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object). To be eligible, the PaymentIntent’s status must be requires_capture and [incremental_authorization_supported](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. 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](stripe.com/docs/api/payment_intents/object#payment_intent_object-amount). If the incremental authorization fails, a [card_declined](stripe.com/docs/error-codes#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](stripe.com/docs/terminal/features/incremental-authorizations).
13205 13206 13207 13208 13209 13210 13211 13212 |
# File 'lib/stripe/resources/payment_intent.rb', line 13205 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 |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of PaymentIntents.
13215 13216 13217 |
# File 'lib/stripe/resources/payment_intent.rb', line 13215 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/payment_intents", params: params, opts: opts) end |
.object_name ⇒ Object
23 24 25 |
# File 'lib/stripe/resources/payment_intent.rb', line 23 def self.object_name "payment_intent" end |
.search(params = {}, opts = {}) ⇒ Object
13219 13220 13221 13222 13223 13224 13225 13226 |
# File 'lib/stripe/resources/payment_intent.rb', line 13219 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
13228 13229 13230 |
# File 'lib/stripe/resources/payment_intent.rb', line 13228 def self.search_auto_paging_each(params = {}, opts = {}, &blk) search(params, opts).auto_paging_each(&blk) end |
.trigger_action(intent, params = {}, opts = {}) ⇒ Object
Trigger an external action on a PaymentIntent.
13243 13244 13245 13246 13247 13248 13249 13250 |
# File 'lib/stripe/resources/payment_intent.rb', line 13243 def self.trigger_action(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/test/payment_intents/%<intent>s/trigger_action", { intent: CGI.escape(intent) }), params: params, opts: opts ) 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](stripe.com/docs/api/payment_intents/confirm) instead.
13259 13260 13261 13262 13263 13264 13265 13266 |
# File 'lib/stripe/resources/payment_intent.rb', line 13259 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.
13279 13280 13281 13282 13283 13284 13285 13286 |
# File 'lib/stripe/resources/payment_intent.rb', line 13279 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.
12941 12942 12943 12944 12945 12946 12947 12948 |
# File 'lib/stripe/resources/payment_intent.rb', line 12941 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](stripe.com/docs/payments/intents), 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’t cancel the PaymentIntent for a Checkout Session. [Expire the Checkout Session](stripe.com/docs/api/checkout/sessions/expire) instead.
12965 12966 12967 12968 12969 12970 12971 12972 |
# File 'lib/stripe/resources/payment_intent.rb', line 12965 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](stripe.com/docs/payments/capture-later).
12993 12994 12995 12996 12997 12998 12999 13000 |
# File 'lib/stripe/resources/payment_intent.rb', line 12993 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](stripe.com/docs/stripe-js/reference#stripe-handle-card-payment) and the PaymentIntent’s [client_secret](stripe.com/docs/api#payment_intent_object-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.
13041 13042 13043 13044 13045 13046 13047 13048 |
# File 'lib/stripe/resources/payment_intent.rb', line 13041 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 |
#decrement_authorization(params = {}, opts = {}) ⇒ Object
Perform a decremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object). To be eligible, the PaymentIntent’s status must be requires_capture and [decremental_authorization.status](stripe.com/docs/api/charges/object#charge_object-payment_method_details-card-decremental_authorization) must be available.
Decremental authorizations decrease the authorized amount on your customer’s card to the new, lower amount provided. A single PaymentIntent can call this endpoint multiple times to further decrease the authorized amount.
After decrement, the PaymentIntent object returns with the updated [amount](stripe.com/docs/api/payment_intents/object#payment_intent_object-amount). The PaymentIntent will now be capturable up to the new authorized amount.
Each PaymentIntent can have a maximum of 10 decremental or incremental authorization attempts, including declines. After it’s fully captured, a PaymentIntent can no longer be decremented.
13114 13115 13116 13117 13118 13119 13120 13121 |
# File 'lib/stripe/resources/payment_intent.rb', line 13114 def (params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%<intent>s/decrement_authorization", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#increment_authorization(params = {}, opts = {}) ⇒ Object
Perform an incremental authorization on an eligible [PaymentIntent](stripe.com/docs/api/payment_intents/object). To be eligible, the PaymentIntent’s status must be requires_capture and [incremental_authorization_supported](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. 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](stripe.com/docs/api/payment_intents/object#payment_intent_object-amount). If the incremental authorization fails, a [card_declined](stripe.com/docs/error-codes#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](stripe.com/docs/terminal/features/incremental-authorizations).
13172 13173 13174 13175 13176 13177 13178 13179 |
# File 'lib/stripe/resources/payment_intent.rb', line 13172 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 |
#trigger_action(params = {}, opts = {}) ⇒ Object
Trigger an external action on a PaymentIntent.
13233 13234 13235 13236 13237 13238 13239 13240 |
# File 'lib/stripe/resources/payment_intent.rb', line 13233 def trigger_action(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/test/payment_intents/%<intent>s/trigger_action", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#verify_microdeposits(params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a PaymentIntent object.
13269 13270 13271 13272 13273 13274 13275 13276 |
# File 'lib/stripe/resources/payment_intent.rb', line 13269 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 |