mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-03 00:01:21 -04:00
128 lines
4.4 KiB
Ruby
128 lines
4.4 KiB
Ruby
# 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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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/%<intent>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 |