Get Discount
curl --request GET \
--url https://api.launchmystore.io/api/v1/discounts/{id}.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.launchmystore.io/api/v1/discounts/{id}.json"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.launchmystore.io/api/v1/discounts/{id}.json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/api/v1/discounts/{id}.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/api/v1/discounts/{id}.json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.launchmystore.io/api/v1/discounts/{id}.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/discounts/{id}.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": 123,
"state": "<string>",
"message": "<string>",
"data": {
"couponId": "<string>",
"code": "<string>",
"type": "<string>",
"status": "<string>",
"discountPercentage": 123,
"discountAmount": 123,
"maxDiscount": 123,
"minOrderCondition": "<string>",
"minOrderValue": 123,
"minOrderQuantity": 123,
"minOrderTotal": 123,
"usesPerCustomer": 123,
"usesPerOrder": 123,
"totalCoupons": 123,
"usedCount": 123,
"discountProvided": 123,
"applyOnProducts": [
{}
],
"showCoupon": true,
"onlinePayments": true,
"validForNewCustomers": true,
"autoApply": true,
"buyQuantity": 123,
"getQuantity": 123,
"freeShippingCondition": "<string>",
"freeShippingAmount": 123,
"freebie": [
{}
],
"startDate": "<string>",
"endDate": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Discounts
Get Discount
Retrieve a single discount code
GET
/
api
/
v1
/
discounts
/
{id}
.json
Get Discount
curl --request GET \
--url https://api.launchmystore.io/api/v1/discounts/{id}.json \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.launchmystore.io/api/v1/discounts/{id}.json"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.launchmystore.io/api/v1/discounts/{id}.json', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/api/v1/discounts/{id}.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/api/v1/discounts/{id}.json"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.launchmystore.io/api/v1/discounts/{id}.json")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/api/v1/discounts/{id}.json")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": 123,
"state": "<string>",
"message": "<string>",
"data": {
"couponId": "<string>",
"code": "<string>",
"type": "<string>",
"status": "<string>",
"discountPercentage": 123,
"discountAmount": 123,
"maxDiscount": 123,
"minOrderCondition": "<string>",
"minOrderValue": 123,
"minOrderQuantity": 123,
"minOrderTotal": 123,
"usesPerCustomer": 123,
"usesPerOrder": 123,
"totalCoupons": 123,
"usedCount": 123,
"discountProvided": 123,
"applyOnProducts": [
{}
],
"showCoupon": true,
"onlinePayments": true,
"validForNewCustomers": true,
"autoApply": true,
"buyQuantity": 123,
"getQuantity": 123,
"freeShippingCondition": "<string>",
"freeShippingAmount": 123,
"freebie": [
{}
],
"startDate": "<string>",
"endDate": "<string>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}Get Discount
Returns a single discount code by its ID.Request
curl -X GET "https://api.launchmystore.io/api/v1/discounts/disc_abc123.json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
const response = await fetch('https://api.launchmystore.io/api/v1/discounts/disc_abc123.json', {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
}
});
Path Parameters
string
required
The unique discount ID
Response
Returns the standard response envelope with the discount underdata.discount.
integer
HTTP status code
string
Result state, e.g.
successstring
Human-readable message (may be
null)object
Wrapper containing the
discountShow Discount Object
Show Discount Object
string
Unique discount ID
string
Discount code
string
Discount type:
Percentage, Flat, BuyXGetY, FreeShipping, Freebiestring
Current status:
Active, Inactivenumber
Discount percentage (for
Percentage type)number
Flat discount amount (for
Flat type)number
Maximum discount cap
string
Minimum order condition:
OrderQuantity, OrderValuenumber
Minimum order value to apply the discount
number
Minimum item quantity to apply the discount
number
Minimum order total after which the coupon applies
integer
Maximum uses per customer
integer
Maximum uses per order
integer
Total redemptions allowed
integer
Number of times used
number
Total discount provided across redemptions
array
Product IDs the discount applies to
boolean
Whether the coupon is shown publicly
boolean
Whether limited to online payments
boolean
Whether limited to new customers
boolean
Whether the coupon auto-applies
integer
Buy quantity (for
BuyXGetY type)integer
Get quantity (for
BuyXGetY type)string
Free shipping condition:
EveryPurchase, AboveCertainAmountnumber
Threshold for
AboveCertainAmount free shippingarray
Freebie items (for
Freebie type)string
Start date
string
End date
string
Creation timestamp (ISO 8601)
string
Last update timestamp (ISO 8601)
Example Response
{
"status": 200,
"state": "success",
"message": null,
"data": {
"discount": {
"couponId": "disc_abc123",
"code": "SUMMER20",
"type": "Percentage",
"status": "Active",
"discountPercentage": 20,
"discountAmount": null,
"maxDiscount": 50,
"minOrderCondition": "OrderValue",
"minOrderValue": 50,
"minOrderQuantity": null,
"minOrderTotal": 50,
"usesPerCustomer": 1,
"usesPerOrder": null,
"totalCoupons": 500,
"usedCount": 145,
"discountProvided": 1450,
"applyOnProducts": [],
"showCoupon": true,
"onlinePayments": false,
"validForNewCustomers": false,
"autoApply": false,
"buyQuantity": null,
"getQuantity": null,
"freeShippingCondition": "EveryPurchase",
"freeShippingAmount": 0,
"freebie": [],
"startDate": "2024-06-01",
"endDate": "2024-08-31",
"storeId": "store_abc123",
"createdAt": "2024-05-15T10:00:00.000Z",
"updatedAt": "2024-05-15T10:00:00.000Z"
}
}
}
Errors
On failure the same envelope is returned withstate: "error" and a message:
{
"status": 404,
"state": "error",
"message": "Discount not found",
"data": null
}
| Status | Condition |
|---|---|
401 | Invalid or missing access token |
403 | App doesn’t have read_discounts scope |
404 | Discount with the specified ID does not exist |