How to apply discount coupon using API

Hello,

How to apply the discount coupon or voucher and let me know if any API. Please share the suggestion.

Thanks

Comments

  • Hello Taliv,

    Thank you for using our forums!

    To apply a discount code, you should make a rated query to the `/item` endpoint and include a `discount_code={code}` in the parameters. This will return a slip for the item that includes the discount. You can find more information in our documentation here:
    http://api.checkfront.com/ref/item.html?highlight=discount#item

    If an item already exists in your session and you are trying to add a discount code to it, then you should first get a new slip for the item using the above method. Once you have the slip, you can replace the existing slip using something like:
    `booking/session?session_id={session_id}&line_id={the_line_id_of_the_item}&slip={new_slip}`

    I hope this helps, and please let me know if you have any more questions.

    All the best,

    Chase
    Technical Support Analyst
    Checkfront | www.checkfront.com/contact | Email: support@checkfront.com

  • Thanks for your response, 

    How can I get line id for 'booking/session?session_id={session_id}&line_id={the_line_id_of_the_item}&slip={new_slip}' ?
    Is there any other API where can I find that?

  • Hi Taliv,

    The 'line_id' of the item is its position in the session. The first item has line_id of '1', the second is '2'.

    Package add-ons use decimals. The first add-on of the first item is '1.1'.

    You can see the line_ids of the items in the response from `booking/session`. Here is an example:
     "item": {
                   "1": { <---- this is the line_id
    "sku": "test",
    "item_id": 114,
    "name": "Testing",
    "unit": "D",
    "rate": {
    "total": "100.00",
    "item_total": "100.00",
    "qty": 3,
    "summary": "<strong title="Adults">Adults:</strong> 2 x 1 Day @ $50.00"
    },
    "date": {
    "summary": "Tue Sep 10, 2019",
    "start_date": 1568098800,
    "end_date": 1568098800
    },
    "slip": "114.20190910X1-additionalbed.0-adults.2-childs.1",
    "available": 17
    },

    Let me know if anything is still unclear.

    All the best,

    Chase
    Technical Support Analyst
    Checkfront | www.checkfront.com/contact | Email: support@checkfront.com
  • Thanks, Chase

    I have some confusion in the new slip. Is it mandatory to pass discount coupon or can i pass our related query parameter such as date, number of adults?
  • Hello Taliv,

    Thank you for your reply.

    I am not sure I understand what you are asking. In order to get a slip, you must make a rated query to the `/item` endpoint. A rated query is made by including at least a `start_date` parameter with your query. You can also optionally include the values for the booking parameters (number of adults). Please find more information about rated queries here:
    http://api.checkfront.com/ref/item.html?highlight=rated#item

    One of the optional parameters that can be included with a rated query is the `discount_code`. When making the query for the "new slip", you will need to include all of the parameters from your original query, but also add the `discount_code`.

    Query for original slip:
    /item/14?start_date=tomorrow&param[qty]=5

    Query for new slip with discount:
    /item/14?start_date=tomorrow&param[qty]=5&discount_code=mydiscount

    I hope this helps, but please let me know if I have misunderstood your question.

    All the best, 

    Chase
    Technical Support Analyst
    Checkfront | www.checkfront.com/contact | Email: support@checkfront.com
Sign In or Register to comment.