API - Planyo Web Services - apply_coupon

Ti trovi qui: Planyo » Aiuto » API » apply_coupon

apply_coupon

Description:

Use this function to apply a coupon to an existing reservation. Coupon is passed as either the coupon_id or coupon_code parameter. Please note that coupons can be only applied to unconfirmed reservations.

Input:

reservation_id int optional
ID of the reservation. Required unless reservation_ids is used.
reservation_ids string optional
You can optionally pass multiple comma-separated reservation IDs (max 50) in this parameter. If this parameter is passed, you may NOT pass any value in the parameter reservation_id. To apply the same coupon code or coupon ID to all reservations, pass a single value in coupon_code or coupon_id. For multiple values (different for each reservation), pass multiple comma-separated values corresponding to reservation_ids passed in the parameters named coupon_codes or coupon_ids. Note that the JSON data returned by an API call with this parameter will be different. The 'data' key will be an array with reservation IDs as keys and the values corresponding to the standard output of this function (see the Output section below) for given reservation ID.
coupon_code string optional
Coupon code. If coupon_id is passed, this parameter is ignored.
coupon_id int optional
Numeric coupon ID. You can get the coupon ID from the results of the list_coupons function. This parameter is optional, and, if not passed, the precise coupon ID will be detected based on coupon_id and/or customer's email address.
method string required
must be set to apply_coupon
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:

coupon_id int
ID of the coupon which was applied
coupon_type int
Type of the coupon which was applied. See the type field on list_coupon_types for the possible values.
amount_used float
Depending on the coupon type, this can be: prepaid amount, number of hours or number of entries.
user_text string
Reservation status from user's perspective.
status ReservationStatus
Reservation status.

API playground:

Click here to test this function in the API playground.