NAME

Net::API::Stripe::Payment::Intent::Setup - A Stripe Charge Setup Intent

SYNOPSIS

my $setup = $stripe->setup_intent({
    cancellation_reason => undef,
    customer => $customer_object,
    description => 'Preparing for payment',
    mandate => $mandate_object,
    metadata => { transaction_id => 123, customer_id => 456 },
    next_action =>
    {
        redirect_to_url => 
        {
        return_url => 'https://example.com/pay/return',
        url => 'https://example.com/pay/auth',
        },
        type => 'redirect_to_url',
    },
    payment_method => $payment_method_object,
});

See documentation in Net::API::Stripe for example to make api calls to Stripe to create those objects.

VERSION

v0.3.0

DESCRIPTION

A SetupIntent guides you through the process of setting up a customer's payment credentials for future payments. For example, you could use a SetupIntent to set up your customer's card without immediately collecting a payment. Later, you can use PaymentIntents (Net::API::Stripe::Payment::Intent / https://stripe.com/docs/api/setup_intents#payment_intents) to drive the payment flow.

Create a SetupIntent as soon as you're ready to collect your customer's payment credentials. Do not maintain long-lived, unconfirmed SetupIntents as they may no longer be valid. The SetupIntent then transitions through multiple statuses as it guides you through the setup process.

Successful SetupIntents result in payment credentials that are optimized for future payments. For example, cardholders in certain regions may need to be run through Strong Customer Authentication at the time of payment method collection in order to streamline later off-session payments.

By using SetupIntents, you ensure that your customers experience the minimum set of required friction, even as regulations change over time.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Payment::Intent::Setup object. It may also take an hash like arguments, that also are method of the same name.

METHODS

id retrievable with publishable key string

Unique identifier for the object.

object retrievable with publishable key string, value is "setup_intent"

String representing the object’s type. Objects of the same type share the same value.

application string expandable "application"

ID of the Connect application that created the SetupIntent. This is a string of the account or a Net::API::Stripe::Connect::Account object.

attach_to_self boolean

If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.

It can only be used for this Stripe Account’s own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.

cancellation_reason retrievable with publishable key string

Reason for cancellation of this SetupIntent, one of abandoned, requested_by_customer, or duplicate.

client_secret retrievable with publishable key string

The client secret of this SetupIntent. Used for client-side retrieval using a publishable key.

The client secret can be used to complete payment setup from your frontend. It should not be stored, logged, embedded in URLs, or exposed to anyone other than the customer. Make sure that you have TLS enabled on any page that includes the client secret.

created retrievable with publishable key timestamp

Time at which the object was created. Measured in seconds since the Unix epoch.

customer string (expandable)

ID of the Customer this SetupIntent belongs to, if one exists, or the corresponding Net::API::Stripe::Customer object.

If present, payment methods used with this SetupIntent can only be attached to this Customer, and payment methods attached to other Customers cannot be used with this SetupIntent.

description retrievable with publishable key string

An arbitrary string attached to the object. Often useful for displaying to users.

flow_directions array

Indicates the directions of money movement for which this payment method is intended to be used.

Include inbound if you intend to use the payment method as the origin to pull funds from. Include outbound if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.

last_setup_error retrievable with publishable key hash

The error encountered in the previous SetupIntent confirmation.

This is a Net::API::Stripe::Error object.

latest_attempt expandable

The most recent SetupAttempt for this SetupIntent.

When expanded this is an Net::API::Stripe::SetupAttempt object.

livemode retrievable with publishable key boolean

Has the value true if the object exists in live mode or the value false if the object exists in test mode.

mandate string expandable

ID of the multi use Mandate generated by the SetupIntent. When expanded, this is a Net::API::Stripe::Mandate object.

metadata hash

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

next_action retrievable with publishable key hash

If present, this property tells you what actions you need to take in order for your customer to continue payment setup.

This is a Net::API::Stripe::Payment::Intent::NextAction object with the following properties:

redirect_to_url hash

Contains instructions for authenticating a payment by redirecting your customer to another page or application.

return_url string

If the customer does not exit their browser while authenticating, they will be redirected to this specified URL after completion.

url string

The URL you must redirect your customer to in order to authenticate the payment.

type string

Type of the next action to perform, one of redirect_to_url or use_stripe_sdk.

use_stripe_sdk hash

When confirming a PaymentIntent with Stripe.js, Stripe.js depends on the contents of this dictionary to invoke authentication flows. The shape of the contents is subject to change and is only intended to be used by Stripe.js.

on_behalf_of string (expandable)

The account (if any) for which the setup is intended.

payment_method retrievable with publishable key string (expandable)

ID of the payment method used with this SetupIntent.

When expanded, this is a Net::API::Stripe::Payment::Method object.

payment_method_options hash

Payment-method-specific configuration for this SetupIntent.

card

If the PaymentIntent’s payment_method_types includes card, this hash contains the configurations that will be applied to each payment attempt of that type.

installments
available_plans

Instalment plans that may be selected for this PaymentIntent.

count

For fixed_count installment plans, this is the number of installment payments your customer will make to their credit card.

interval

For fixed_count installment plans, this is the interval between installment payments your customer will make to their credit card. One of month.

type

Type of installment plan, one of fixed_count

enabled

Whether Installments are enabled for this PaymentIntent.

plan

Instalment plan selected for this PaymentIntent.

count

For fixed_count installment plans, this is the number of installment payments your customer will make to their credit card.

interval

For fixed_count installment plans, this is the interval between installment payments your customer will make to their credit card. One of month.

type

Type of installment plan, one of fixed_count.

request_three_d_secure

Stripe strongly recommend that you rely on their SCA Engine to automatically prompt your customers for authentication based on risk level and other requirements. However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Permitted values include: automatic or any. If not provided, defaults to automatic. Read Stripe guide on manually requesting 3D Secure for more information on how this configuration interacts with Radar and Stripe SCA Engine

payment_method_types retrievable with publishable key array containing strings

The list of payment method types (e.g. card) that this SetupIntent is allowed to set up.

review scalar or object

ID of the review associated with this PaymentIntent, if any.

When expanded, this is a a Net::API::Stripe::Fraud::Review object

single_use_mandate string expandable

ID of the single_use Mandate generated by the SetupIntent. When expanded, this is a Net::API::Stripe::Mandate object.

status retrievable with publishable key string

Status of this SetupIntent, one of requires_payment_method, requires_confirmation, requires_action, processing, canceled, or succeeded.

usage retrievable with publishable key string

Indicates how the payment method is intended to be used in the future.

Use on_session if you intend to only reuse the payment method when the customer is in your checkout flow. Use off_session if your customer may or may not be in your checkout flow. If not provided, this value defaults to off_session.

API SAMPLE

{
  "id": "seti_123456789",
  "object": "setup_intent",
  "application": null,
  "cancellation_reason": null,
  "client_secret": null,
  "created": 123456789,
  "customer": null,
  "description": null,
  "last_setup_error": null,
  "livemode": false,
  "metadata": {
    "user_id": "guest"
  },
  "next_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {},
  "payment_method_types": [
    "card"
  ],
  "status": "requires_payment_method",
  "usage": "off_session"
}

HISTORY

v0.1

Initial version

STRIPE HISTORY

2019-12-24

Stripe has added 2 new properties: mandate and single_use_mandate

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/setup_intents

COPYRIGHT & LICENSE

Copyright (c) 2019-2020 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.