Apply Discount to Cart
curl --request POST \
--url http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId} \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>"
}
'import requests
url = "http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}"
payload = { "code": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>'})
};
fetch('http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}', 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 => "http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}"
payload := strings.NewReader("{\n \"code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"msg": "<string>",
"data": {
"entityId": "<string>",
"shop": "<string>",
"email": null,
"items": [
{
"setAttributesForVariants": true,
"_id": "<string>",
"name": "<string>",
"shop": "<string>",
"tags": [
{
"_id": "<string>",
"name": "<string>",
"tempId": "<string>",
"shop": "<string>",
"__v": 123,
"slug": "<string>",
"productCount": 123,
"imageUrl": "<string>"
}
],
"costPrice": 123,
"price": 123,
"sku": "<string>",
"sale_price": 123,
"stock": 123,
"alwaysInStock": true,
"media": "<string>",
"media_type": "<string>",
"digital": true,
"draft": true,
"type": "<string>",
"variantsInheritPrice": true,
"slug": "<string>",
"__v": 123,
"qty": 123,
"originalPrice": 123,
"finalPrice": 123,
"subTotal": 123,
"downloadCount": 123,
"downloadLimit": null,
"cartItemId": "<string>"
}
],
"subTotal": 123,
"total": 123,
"created": "<string>",
"_id": "<string>",
"discountsApplied": [
{
"usageRestriction": {
"roles": {
"exclude": "<array>",
"accept": "<array>"
},
"users": {
"condition": "<string>",
"contains": "<array>"
},
"tags": {
"condition": "<string>",
"contains": "<array>"
},
"products": {
"condition": "<string>",
"contains": "<array>"
},
"categories": {
"condition": "<string>",
"contains": "<array>"
}
},
"usageLimit": {
"useIfNumberOfOrders": {
"count": null
},
"maxNumberOfUses": 123,
"canUseWithOtherCoupons": true,
"maxNumberOfUsesPerUser": null
},
"_id": "<string>",
"shop": "<string>",
"code_type": "<string>",
"amount": 123,
"min_order": null,
"max_order": null,
"starts": "<string>",
"expires": null,
"code": "<string>",
"description": "<string>",
"usageCount": 123,
"applyOn": "<string>",
"applyAutomatically": true,
"created": "<string>",
"isActive": true,
"uuid": "<string>",
"mediaType": "<string>",
"url": "<string>",
"isPublic": true,
"__v": 123,
"worth": 123
}
],
"discountAmount": 123,
"shipping": 123,
"shippingRate": {},
"user": "<string>",
"exclusiveDiscount": true,
"order": null
},
"success": true
}Cart
Apply Discount to Cart
Host: http://qshop.ng
POST
/
shops
/
{shopId}
/
applydiscount
/
cart
/
{cartId}
Apply Discount to Cart
curl --request POST \
--url http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId} \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>"
}
'import requests
url = "http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}"
payload = { "code": "<string>" }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>'})
};
fetch('http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}', 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 => "http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}"
payload := strings.NewReader("{\n \"code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://staging.qshop.ng/apiv2/shops/{shopId}/applydiscount/cart/{cartId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"msg": "<string>",
"data": {
"entityId": "<string>",
"shop": "<string>",
"email": null,
"items": [
{
"setAttributesForVariants": true,
"_id": "<string>",
"name": "<string>",
"shop": "<string>",
"tags": [
{
"_id": "<string>",
"name": "<string>",
"tempId": "<string>",
"shop": "<string>",
"__v": 123,
"slug": "<string>",
"productCount": 123,
"imageUrl": "<string>"
}
],
"costPrice": 123,
"price": 123,
"sku": "<string>",
"sale_price": 123,
"stock": 123,
"alwaysInStock": true,
"media": "<string>",
"media_type": "<string>",
"digital": true,
"draft": true,
"type": "<string>",
"variantsInheritPrice": true,
"slug": "<string>",
"__v": 123,
"qty": 123,
"originalPrice": 123,
"finalPrice": 123,
"subTotal": 123,
"downloadCount": 123,
"downloadLimit": null,
"cartItemId": "<string>"
}
],
"subTotal": 123,
"total": 123,
"created": "<string>",
"_id": "<string>",
"discountsApplied": [
{
"usageRestriction": {
"roles": {
"exclude": "<array>",
"accept": "<array>"
},
"users": {
"condition": "<string>",
"contains": "<array>"
},
"tags": {
"condition": "<string>",
"contains": "<array>"
},
"products": {
"condition": "<string>",
"contains": "<array>"
},
"categories": {
"condition": "<string>",
"contains": "<array>"
}
},
"usageLimit": {
"useIfNumberOfOrders": {
"count": null
},
"maxNumberOfUses": 123,
"canUseWithOtherCoupons": true,
"maxNumberOfUsesPerUser": null
},
"_id": "<string>",
"shop": "<string>",
"code_type": "<string>",
"amount": 123,
"min_order": null,
"max_order": null,
"starts": "<string>",
"expires": null,
"code": "<string>",
"description": "<string>",
"usageCount": 123,
"applyOn": "<string>",
"applyAutomatically": true,
"created": "<string>",
"isActive": true,
"uuid": "<string>",
"mediaType": "<string>",
"url": "<string>",
"isPublic": true,
"__v": 123,
"worth": 123
}
],
"discountAmount": 123,
"shipping": 123,
"shippingRate": {},
"user": "<string>",
"exclusiveDiscount": true,
"order": null
},
"success": true
}Was this page helpful?
⌘I