Skip to main content
POST
/
v0
/
discounts
/
create
Create a new discount
curl --request POST \
  --url https://api.fungies.io/v0/discounts/create \
  --header 'Content-Type: application/json' \
  --header 'x-fngs-public-key: <api-key>' \
  --header 'x-fngs-secret-key: <api-key>' \
  --data '
{
  "type": "<string>",
  "amount": 8.988465674311579e+307,
  "validFrom": 4503599627370495,
  "excludedOffers": [
    "<string>"
  ],
  "includedOffers": [
    "<string>"
  ],
  "timezone": "<string>",
  "name": "<string>",
  "discountCode": "<string>",
  "validUntil": 4503599627370495,
  "purchaseLimit": "<string>",
  "includesAllOffers": true
}
'
import requests

url = "https://api.fungies.io/v0/discounts/create"

payload = {
"type": "<string>",
"amount": 8.988465674311579e+307,
"validFrom": 4503599627370495,
"excludedOffers": ["<string>"],
"includedOffers": ["<string>"],
"timezone": "<string>",
"name": "<string>",
"discountCode": "<string>",
"validUntil": 4503599627370495,
"purchaseLimit": "<string>",
"includesAllOffers": True
}
headers = {
"x-fngs-public-key": "<api-key>",
"x-fngs-secret-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {
'x-fngs-public-key': '<api-key>',
'x-fngs-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: '<string>',
amount: 8.988465674311579e+307,
validFrom: 4503599627370495,
excludedOffers: ['<string>'],
includedOffers: ['<string>'],
timezone: '<string>',
name: '<string>',
discountCode: '<string>',
validUntil: 4503599627370495,
purchaseLimit: '<string>',
includesAllOffers: true
})
};

fetch('https://api.fungies.io/v0/discounts/create', 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/create",
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([
'type' => '<string>',
'amount' => 8.988465674311579e+307,
'validFrom' => 4503599627370495,
'excludedOffers' => [
'<string>'
],
'includedOffers' => [
'<string>'
],
'timezone' => '<string>',
'name' => '<string>',
'discountCode' => '<string>',
'validUntil' => 4503599627370495,
'purchaseLimit' => '<string>',
'includesAllOffers' => true
]),
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/create"

payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"validFrom\": 4503599627370495,\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\",\n \"name\": \"<string>\",\n \"discountCode\": \"<string>\",\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"includesAllOffers\": true\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.fungies.io/v0/discounts/create")
.header("x-fngs-public-key", "<api-key>")
.header("x-fngs-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"validFrom\": 4503599627370495,\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\",\n \"name\": \"<string>\",\n \"discountCode\": \"<string>\",\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"includesAllOffers\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fungies.io/v0/discounts/create")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-fngs-public-key"] = '<api-key>'
request["x-fngs-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"amount\": 8.988465674311579e+307,\n \"validFrom\": 4503599627370495,\n \"excludedOffers\": [\n \"<string>\"\n ],\n \"includedOffers\": [\n \"<string>\"\n ],\n \"timezone\": \"<string>\",\n \"name\": \"<string>\",\n \"discountCode\": \"<string>\",\n \"validUntil\": 4503599627370495,\n \"purchaseLimit\": \"<string>\",\n \"includesAllOffers\": true\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"
}
}

Authorizations

x-fngs-public-key
string
header
required
x-fngs-secret-key
string
header
required

Body

application/json

POST /v0/discounts/create Request body

type
required
Allowed value: "code"
amount
number<double>
required
Required range: 1 <= x <= 1.7976931348623157e+308
amountType
enum<string>
required
Available options:
fixed,
percentage
validFrom
integer<int64> | null
required
Required range: 0 <= x <= 9007199254740991
excludedOffers
string[]
required
includedOffers
string[]
required
currency
enum<string>
required
Available 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
status
enum<string>
required
Available options:
active,
inactive
timezone
string
required
name
string
discountCode
string
validUntil
integer<int64> | null
Required range: 0 <= x <= 9007199254740991
purchaseLimit
Minimum string length: 1
includesAllOffers
boolean

Response

POST /v0/discounts/create Positive response

status
string
required
Allowed value: "success"
data
object
required