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

NAME

Net::API::Stripe::Order - A Stripe Order Object

SYNOPSIS

    my $order = $stripe->order({
        amount => 2000,
        amount_returned => undef,
        application => $connect_account_object,
        application_fee => 20,
        charge => $charge_object,
        currency => 'jpy',
        customer => $customer_object,
        email => 'john.doe@example.com',
        metadata => { transaction_id => 123, customer_id => 456 },
        returns => [],
        status => 'paid',
        status_transitions => $status_transitions_object,
    });

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

VERSION

    v0.100.0

DESCRIPTION

Order objects are created to handle end customers' purchases of previously defined products (https://stripe.com/docs/api/orders#products). You can create, retrieve, and pay individual orders, as well as list all orders. Orders are identified by a unique, random ID.

CONSTRUCTOR

new( %ARG )

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

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

amount integer

A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the order.

amount_returned integer

The total amount that was returned to the customer.

application string

ID of the Connect Application that created the order.

If this was somehow expanded, this would be a Net::API::Stripe::Connect::Account object.

application_fee integer

A fee in cents that will be applied to the order and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees documentation.

charge string (expandable)

The ID of the payment used to pay for the order. Present if the order status is paid, fulfilled, or refunded.

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

created timestamp

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

currency currency

Three-letter ISO currency code, in lowercase. Must be a supported currency.

customer string (expandable)

The customer used for the order.

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

email string

The email address of the customer placing the order.

external_coupon_code string

External coupon code to load for this order.

items array of hashes

List of items constituting the order. An order can have up to 25 items.

This is an array of Net::API::Stripe::Order::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.

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.

returns list

This is an array of Net::API::Stripe::Order::Returns objects.

selected_shipping_method string

The shipping method that is currently selected for this order, if any. If present, it is equal to one of the ids of shipping methods in the shipping_methods array. At order creation time, if there are multiple shipping methods, Stripe will automatically selected the first method.

shipping hash

The shipping address for the order. Present if the order is for goods to be shipped.

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

shipping_methods array of hashes

A list of supported shipping methods for this order. The desired shipping method can be specified either by updating the order, or when paying it.

This is an array of Net::API::Stripe::Order::ShippingMethod objects.

status string

Current order status. One of created, paid, canceled, fulfilled, or returned. More details in the Orders Guide.

status_transitions hash

The timestamps at which the order status was updated.

This is a Net::API::Stripe::Order::StatusTransitions object.

updated timestamp

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

upstream_id string

The user’s order ID if it is different from the Stripe order ID.

API SAMPLE

    {
      "id": "or_fake123456789",
      "object": "order",
      "amount": 1500,
      "amount_returned": null,
      "application": null,
      "application_fee": null,
      "charge": null,
      "created": 1571480453,
      "currency": "jpy",
      "customer": null,
      "email": null,
      "items": [
        {
          "object": "order_item",
          "amount": 1500,
          "currency": "jpy",
          "description": "T-shirt",
          "parent": "sk_fake123456789",
          "quantity": null,
          "type": "sku"
        }
      ],
      "livemode": false,
      "metadata": {},
      "returns": {
        "object": "list",
        "data": [],
        "has_more": false,
        "url": "/v1/order_returns?order=or_fake123456789"
      },
      "selected_shipping_method": null,
      "shipping": {
        "address": {
          "city": "Anytown",
          "country": "US",
          "line1": "1234 Main street",
          "line2": null,
          "postal_code": "123456",
          "state": null
        },
        "carrier": null,
        "name": "Jenny Rosen",
        "phone": null,
        "tracking_number": null
      },
      "shipping_methods": null,
      "status": "created",
      "status_transitions": {
        "canceled": null,
        "fulfiled": null,
        "paid": null,
        "returned": null
      },
      "updated": 1571480453
    }

HISTORY

v0.1

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api/orders, https://stripe.com/docs/orders

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.