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
The unique discount ID
Response
Returns the standard response envelope with the discount underdata.discount.
HTTP status code
Result state, e.g.
successHuman-readable message (may be
null)Wrapper containing the
discountShow Discount Object
Show Discount Object
Unique discount ID
Discount code
Discount type:
Percentage, Flat, BuyXGetY, FreeShipping, FreebieCurrent status:
Active, InactiveDiscount percentage (for
Percentage type)Flat discount amount (for
Flat type)Maximum discount cap
Minimum order condition:
OrderQuantity, OrderValueMinimum order value to apply the discount
Minimum item quantity to apply the discount
Minimum order total after which the coupon applies
Maximum uses per customer
Maximum uses per order
Total redemptions allowed
Number of times used
Total discount provided across redemptions
Product IDs the discount applies to
Whether the coupon is shown publicly
Whether limited to online payments
Whether limited to new customers
Whether the coupon auto-applies
Buy quantity (for
BuyXGetY type)Get quantity (for
BuyXGetY type)Free shipping condition:
EveryPurchase, AboveCertainAmountThreshold for
AboveCertainAmount free shippingFreebie items (for
Freebie type)Start date
End date
Creation timestamp (ISO 8601)
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 |
⌘I