Method: Stripe::PaymentIntent#cancel
- Defined in:
- lib/stripe/resources/payment_intent.rb
#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](docs.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](docs.stripe.com/docs/api/checkout/sessions/expire) instead.
2845 2846 2847 2848 2849 2850 2851 2852 |
# File 'lib/stripe/resources/payment_intent.rb', line 2845 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 |