Class: Stripe::SetupIntentService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/setup_intent_service.rb

Defined Under Namespace

Classes: CancelParams, ConfirmParams, CreateParams, ListParams, RetrieveParams, UpdateParams, VerifyMicrodepositsParams

Instance Method Summary collapse

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](docs.stripe.com/docs/api/checkout/sessions/expire) instead.



3540
3541
3542
3543
3544
3545
3546
3547
3548
# File 'lib/stripe/services/setup_intent_service.rb', line 3540

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.



3564
3565
3566
3567
3568
3569
3570
3571
3572
# File 'lib/stripe/services/setup_intent_service.rb', line 3564

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](docs.stripe.com/docs/api/setup_intents/confirm) it to collect any required permissions to charge the payment method later.



3578
3579
3580
3581
3582
3583
3584
3585
3586
# File 'lib/stripe/services/setup_intent_service.rb', line 3578

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.



3589
3590
3591
3592
3593
3594
3595
3596
3597
# File 'lib/stripe/services/setup_intent_service.rb', line 3589

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](docs.stripe.com/api#setup_intent_object) object reference for more details.



3604
3605
3606
3607
3608
3609
3610
3611
3612
# File 'lib/stripe/services/setup_intent_service.rb', line 3604

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.



3615
3616
3617
3618
3619
3620
3621
3622
3623
# File 'lib/stripe/services/setup_intent_service.rb', line 3615

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.



3626
3627
3628
3629
3630
3631
3632
3633
3634
# File 'lib/stripe/services/setup_intent_service.rb', line 3626

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