younifyd
Menu

Create Coupon Redemption

Generate an active coupon redemption on an account or subscription

POST/accounts/{account_id}/coupon_redemptions/active

Use it in a workflow

  1. Add a step and choose the Recurly connector.
  2. Pick the Create Coupon Redemption action (under coupon_redemption).
  3. Fill in the fields below, then reference the result from later steps as {{createCouponRedemption.response.data}}.

Request

Path parameters

account_idstringrequired

Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`.

Request body

Enter the body as JSON in the step's Body field.

coupon_idstringrequired
currencystring

3-letter ISO 4217 currency code.

subscription_idstring
json
{
  "coupon_id": "string",
  "currency": "string",
  "subscription_id": "string"
}

Response

Returns 200 with an object. Read it in later steps with {{createCouponRedemption.response.data.<field>}}.

idstring
objectstring

Will always be `coupon`.

uuidstring

The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI.

accountobject
idstring
objectstring
codestring

The unique identifier of the account.

emailstring (email)

The email address used for communicating with this customer.

first_namestring
last_namestring
companystring
parent_account_idstring
bill_tostring
dunning_campaign_idstring

Unique ID to identify a dunning campaign. Used to specify if a non-default dunning campaign should be assigned to this account. For sites without multiple dunning campaigns enabled, the default dunning campaign will always be used.

subscription_idstring
couponobject
idstring
objectstring
codestring

The code the customer enters to redeem the coupon.

namestring

The internal name for the coupon.

statestring

Indicates if the coupon is redeemable, and if it is not, why.

One ofexpiredmaxed_outredeemable

max_redemptionsinteger

A maximum number of redemptions for the coupon. The coupon will expire when it hits its maximum redemptions.

max_redemptions_per_accountinteger

Redemptions per account is the number of times a specific account can redeem the coupon. Set redemptions per account to `1` if you want to keep customers from gaming the system and getting more than one discount from the coupon campaign.

unique_coupon_codes_countinteger

When this number reaches `max_redemptions` the coupon will no longer be redeemable.

unique_code_templatestring

On a bulk coupon, the template from which unique coupon codes are generated.

unique_coupon_codeobject

Will be populated when the Coupon being returned is a `UniqueCouponCode`.

durationstring

- "single_use" coupons applies to the first invoice only. - "temporal" coupons will apply to invoices for the duration determined by the `temporal_unit` and `temporal_amount` attributes.

One offoreversingle_usetemporalbilling_periods

temporal_amountinteger

If `duration` is "temporal" than `temporal_amount` is an integer which is multiplied by `temporal_unit` to define the duration that the coupon will be applied to invoices for. When `temporal_unit` is "billing_period", this is the number of complete billing cycles.

temporal_unitstring

The temporal unit for the coupon's duration. Used with temporal_amount to define how long the coupon applies. When temporal_unit is billing_period, the coupon applies for temporal_amount complete billing cycles rather than a fixed calendar duration. billing_period requires redemption_resource=subscription.

One ofdaymonthweekyearbilling_period

free_trial_unitstring

Description of the unit of time the coupon is for. Used with `free_trial_amount` to determine the duration of time the coupon is for.

One ofdaymonthweekbilling_period

free_trial_amountinteger

Sets the duration of time the `free_trial_unit` is for.

applies_to_all_plansboolean

The coupon is valid for all plans if true. If false then `plans` will list the applicable plans.

Default true

applies_to_all_itemsboolean

The coupon is valid for all items if true. If false then `items` will list the applicable items.

Default false

applies_to_non_plan_chargesboolean

The coupon is valid for one-time, non-plan charges if true.

Default false

plansarray<object>4 fields

A list of plans for which this coupon applies. This will be `null` if `applies_to_all_plans=true`.

itemsarray<object>6 fields

A list of items for which this coupon applies. This will be `null` if `applies_to_all_items=true`.

redemption_resourcestring

Whether the discount is for all eligible charges on the account, or only a specific subscription.

One ofaccountsubscriptionDefault "account"

discountobject4 fields

Details of the discount a coupon applies. Will contain a `type` property and one of the following properties: `percent`, `fixed`, `trial`.

coupon_typestring

Whether the coupon is "single_code" or "bulk". Bulk coupons will require a `unique_code_template` and will generate unique codes through the `/generate` endpoint.

One ofbulksingle_code

hosted_page_descriptionstring

This description will show up when a customer redeems a coupon on your Hosted Payment Pages, or if you choose to show the description on your own checkout page.

invoice_descriptionstring

Description of the coupon on the invoice.

redeem_bystring (date-time)

The date and time the coupon will expire and can no longer be redeemed. Time is always 11:59:59, the end-of-day Pacific time.

created_atstring (date-time)
updated_atstring (date-time)
expired_atstring (date-time)

The date and time the coupon was expired early or reached its `max_redemptions`.

statestring

One ofactiveinactiveDefault "active"

remaining_durationobject
typestring

The coupon's duration type. `temporal` includes an `expires_at` timestamp. `billing_periods` includes a `redemptions_remaining` count of billing cycles. `forever` and `single_use` have no additional fields.

One offoreversingle_usetemporalbilling_periods

expires_atstring (date-time)

Present when `type` is `temporal`. The datetime after which this redemption will no longer apply.

redemptions_remaininginteger

The number of redemption periods remaining for which this coupon will still apply.

currencystring

3-letter ISO 4217 currency code.

discountednumber (float)

The amount that was discounted upon the application of the coupon, formatted with the currency.

created_atstring (date-time)
updated_atstring (date-time)
removed_atstring (date-time)

The date and time the redemption was removed from the account (un-redeemed).

json
{
  "id": "string",
  "object": "string",
  "uuid": "string",
  "account": {
    "id": "string",
    "object": "string",
    "code": "string",
    "email": "name@example.com",
    "first_name": "string",
    "last_name": "string",
    "company": "string",
    "parent_account_id": "string",
    "bill_to": "string",
    "dunning_campaign_id": "string"
  },
  "subscription_id": "string",
  "coupon": {
    "id": "string",
    "object": "string",
    "code": "string",
    "name": "string",
    "state": "expired",
    "max_redemptions": 0,
    "max_redemptions_per_account": 0,
    "unique_coupon_codes_count": 0,
    "unique_code_template": "string",
    "unique_coupon_code": {},
    "duration": "forever",
    "temporal_amount": 0
  },
  "state": "active",
  "remaining_duration": {
    "type": "forever",
    "expires_at": "2025-01-01T00:00:00Z",
    "redemptions_remaining": 0
  },
  "currency": "string",
  "discounted": 0,
  "created_at": "2025-01-01T00:00:00Z",
  "updated_at": "2025-01-01T00:00:00Z"
}

Need more? See the Recurly guide for connection setup and behaviour shared by every action.