Class: Stripe::SetupIntentService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::SetupIntentService
- Defined in:
- lib/stripe/services/setup_intent_service.rb
Instance Method Summary collapse
-
#cancel(intent, params = {}, opts = {}) ⇒ Object
You can cancel a SetupIntent object when it’s in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
-
#confirm(intent, params = {}, opts = {}) ⇒ Object
Confirm that your customer intends to set up the current or provided payment method.
-
#create(params = {}, opts = {}) ⇒ Object
Creates a SetupIntent object.
-
#list(params = {}, opts = {}) ⇒ Object
Returns a list of SetupIntents.
-
#retrieve(intent, params = {}, opts = {}) ⇒ Object
Retrieves the details of a SetupIntent that has previously been created.
-
#update(intent, params = {}, opts = {}) ⇒ Object
Updates a SetupIntent object.
-
#verify_microdeposits(intent, params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a SetupIntent object.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#cancel(intent, params = {}, opts = {}) ⇒ Object
You can cancel a SetupIntent object when it’s in one of these statuses: requires_payment_method, requires_confirmation, or requires_action.
After you cancel it, setup is abandoned and any operations on the SetupIntent fail with an error. You can’t cancel the SetupIntent for a Checkout Session. [Expire the Checkout Session](stripe.com/docs/api/checkout/sessions/expire) instead.
9 10 11 12 13 14 15 16 17 |
# File 'lib/stripe/services/setup_intent_service.rb', line 9 def cancel(intent, params = {}, opts = {}) request( method: :post, path: format("/v1/setup_intents/%<intent>s/cancel", { intent: CGI.escape(intent) }), params: params, opts: opts, base_address: :api ) end |
#confirm(intent, params = {}, opts = {}) ⇒ Object
Confirm that your customer intends to set up the current or provided payment method. For example, you would confirm a SetupIntent when a customer hits the “Save” button on a payment method management page on your website.
If the selected payment method does not require any additional steps from the customer, the SetupIntent will transition to the succeeded status.
Otherwise, it will transition to the requires_action status and suggest additional actions via next_action. If setup fails, the SetupIntent will transition to the requires_payment_method status or the canceled status if the confirmation limit is reached.
33 34 35 36 37 38 39 40 41 |
# File 'lib/stripe/services/setup_intent_service.rb', line 33 def confirm(intent, params = {}, opts = {}) request( method: :post, path: format("/v1/setup_intents/%<intent>s/confirm", { intent: CGI.escape(intent) }), params: params, opts: opts, base_address: :api ) end |
#create(params = {}, opts = {}) ⇒ Object
Creates a SetupIntent object.
After you create the SetupIntent, attach a payment method and [confirm](stripe.com/docs/api/setup_intents/confirm) it to collect any required permissions to charge the payment method later.
47 48 49 50 51 52 53 54 55 |
# File 'lib/stripe/services/setup_intent_service.rb', line 47 def create(params = {}, opts = {}) request( method: :post, path: "/v1/setup_intents", params: params, opts: opts, base_address: :api ) end |
#list(params = {}, opts = {}) ⇒ Object
Returns a list of SetupIntents.
58 59 60 61 62 63 64 65 66 |
# File 'lib/stripe/services/setup_intent_service.rb', line 58 def list(params = {}, opts = {}) request( method: :get, path: "/v1/setup_intents", params: params, opts: opts, base_address: :api ) end |
#retrieve(intent, params = {}, opts = {}) ⇒ Object
Retrieves the details of a SetupIntent that has previously been created.
Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string.
When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the [SetupIntent](stripe.com/docs/api#setup_intent_object) object reference for more details.
73 74 75 76 77 78 79 80 81 |
# File 'lib/stripe/services/setup_intent_service.rb', line 73 def retrieve(intent, params = {}, opts = {}) request( method: :get, path: format("/v1/setup_intents/%<intent>s", { intent: CGI.escape(intent) }), params: params, opts: opts, base_address: :api ) end |
#update(intent, params = {}, opts = {}) ⇒ Object
Updates a SetupIntent object.
84 85 86 87 88 89 90 91 92 |
# File 'lib/stripe/services/setup_intent_service.rb', line 84 def update(intent, params = {}, opts = {}) request( method: :post, path: format("/v1/setup_intents/%<intent>s", { intent: CGI.escape(intent) }), params: params, opts: opts, base_address: :api ) end |
#verify_microdeposits(intent, params = {}, opts = {}) ⇒ Object
Verifies microdeposits on a SetupIntent object.
95 96 97 98 99 100 101 102 103 |
# File 'lib/stripe/services/setup_intent_service.rb', line 95 def verify_microdeposits(intent, params = {}, opts = {}) request( method: :post, path: format("/v1/setup_intents/%<intent>s/verify_microdeposits", { intent: CGI.escape(intent) }), params: params, opts: opts, base_address: :api ) end |