# File generated from our OpenAPI spec # frozen_string_literal: true module Stripe # 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](https://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](https://stripe.com/docs/payments/payment-intents). class PaymentIntent < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List extend Stripe::APIOperations::Search include Stripe::APIOperations::Save OBJECT_NAME = "payment_intent" def apply_customer_balance(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/apply_customer_balance", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/cancel", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end def capture(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/capture", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end def confirm(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/confirm", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end def increment_authorization(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/increment_authorization", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end def verify_microdeposits(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/verify_microdeposits", { intent: CGI.escape(self["id"]) }), params: params, opts: opts ) end def self.apply_customer_balance(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/apply_customer_balance", { intent: CGI.escape(intent) }), params: params, opts: opts ) end def self.cancel(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/cancel", { intent: CGI.escape(intent) }), params: params, opts: opts ) end def self.capture(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/capture", { intent: CGI.escape(intent) }), params: params, opts: opts ) end def self.confirm(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/confirm", { intent: CGI.escape(intent) }), params: params, opts: opts ) end def self.increment_authorization(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/increment_authorization", { intent: CGI.escape(intent) }), params: params, opts: opts ) end def self.verify_microdeposits(intent, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_intents/%s/verify_microdeposits", { intent: CGI.escape(intent) }), params: params, opts: opts ) end def self.search(params = {}, opts = {}) _search("/v1/payment_intents/search", params, opts) end def self.search_auto_paging_each(params = {}, opts = {}, &blk) search(params, opts).auto_paging_each(&blk) end end end