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::Product::PromotionCode - The promotion code object

SYNOPSIS

    my $promo = $stripe->promotion_code({
        active => $stripe->true,
        code => 'TS0EQJHH',
        ## Net::API::Stripe::Product::Coupon
        coupon => $coupon_object,
        created => 'now',
        ## Net::API::Stripe::Customer
        customer => $customer_object,
        expires_at => '+3M',
        livemode => $stripe->false,
        max_redemptions => 10,
        metadata => { customer_id => 123, trans_id => 456 },
        restrictions =>
        {
            first_time_transaction => $stripe->true,
            minimum_amount => 1000,
            minimum_amount_currency => 'jpy',
        },
        times_redeemed => 0,
    });

VERSION

    v0.1.0

DESCRIPTION

A Promotion Code represents a customer-redeemable code for a coupon. It can be used to create multiple codes for a single coupon.

METHODS

id string

Unique identifier for the object.

object string

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

active boolean

Whether the promotion code is currently active. A promotion code is only active if the coupon is also valid.

code string

The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for each customer.

coupon hash

Hash describing the coupon for this promotion code.

created timestamp

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

customer expandable

The customer that this promotion code can be used by.

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

expires_at timestamp

Date at which the promotion code can no longer be redeemed.

livemode boolean

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

max_redemptions positive_integer

Maximum number of times this promotion code can be redeemed.

metadata hash

Set of [key-value pairs](/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.

restrictions hash

Settings that restrict the redemption of the promotion code.

It has the following properties:

first_time_transaction boolean

A Boolean indicating if the Promotion Code should only be redeemed for Customers without any successful payments or invoices

minimum_amount positive_integer

Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work).

minimum_amount_currency string

Three-letter [ISO code](https://stripe.com/docs/currencies) for minimum_amount

times_redeemed nonnegative_integer

Number of times this promotion code has been used.

API SAMPLE

    {
      "id": "promo_1HMxuf2eZvKYlo2CmGXSyhRx",
      "object": "promotion_code",
      "active": true,
      "code": "TS0EQJHH",
      "coupon": {
        "id": "123",
        "object": "coupon",
        "amount_off": null,
        "created": 1507799684,
        "currency": null,
        "duration": "repeating",
        "duration_in_months": 3,
        "livemode": false,
        "max_redemptions": 14,
        "metadata": {
          "teste": "test"
        },
        "name": null,
        "percent_off": 34.0,
        "redeem_by": null,
        "times_redeemed": 0,
        "valid": true
      },
      "created": 1599060617,
      "customer": null,
      "expires_at": null,
      "livemode": false,
      "max_redemptions": null,
      "metadata": {
      },
      "restrictions": {
        "first_time_transaction": false,
        "minimum_amount": null,
        "minimum_amount_currency": null
      },
      "times_redeemed": 0
    }

HISTORY

v0.1.0

Initial version

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Stripe API documentation:

https://stripe.com/docs/api#promotion_code_object

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.