Skip to main content
POST
Attach Promotion to Plan
Attaches an existing promotion to a plan. Subscriptions on the plan can then receive the promotion when they are created or updated. The attachment sets how many charges the discount covers (cycles) and what a pause does to it (on_pause). See Promotions on subscription plans. The response, and each item in the plan’s promotions list, shows the attachment’s promotion_id, name, type, status, cycles, on_pause and attached_at. type is the promotion’s redemption mode: AUTOMATIC (applied by itself when a subscription is created on the plan) or CODE (applied only when the merchant sends its code).
Attachments are not editedTo change cycles or on_pause, remove the attachment with Remove Promotion from Plan and attach the promotion again. Removing an attachment does not change the subscriptions that already have the promotion.

Errors

See Subscription promotion error codes for every reason.

Authorizations

public-api-key
string
header
default:<Your public-api-key>
required
private-secret-key
string
header
default:<Your private-secret-key>
required

Headers

X-Account-Code
string
required

The account_id found in your Yuno Dashboard (UUID). Required — omitting it returns 400 BAD_REQUEST ("Invalid x-account-code header.").

Path Parameters

plan_id
string
required

The unique identifier of the plan.

Body

application/json
promotion_id
string
required

The ID of an existing promotion (UUID).

cycles
integer
required

The number of charges the discount covers. At least 1.

Required range: x >= 1
on_pause
enum<string>
default:KEEP

What a pause does to the promotion once it is applied to a subscription. KEEP (default) keeps its remaining cycles for when the subscription resumes. END ends the promotion with end_reason PAUSE.

Available options:
KEEP,
END

Response

  1. The promotion is attached to the plan.
promotion_id
string
name
string
type
enum<string>

The redemption mode of the promotion. AUTOMATIC promotions apply by themselves when a subscription is created on the plan. CODE promotions apply when the merchant sends the code.

Available options:
AUTOMATIC,
CODE
status
string

ENABLED when the attachment is created.

cycles
integer
attached_at
string<date-time>
on_pause
enum<string>

What a pause does to the promotion once it is applied to a subscription.

Available options:
KEEP,
END