Update a discount
curl --request PATCH \
--url https://api.fungies.io/v0/discounts/{discountId}/update \
--header 'Content-Type: application/json' \
--header 'x-fngs-public-key: <api-key>' \
--header 'x-fngs-secret-key: <api-key>' \
--data '
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"name": "<string>",
"amount": 8.988465674311579e+307,
"discountCode": "<string>",
"validFrom": 4503599627370495,
"validUntil": 4503599627370495,
"purchaseLimit": "<string>",
"excludedOffers": [
"<string>"
],
"includedOffers": [
"<string>"
],
"includesAllOffers": true,
"timezone": "<string>"
}
'import requests
url = "https://api.fungies.io/v0/discounts/{discountId}/update"
payload = {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"name": "<string>",
"amount": 8.988465674311579e+307,
"discountCode": "<string>",
"validFrom": 4503599627370495,
"validUntil": 4503599627370495,
"purchaseLimit": "<string>",
"excludedOffers": ["<string>"],
"includedOffers": ["<string>"],
"includesAllOffers": True,
"timezone": "<string>"
}
headers = {
"x-fngs-public-key": "<api-key>",
"x-fngs-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'x-fngs-public-key': '<api-key>',
'x-fngs-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
type: '<string>',
name: '<string>',
amount: 8.988465674311579e+307,
discountCode: '<string>',
validFrom: 4503599627370495,
validUntil: 4503599627370495,
purchaseLimit: '<string>',
excludedOffers: ['<string>'],
includedOffers: ['<string>'],
includesAllOffers: true,
timezone: '<string>'
})
};
fetch('https://api.fungies.io/v0/discounts/{discountId}/update', 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.fungies.io/v0/discounts/{discountId}/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'type' => '<string>',
'name' => '<string>',
'amount' => 8.988465674311579e+307,
'discountCode' => '<string>',
'validFrom' => 4503599627370495,
'validUntil' => 4503599627370495,
'purchaseLimit' => '<string>',
'excludedOffers' => [
'<string>'
],
'includedOffers' => [
'<string>'
],
'includesAllOffers' => true,
'timezone' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-fngs-public-key: <api-key>",
"x-fngs-secret-key: <api-key>"
],
]);
$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://api.fungies.io/v0/discounts/{discountId}/update"
payload := strings.NewReader("{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"discountCode\": \"<string>\",\n \"validFrom\": 4503599627370495,\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"includesAllOffers\": true,\n \"timezone\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-fngs-public-key", "<api-key>")
req.Header.Add("x-fngs-secret-key", "<api-key>")
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.patch("https://api.fungies.io/v0/discounts/{discountId}/update")
.header("x-fngs-public-key", "<api-key>")
.header("x-fngs-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"discountCode\": \"<string>\",\n \"validFrom\": 4503599627370495,\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"includesAllOffers\": true,\n \"timezone\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fungies.io/v0/discounts/{discountId}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-fngs-public-key"] = '<api-key>'
request["x-fngs-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"discountCode\": \"<string>\",\n \"validFrom\": 4503599627370495,\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"includesAllOffers\": true,\n \"timezone\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"data": {
"discount": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": "<string>",
"excludedOffers": [
"<string>"
],
"object": "discount",
"name": null,
"discountCode": null,
"validFrom": null,
"validUntil": null,
"purchaseLimit": null,
"timesUsed": 0,
"includesAllOffers": false
}
}
}{
"status": "error",
"error": {
"message": "Sample error message"
}
}discounts
Update a discount
Update an existing discount’s details.
You can modify the name, amount, expiration, and other properties. Note: Changing the discount code may affect customers who have saved the old code.
PATCH
/
v0
/
discounts
/
{discountId}
/
update
Update a discount
curl --request PATCH \
--url https://api.fungies.io/v0/discounts/{discountId}/update \
--header 'Content-Type: application/json' \
--header 'x-fngs-public-key: <api-key>' \
--header 'x-fngs-secret-key: <api-key>' \
--data '
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"name": "<string>",
"amount": 8.988465674311579e+307,
"discountCode": "<string>",
"validFrom": 4503599627370495,
"validUntil": 4503599627370495,
"purchaseLimit": "<string>",
"excludedOffers": [
"<string>"
],
"includedOffers": [
"<string>"
],
"includesAllOffers": true,
"timezone": "<string>"
}
'import requests
url = "https://api.fungies.io/v0/discounts/{discountId}/update"
payload = {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"type": "<string>",
"name": "<string>",
"amount": 8.988465674311579e+307,
"discountCode": "<string>",
"validFrom": 4503599627370495,
"validUntil": 4503599627370495,
"purchaseLimit": "<string>",
"excludedOffers": ["<string>"],
"includedOffers": ["<string>"],
"includesAllOffers": True,
"timezone": "<string>"
}
headers = {
"x-fngs-public-key": "<api-key>",
"x-fngs-secret-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'x-fngs-public-key': '<api-key>',
'x-fngs-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
type: '<string>',
name: '<string>',
amount: 8.988465674311579e+307,
discountCode: '<string>',
validFrom: 4503599627370495,
validUntil: 4503599627370495,
purchaseLimit: '<string>',
excludedOffers: ['<string>'],
includedOffers: ['<string>'],
includesAllOffers: true,
timezone: '<string>'
})
};
fetch('https://api.fungies.io/v0/discounts/{discountId}/update', 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.fungies.io/v0/discounts/{discountId}/update",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'type' => '<string>',
'name' => '<string>',
'amount' => 8.988465674311579e+307,
'discountCode' => '<string>',
'validFrom' => 4503599627370495,
'validUntil' => 4503599627370495,
'purchaseLimit' => '<string>',
'excludedOffers' => [
'<string>'
],
'includedOffers' => [
'<string>'
],
'includesAllOffers' => true,
'timezone' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-fngs-public-key: <api-key>",
"x-fngs-secret-key: <api-key>"
],
]);
$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://api.fungies.io/v0/discounts/{discountId}/update"
payload := strings.NewReader("{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"discountCode\": \"<string>\",\n \"validFrom\": 4503599627370495,\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"includesAllOffers\": true,\n \"timezone\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-fngs-public-key", "<api-key>")
req.Header.Add("x-fngs-secret-key", "<api-key>")
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.patch("https://api.fungies.io/v0/discounts/{discountId}/update")
.header("x-fngs-public-key", "<api-key>")
.header("x-fngs-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"discountCode\": \"<string>\",\n \"validFrom\": 4503599627370495,\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"includesAllOffers\": true,\n \"timezone\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fungies.io/v0/discounts/{discountId}/update")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-fngs-public-key"] = '<api-key>'
request["x-fngs-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"discountCode\": \"<string>\",\n \"validFrom\": 4503599627370495,\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"includesAllOffers\": true,\n \"timezone\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "<string>",
"data": {
"discount": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": "<string>",
"excludedOffers": [
"<string>"
],
"object": "discount",
"name": null,
"discountCode": null,
"validFrom": null,
"validUntil": null,
"purchaseLimit": null,
"timesUsed": 0,
"includesAllOffers": false
}
}
}{
"status": "error",
"error": {
"message": "Sample error message"
}
}Path Parameters
PATCH /v0/discounts/:discountId/update Parameter
Body
application/json
PATCH /v0/discounts/:discountId/update Request body
Allowed value:
"code"Required range:
1 <= x <= 1.7976931348623157e+308Available options:
fixed, percentage Required range:
0 <= x <= 9007199254740991Required range:
0 <= x <= 9007199254740991Minimum string length:
1Available options:
AFN, ALL, DZD, AOA, ARS, AMD, AWG, AUD, AZN, BSD, BDT, BBD, BZD, BMD, BOB, BAM, BWP, BRL, BHD, GBP, BND, BGN, BIF, BYN, KHR, CAD, CVE, KYD, KWD, XAF, XPF, CLP, CNY, COP, KMF, CDF, CRC, HRK, CZK, DKK, DJF, DOP, XCD, EGP, ETB, EUR, FKP, FJD, GMD, GEL, GIP, GTQ, GNF, GYD, HTG, HNL, HKD, HUF, ISK, INR, IDR, ILS, JMD, JPY, JOD, KZT, KES, KGS, LAK, LBP, LSL, LRD, MOP, MKD, MGA, MWK, MYR, MVR, MRO, MUR, MXN, MDL, MNT, MAD, MZN, MMK, NAD, NPR, ANG, TWD, NZD, NIO, NGN, NOK, OMR, PKR, PAB, PGK, PYG, PEN, PHP, PLN, QAR, RON, RUB, RWF, SHP, SVC, WST, STD, SAR, RSD, SCR, SLL, SGD, SBD, SOS, ZAR, KRW, LKR, SRD, SZL, SEK, CHF, TJS, TZS, THB, TND, TOP, TTD, TRY, UGX, UAH, AED, UYU, USD, UZS, VUV, VEF, VND, XOF, YER, ZMW, SLE, XCG, SSP, VES, MRU, STN, VED Available options:
active, inactive ⌘I