API - Planyo Web Services - add_coupon_type

You are here: Planyo » Help » API » add_coupon_type

add_coupon_type

Description:

Adds a new coupon type.

Input:

type int required
The type of the coupon: 1 - Prepaid amount, 2 - Number of hours, 3 - Number of entries, 4 - Valid for given number of days, 5 - Discount valid for given number of days.
amount int required
The coupon's amount. Depending on the coupon type, this can be: prepaid amount, number of hours, number of entries or number of days.
price float required
The coupon price. Note that the currency set up in the site is used when purchasing and using coupons.
custom_currency string optional
Leave this field unset to use the default currency of your site. If you choose a custom currency, this will be the currency used when purchasing the coupon. In case of the Prepaid amount coupon, this will be also the currency of the coupon's amount. Note that the Prepaid coupon can be used only when its currency matches the reservation currency. For example, a prepaid coupon denominated in CHF can be used only with a reservation whose price is also denominated in CHF. It will not work with a reservation using e.g. EUR.
resource_ids string optional
The comma-separated resource IDs for which the coupon can be used. If empty, the coupon can be used will all resources of the site.
label string optional
Optional coupon's label. The label will be visible to the customer on the coupon purchase page instead of the standard coupon description.
is_personal bool optional
When true, the coupon can be used only by a single person identified by an email address. When false, the coupon can be used with different email addresses. Defaults to 'false'.
entry_per_person bool optional
Valid for the Number of entries coupon only. When true, one entry is counted per person. Otherwise, one entry is counted per reservation.
validity_limit_days int optional
Valid for the Prepaid amount, Number of hours and Number of entries coupons only. When the coupon usage is time limited, this is the number of days of the limit.
free_validity_limit_start_date bool optional
Valid for the Prepaid amount, Number of hours and Number of entries coupons only, when the coupon usage is time limited with validity_limit_days. The value of true means the customer can freely choose the first date of validity. Otherwise, coupon's validity always starts on the day the coupon is purchased.
validity_limit_relative_to string optional
Valid for the Prepaid amount, Number of hours and Number of entries coupons only, when the coupon usage is time limited with validity_limit_days. For the value of rental_creation, validity will be checked against the time when a reservation is being made. For arrival_departure, validity will be checked against the reservation's arrival and departure dates. Defaults to arrival_departure.
discount_amount int optional
For the Discount valid for given number of days type, this is the discount value in percent. Value between 0 and 100 is expected.
access_type string optional
Determines how the customer will access the coupon. If empty (default), the customer can freely choose the access method (email, code or both). For email the customer is limited to use email address, for code the customer has to use code and for email_and_code the customer has to use both email address and code.
purchase_limit int optional
You can limit the number of coupons of this type that your customers can purchase. For example, for 10, only up to 10 such coupons can be sold. Leave this field empty not to set any limit.
method string required
must be set to add_coupon_type
language string optional
by specifying a 2-letter (ISO 639-1) language code (all capital letters e.g. EN, DE, FR, ES, IT) you can change the language of the text values returned
api_key string required
your API key - Click here to get your key. If your API key uses a hash key, you must also include the parameters hash_key and hash_timestamp.

Output:

new_coupon_type_id int
ID of the new added coupon type

API playground:

Click here to test this function in the API playground.