The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::API::Stripe::Token - A Stripe Token Object

SYNOPSIS

    my $token = $stripe->token({
        card => $card_object,
        client_ip => '1.2.3.4',
        livemode => $stripe->false,
        type => 'card',
        used => $stripe->false,
    });

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

VERSION

    0.1

DESCRIPTION

Tokenisation is the process Stripe uses to collect sensitive card or bank account details, or personally identifiable information (PII), directly from your customers in a secure manner. A token representing this information is returned to your server to use. You should use Stripe's recommended payments integrations (https://stripe.com/docs/payments) to perform this process client-side. This ensures that no sensitive card data touches your server, and allows your integration to operate in a PCI-compliant way.

If you cannot use client-side tokenization, you can also create tokens using the API with either your publishable or secret API key. Keep in mind that if your integration uses this method, you are responsible for any PCI compliance that may be required, and you must keep your secret API key safe. Unlike with client-side tokenization, your customer's information is not sent directly to Stripe, so Stripe cannot determine how it is handled or stored.

Tokens cannot be stored or used more than once. To store card or bank account information for later use, you can create Customer objects (Net::API::Stripe::Customer / https://stripe.com/docs/api#customers) or Custom accounts (Net::API::Stripe::Connect::ExternalAccount::Bank and Net::API::Stripe::Connect::ExternalAccount::Card / https://stripe.com/docs/api#external_accounts). Note that Radar (https://stripe.com/docs/radar), Stripe's integrated solution for automatic fraud protection, supports only integrations that use client-side tokenization.

CONSTRUCTOR

new( %ARG )

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

METHODS

id string

Unique identifier for the object.

object string, value is "token"

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

bank_account hash

Hash describing the bank account.

This is a Net::API::Stripe::Payment::BankAccount object.

card hash

Hash describing the card used to make the charge.

This is a Net::API::Stripe::Payment::Card object.

client_ip string

IP address of the client that generated the token.

created timestamp

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

livemode boolean

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

type string

Type of the token: account, bank_account, card, or pii.

used boolean

Whether this token has already been used (tokens can be used only once).

API SAMPLE

        {
          "id": "tok_fake123456789",
          "object": "token",
          "card": {
                "id": "card_fake123456789",
                "object": "card",
                "address_city": null,
                "address_country": null,
                "address_line1": null,
                "address_line1_check": null,
                "address_line2": null,
                "address_state": null,
                "address_zip": null,
                "address_zip_check": null,
                "brand": "Visa",
                "country": "US",
                "cvc_check": null,
                "dynamic_last4": null,
                "exp_month": 8,
                "exp_year": 2020,
                "fingerprint": "x18XyLUPM6hub5xz",
                "funding": "credit",
                "last4": "4242",
                "metadata": {},
                "name": null,
                "tokenization_method": null
          },
          "client_ip": null,
          "created": 1571314413,
          "livemode": false,
          "type": "card",
          "used": false
        }

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/tokens, https://stripe.com/docs/payments/cards/collecting/web#create-token

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.