Checkout API apply discount

sardarusama4106
Tourist
15 0 0

Hi everyone, I am using the Checkout API to create and manage my checkout. But I'm unable to find out how to apply discount code on checkout because I didn't find any API call or any method to update my checkout.
How can I achieve this?

Reply 1 (1)

sardarusama4106
Tourist
15 0 0

Ok i found that we can achieve this by requesting a post request on checkout api and providing the following data in the body of the request:

https://api-key:password@shop_name.myshopify.com/admin/api/2019-10/checkouts/token.json

{
  "checkout":{
      "discount_code":"free123"
  }
}