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

NAME

Net::API::Stripe::Event - A Stripe Event Object

SYNOPSIS

    my $evt = $stripe->event({
        api_version => '2020-03-02',
        data => 
        {
            object => $invoice_object,
        },
        livemode => $stripe->false,
        pending_webhooks => 2,
        request =>
        {
            id => 'req_HwlkQJshckjIsj',
            idempotency_key => '677A3112-FBAD-4804-BA61-CEF1CC13D155',
        },
        type => 'invoice.created',
    });

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

VERSION

    v0.101.0

DESCRIPTION

Events are Stripe's way of letting you know when something interesting happens in your account. When an interesting event occurs, Stripe creates a new Event object. For example, when a charge succeeds, Stripe creates a charge.succeeded event; and when an invoice payment attempt fails, Stripe creates an invoice.payment_failed event. Note that many API requests may cause multiple events to be created. For example, if you create a new subscription for a customer, you will receive both a customer.subscription.created event and a charge.succeeded event.

Events occur when the state of another API resource changes. The state of that resource at the time of the change is embedded in the event's data field. For example, a charge.succeeded event will contain a charge, and an invoice.payment_failed event will contain an invoice.

As with other API resources, you can use endpoints to retrieve an individual event or a list of events from the API. Stripe also have a separate webhooks system for sending the Event objects directly to an endpoint on your server. Webhooks are managed in your account settings, and Stripe's Using Webhooks guide will help you get set up.

When using Connect, you can also receive notifications of events that occur in connected accounts. For these events, there will be an additional account attribute in the received Event object.

CONSTRUCTOR

new( %ARG )

Creates a new Net::API::Stripe::Event 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 "event"

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

account Connect only string

The connected account that originated the event.

api_version string

The Stripe API version used to render data. Note: This property is populated only for events on or after October 31, 2014.

created timestamp

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

data hash

Object containing data associated with the event. This is an Net::API::Stripe::Event::Data object

livemode boolean

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

pending_webhooks positive integer or zero

Number of webhooks that have yet to be successfully delivered (i.e., to return a 20x response) to the URLs you’ve specified.

request hash

Information on the API request that instigated the event. This is a Net::API::Stripe::Event::Request object.

type string

Description of the event (e.g., invoice.created or charge.refunded).

API SAMPLE

    {
      "id": "evt_fake123456789",
      "object": "event",
      "api_version": "2017-02-14",
      "created": 1528914645,
      "data": {
        "object": {
          "object": "balance",
          "available": [
            {
              "currency": "jpy",
              "amount": 1025751,
              "source_types": {
                "card": 1025751
              }
            }
          ],
          "connect_reserved": [
            {
              "currency": "jpy",
              "amount": 0
            }
          ],
          "livemode": false,
          "pending": [
            {
              "currency": "jpy",
              "amount": 0,
              "source_types": {
                "card": 0
              }
            }
          ]
        }
      },
      "livemode": false,
      "pending_webhooks": 0,
      "request": {
        "id": null,
        "idempotency_key": null
      },
      "type": "balance.available"
    }

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/events#events, https://stripe.com/docs/api/events/types

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.