curl --request POST \
--url https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem \
--header 'Content-Type: application/json' \
--data '
[
"6679b89b-f37c-46d0-a3cd-0a25302e75a9",
"168f3e64-da3f-4f48-acbb-552d66110e77"
]
'import requests
url = "https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem"
payload = ["6679b89b-f37c-46d0-a3cd-0a25302e75a9", "168f3e64-da3f-4f48-acbb-552d66110e77"]
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(['6679b89b-f37c-46d0-a3cd-0a25302e75a9', '168f3e64-da3f-4f48-acbb-552d66110e77'])
};
fetch('https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem', 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://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem",
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([
'6679b89b-f37c-46d0-a3cd-0a25302e75a9',
'168f3e64-da3f-4f48-acbb-552d66110e77'
]),
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 := "https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem"
payload := strings.NewReader("[\n \"6679b89b-f37c-46d0-a3cd-0a25302e75a9\",\n \"168f3e64-da3f-4f48-acbb-552d66110e77\"\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("https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem")
.header("Content-Type", "application/json")
.body("[\n \"6679b89b-f37c-46d0-a3cd-0a25302e75a9\",\n \"168f3e64-da3f-4f48-acbb-552d66110e77\"\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n \"6679b89b-f37c-46d0-a3cd-0a25302e75a9\",\n \"168f3e64-da3f-4f48-acbb-552d66110e77\"\n]"
response = http.request(request)
puts response.read_body{
"couponIds": [
"6679b89b-f37c-46d0-a3cd-0a25302e75a9",
"168f3e64-da3f-4f48-acbb-552d66110e77"
]
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Redeem coupons (v1)
Deprecated. Use POST /v2/customers/{customerId}/coupons/redeem, which also takes the store, the receipt id and the discount each coupon granted.
The body is the list of coupon ids the sale used. Lobyco adds a redemption to every coupon it finds, counts it against the offer’s limits and releases the coupon’s reservation. An unknown coupon id is reported in the 400 response, and the other coupons are still redeemed.
Send the sale’s receipt id as the Idempotency-Key header: a repeated call with the same key redeems nothing twice, a multi-use coupon counts one redemption per key, and a return of that receipt can give the coupons back. The header is optional for compatibility only.
curl --request POST \
--url https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem \
--header 'Content-Type: application/json' \
--data '
[
"6679b89b-f37c-46d0-a3cd-0a25302e75a9",
"168f3e64-da3f-4f48-acbb-552d66110e77"
]
'import requests
url = "https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem"
payload = ["6679b89b-f37c-46d0-a3cd-0a25302e75a9", "168f3e64-da3f-4f48-acbb-552d66110e77"]
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(['6679b89b-f37c-46d0-a3cd-0a25302e75a9', '168f3e64-da3f-4f48-acbb-552d66110e77'])
};
fetch('https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem', 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://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem",
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([
'6679b89b-f37c-46d0-a3cd-0a25302e75a9',
'168f3e64-da3f-4f48-acbb-552d66110e77'
]),
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 := "https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem"
payload := strings.NewReader("[\n \"6679b89b-f37c-46d0-a3cd-0a25302e75a9\",\n \"168f3e64-da3f-4f48-acbb-552d66110e77\"\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("https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem")
.header("Content-Type", "application/json")
.body("[\n \"6679b89b-f37c-46d0-a3cd-0a25302e75a9\",\n \"168f3e64-da3f-4f48-acbb-552d66110e77\"\n]")
.asString();require 'uri'
require 'net/http'
url = URI("https://{host}/coupon/api/v1/customers/{customerId}/coupons/redeem")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n \"6679b89b-f37c-46d0-a3cd-0a25302e75a9\",\n \"168f3e64-da3f-4f48-acbb-552d66110e77\"\n]"
response = http.request(request)
puts response.read_body{
"couponIds": [
"6679b89b-f37c-46d0-a3cd-0a25302e75a9",
"168f3e64-da3f-4f48-acbb-552d66110e77"
]
}{
"name": "<string>",
"message": "<string>",
"details": null
}{
"name": "<string>",
"message": "<string>",
"details": null
}Headers
Body
The ids of the coupons the sale used, exactly as the coupon list returned them. At least one.