The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::API::Stripe::Checkout::Session - A Stripe Checkout Session Object

SYNOPSIS

    my $session = $stripe->session({
        # This easy to implement with Net::API::REST
        cancel_url => 'https://api.example.com/v1/stripe/cancel',
        success_url => 'https://api.example.com/v1/stripe/success',
        client_reference_id => '1F7F749C-D9C9-46EB-B692-986628BD7302',
        customer => $customer_object,
        customer_email => 'john.doe@example.com',
        # Japanese please
        locale => 'ja',
        mode => 'subscription',
        payment_intent => $payment_intent_object,
        submit_type => 'pay',
        subscription => $subscription_object,
    });

VERSION

    v0.100.0

DESCRIPTION

A Checkout Session represents your customer's session as they pay for one-time purchases or subscriptions through Checkout (https://stripe.com/docs/payments/checkout). Stripe recommends creating a new Session each time your customer attempts to pay.

Once payment is successful, the Checkout Session will contain a reference to the Customer (Net::API::Stripe::Customer / https://stripe.com/docs/api/customers), and either the successful PaymentIntent (Net::API::Stripe::Payment::Intent / https://stripe.com/docs/api/payment_intents) or an active Subscription (Net::API::Stripe::Billing::Subscription / https://stripe.com/docs/api/subscriptions).

You can create a Checkout Session on your server and pass its ID to the client to begin Checkout.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Checkout::Session object.

METHODS

id string

Unique identifier for the object. Used to pass to redirectToCheckout in Stripe.js.

object string, value is "checkout.session"

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

billing_address_collection string

The value (auto or required) for whether Checkout collected the customer’s billing address.

cancel_url string

The URL the customer will be directed to if they decide to cancel payment and return to your website.

This is a URI object.

client_reference_id string

A unique string to reference the Checkout Session. This can be a customer ID, a cart ID, or similar, and can be used to reconcile the session with your internal systems.

customer string (expandable)

The ID of the customer for this session. For Checkout Sessions in payment or subscription mode, Checkout will create a new customer object based on information provided during the session unless an existing customer was provided when the session was created.

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

customer_email string

If provided, this value will be used when the Customer object is created. If not provided, customers will be asked to enter their email address. Use this parameter to prefill customer data if you already have an email on file. To access information about the customer once a session is complete, use the customer field.

display_items array of hashes

The line items, plans, or SKUs purchased by the customer.

This is an array of Net::API::Stripe::Checkout::Item objects.

livemode boolean

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

locale string

The IETF language tag of the locale Checkout is displayed in. If blank or auto, the browser’s locale is used.

mode string

The mode of the Checkout Session, one of payment, setup, or subscription.

payment_intent string (expandable)

The ID of the PaymentIntent for Checkout Sessions in payment mode. If it is expanded, it contains a Net::API::Stripe::Payment::Intent object.

payment_intent_data object

A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.

This is a Net::API::Stripe::Payment::Intent object and used to create a checkout session.

payment_method_types array containing strings

A list of the types of payment methods (e.g. card) this Checkout Session is allowed to accept.

setup_intent string (expandable)

The ID of the SetupIntent for Checkout Sessions in setup mode.

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

setup_intent_data object

A subset of parameters to be passed to SetupIntent creation for Checkout Sessions in setup mode.

This is a Net::API::Stripe::Payment::Intent object and used to create a checkout session.

submit_type string

Describes the type of transaction being performed by Checkout in order to customize relevant text on the page, such as the submit button. submit_type can only be specified on Checkout Sessions in payment mode, but not Checkout Sessions in subscription or setup mode. Supported values are auto, book, donate, or pay.

subscription string (expandable)

The ID of the subscription for Checkout Sessions in subscription mode. If it is expanded, this is the Net::API::Stripe::Billing::Subscription object.

subscription_data object

A subset of parameters to be passed to subscription creation for Checkout Sessions in subscription mode.

This is a Net::API::Stripe::Billing::Subscription object and used to create a checkout session.

success_url string

The URL the customer will be directed to after the payment or subscription creation is successful.

API SAMPLE

        {
          "id": "cs_test_ksjfkjfkljslfkjlfkflsfklskflskflskfs",
          "object": "checkout.session",
          "billing_address_collection": null,
          "cancel_url": "https://example.com/cancel",
          "client_reference_id": null,
          "customer": null,
          "customer_email": null,
          "display_items": [
                {
                  "amount": 1500,
                  "currency": "usd",
                  "custom": {
                        "description": "Comfortable cotton t-shirt",
                        "images": null,
                        "name": "T-shirt"
                  },
                  "quantity": 2,
                  "type": "custom"
                }
          ],
          "livemode": false,
          "locale": null,
          "mode": null,
          "payment_intent": "pi_fake123456789",
          "payment_method_types": [
                "card"
          ],
          "setup_intent": null,
          "submit_type": null,
          "subscription": null,
          "success_url": "https://example.com/success"
        }

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/checkout/sessions, https://stripe.com/docs/payments/checkout/api

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.