curl --request POST \
--url https://api.dintero.com/v1/accounts/{aid}/discounts/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requirement": {
"purchase_from": "2023-11-07T05:31:56Z",
"purchase_to": "2023-11-07T05:31:56Z",
"customer": {
"addresses": [
{
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
],
"custom_type": [
"offsite"
],
"type": [
"custom"
]
}
],
"company": {
"bussiness_name": [
"TKP tech AS"
],
"department": [
"production",
"research"
],
"industry": [
"J62.0.1",
"J62.0.2"
],
"number_of_employees": [
"20"
],
"organization_number": [
"123456789MVA"
],
"website": [
"https://dintero.com"
]
},
"date_of_birth": [
"1990-09-20",
"1990-05-10"
],
"enrolled_by": {
"type": [
"url"
],
"value": [
"https://mypage.example.dintero.com"
]
},
"favorite_store": [
"sc029"
],
"first_name": [
"John"
],
"gender": [
"male"
],
"last_name": [
"Doe"
],
"marketing_consent": {
"email": {
"consent": [
"true"
]
},
"sms": {
"consent": [
"true"
]
}
},
"status": [
"vip"
],
"term": {
"id": [
"<string>"
]
},
"type": [
"<string>"
],
"attributes": {}
},
"item": {
"quantity": 0,
"mixes": [
{
"quantity": 1,
"reward_eligible": true,
"items": [
{
"id": "b714118"
},
{
"group_id": "g4"
}
]
}
],
"items": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"store_ids": [
"sc029"
],
"gross_amount": 0,
"net_amount": 0,
"currencies": [
{
"anything-but": [
"NOK"
]
}
],
"stamp": 5,
"discount_code": "TACO",
"store": {
"id": [
"sc029"
],
"name": [
"SC Oslo"
],
"business_name": [
"SC Oslo AS"
],
"address": {
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
]
},
"chain": [
"SuperChain"
],
"email": [
"contact@superchain.com"
],
"gln": [
"5790001398644"
],
"organization_number": [
"123456789MVA"
],
"phone_number": [
"+4738260107"
],
"mcc": [
5814
],
"mcc_ranges": [
{
"start": 5814,
"end": 5815
}
],
"bax": [
"102603"
],
"terminal_id": [
"T0292"
]
}
},
"reward": {
"value": 10000,
"values": [
{
"items": [
{
"id": "b714118",
"group_id": "B1"
}
],
"value": 123
}
],
"base": "gross",
"effect": "discount"
}
}
'import requests
url = "https://api.dintero.com/v1/accounts/{aid}/discounts/rules"
payload = {
"requirement": {
"purchase_from": "2023-11-07T05:31:56Z",
"purchase_to": "2023-11-07T05:31:56Z",
"customer": {
"addresses": [
{
"country": ["NO"],
"postal_code": ["0349"],
"postal_place": ["Oslo"],
"custom_type": ["offsite"],
"type": ["custom"]
}
],
"company": {
"bussiness_name": ["TKP tech AS"],
"department": ["production", "research"],
"industry": ["J62.0.1", "J62.0.2"],
"number_of_employees": ["20"],
"organization_number": ["123456789MVA"],
"website": ["https://dintero.com"]
},
"date_of_birth": ["1990-09-20", "1990-05-10"],
"enrolled_by": {
"type": ["url"],
"value": ["https://mypage.example.dintero.com"]
},
"favorite_store": ["sc029"],
"first_name": ["John"],
"gender": ["male"],
"last_name": ["Doe"],
"marketing_consent": {
"email": { "consent": ["true"] },
"sms": { "consent": ["true"] }
},
"status": ["vip"],
"term": { "id": ["<string>"] },
"type": ["<string>"],
"attributes": {}
},
"item": {
"quantity": 0,
"mixes": [
{
"quantity": 1,
"reward_eligible": True,
"items": [{ "id": "b714118" }, { "group_id": "g4" }]
}
],
"items": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"store_ids": ["sc029"],
"gross_amount": 0,
"net_amount": 0,
"currencies": [{ "anything-but": ["NOK"] }],
"stamp": 5,
"discount_code": "TACO",
"store": {
"id": ["sc029"],
"name": ["SC Oslo"],
"business_name": ["SC Oslo AS"],
"address": {
"country": ["NO"],
"postal_code": ["0349"],
"postal_place": ["Oslo"]
},
"chain": ["SuperChain"],
"email": ["contact@superchain.com"],
"gln": ["5790001398644"],
"organization_number": ["123456789MVA"],
"phone_number": ["+4738260107"],
"mcc": [5814],
"mcc_ranges": [
{
"start": 5814,
"end": 5815
}
],
"bax": ["102603"],
"terminal_id": ["T0292"]
}
},
"reward": {
"value": 10000,
"values": [
{
"items": [
{
"id": "b714118",
"group_id": "B1"
}
],
"value": 123
}
],
"base": "gross",
"effect": "discount"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
requirement: {
purchase_from: '2023-11-07T05:31:56Z',
purchase_to: '2023-11-07T05:31:56Z',
customer: {
addresses: [
{
country: ['NO'],
postal_code: ['0349'],
postal_place: ['Oslo'],
custom_type: ['offsite'],
type: ['custom']
}
],
company: {
bussiness_name: ['TKP tech AS'],
department: ['production', 'research'],
industry: ['J62.0.1', 'J62.0.2'],
number_of_employees: ['20'],
organization_number: ['123456789MVA'],
website: ['https://dintero.com']
},
date_of_birth: ['1990-09-20', '1990-05-10'],
enrolled_by: {type: ['url'], value: ['https://mypage.example.dintero.com']},
favorite_store: ['sc029'],
first_name: ['John'],
gender: ['male'],
last_name: ['Doe'],
marketing_consent: {email: {consent: ['true']}, sms: {consent: ['true']}},
status: ['vip'],
term: {id: ['<string>']},
type: ['<string>'],
attributes: {}
},
item: {
quantity: 0,
mixes: [
{quantity: 1, reward_eligible: true, items: [{id: 'b714118'}, {group_id: 'g4'}]}
],
items: [{id: 'b714118', group_id: 'B1'}]
},
store_ids: ['sc029'],
gross_amount: 0,
net_amount: 0,
currencies: [{'anything-but': ['NOK']}],
stamp: 5,
discount_code: 'TACO',
store: {
id: ['sc029'],
name: ['SC Oslo'],
business_name: ['SC Oslo AS'],
address: {country: ['NO'], postal_code: ['0349'], postal_place: ['Oslo']},
chain: ['SuperChain'],
email: ['contact@superchain.com'],
gln: ['5790001398644'],
organization_number: ['123456789MVA'],
phone_number: ['+4738260107'],
mcc: [5814],
mcc_ranges: [{start: 5814, end: 5815}],
bax: ['102603'],
terminal_id: ['T0292']
}
},
reward: {
value: 10000,
values: [{items: [{id: 'b714118', group_id: 'B1'}], value: 123}],
base: 'gross',
effect: 'discount'
}
})
};
fetch('https://api.dintero.com/v1/accounts/{aid}/discounts/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dintero.com/v1/accounts/{aid}/discounts/rules"
payload := strings.NewReader("{\n \"requirement\": {\n \"purchase_from\": \"2023-11-07T05:31:56Z\",\n \"purchase_to\": \"2023-11-07T05:31:56Z\",\n \"customer\": {\n \"addresses\": [\n {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ],\n \"custom_type\": [\n \"offsite\"\n ],\n \"type\": [\n \"custom\"\n ]\n }\n ],\n \"company\": {\n \"bussiness_name\": [\n \"TKP tech AS\"\n ],\n \"department\": [\n \"production\",\n \"research\"\n ],\n \"industry\": [\n \"J62.0.1\",\n \"J62.0.2\"\n ],\n \"number_of_employees\": [\n \"20\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"website\": [\n \"https://dintero.com\"\n ]\n },\n \"date_of_birth\": [\n \"1990-09-20\",\n \"1990-05-10\"\n ],\n \"enrolled_by\": {\n \"type\": [\n \"url\"\n ],\n \"value\": [\n \"https://mypage.example.dintero.com\"\n ]\n },\n \"favorite_store\": [\n \"sc029\"\n ],\n \"first_name\": [\n \"John\"\n ],\n \"gender\": [\n \"male\"\n ],\n \"last_name\": [\n \"Doe\"\n ],\n \"marketing_consent\": {\n \"email\": {\n \"consent\": [\n \"true\"\n ]\n },\n \"sms\": {\n \"consent\": [\n \"true\"\n ]\n }\n },\n \"status\": [\n \"vip\"\n ],\n \"term\": {\n \"id\": [\n \"<string>\"\n ]\n },\n \"type\": [\n \"<string>\"\n ],\n \"attributes\": {}\n },\n \"item\": {\n \"quantity\": 0,\n \"mixes\": [\n {\n \"quantity\": 1,\n \"reward_eligible\": true,\n \"items\": [\n {\n \"id\": \"b714118\"\n },\n {\n \"group_id\": \"g4\"\n }\n ]\n }\n ],\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ]\n },\n \"store_ids\": [\n \"sc029\"\n ],\n \"gross_amount\": 0,\n \"net_amount\": 0,\n \"currencies\": [\n {\n \"anything-but\": [\n \"NOK\"\n ]\n }\n ],\n \"stamp\": 5,\n \"discount_code\": \"TACO\",\n \"store\": {\n \"id\": [\n \"sc029\"\n ],\n \"name\": [\n \"SC Oslo\"\n ],\n \"business_name\": [\n \"SC Oslo AS\"\n ],\n \"address\": {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ]\n },\n \"chain\": [\n \"SuperChain\"\n ],\n \"email\": [\n \"contact@superchain.com\"\n ],\n \"gln\": [\n \"5790001398644\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"phone_number\": [\n \"+4738260107\"\n ],\n \"mcc\": [\n 5814\n ],\n \"mcc_ranges\": [\n {\n \"start\": 5814,\n \"end\": 5815\n }\n ],\n \"bax\": [\n \"102603\"\n ],\n \"terminal_id\": [\n \"T0292\"\n ]\n }\n },\n \"reward\": {\n \"value\": 10000,\n \"values\": [\n {\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ],\n \"value\": 123\n }\n ],\n \"base\": \"gross\",\n \"effect\": \"discount\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.dintero.com/v1/accounts/{aid}/discounts/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requirement\": {\n \"purchase_from\": \"2023-11-07T05:31:56Z\",\n \"purchase_to\": \"2023-11-07T05:31:56Z\",\n \"customer\": {\n \"addresses\": [\n {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ],\n \"custom_type\": [\n \"offsite\"\n ],\n \"type\": [\n \"custom\"\n ]\n }\n ],\n \"company\": {\n \"bussiness_name\": [\n \"TKP tech AS\"\n ],\n \"department\": [\n \"production\",\n \"research\"\n ],\n \"industry\": [\n \"J62.0.1\",\n \"J62.0.2\"\n ],\n \"number_of_employees\": [\n \"20\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"website\": [\n \"https://dintero.com\"\n ]\n },\n \"date_of_birth\": [\n \"1990-09-20\",\n \"1990-05-10\"\n ],\n \"enrolled_by\": {\n \"type\": [\n \"url\"\n ],\n \"value\": [\n \"https://mypage.example.dintero.com\"\n ]\n },\n \"favorite_store\": [\n \"sc029\"\n ],\n \"first_name\": [\n \"John\"\n ],\n \"gender\": [\n \"male\"\n ],\n \"last_name\": [\n \"Doe\"\n ],\n \"marketing_consent\": {\n \"email\": {\n \"consent\": [\n \"true\"\n ]\n },\n \"sms\": {\n \"consent\": [\n \"true\"\n ]\n }\n },\n \"status\": [\n \"vip\"\n ],\n \"term\": {\n \"id\": [\n \"<string>\"\n ]\n },\n \"type\": [\n \"<string>\"\n ],\n \"attributes\": {}\n },\n \"item\": {\n \"quantity\": 0,\n \"mixes\": [\n {\n \"quantity\": 1,\n \"reward_eligible\": true,\n \"items\": [\n {\n \"id\": \"b714118\"\n },\n {\n \"group_id\": \"g4\"\n }\n ]\n }\n ],\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ]\n },\n \"store_ids\": [\n \"sc029\"\n ],\n \"gross_amount\": 0,\n \"net_amount\": 0,\n \"currencies\": [\n {\n \"anything-but\": [\n \"NOK\"\n ]\n }\n ],\n \"stamp\": 5,\n \"discount_code\": \"TACO\",\n \"store\": {\n \"id\": [\n \"sc029\"\n ],\n \"name\": [\n \"SC Oslo\"\n ],\n \"business_name\": [\n \"SC Oslo AS\"\n ],\n \"address\": {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ]\n },\n \"chain\": [\n \"SuperChain\"\n ],\n \"email\": [\n \"contact@superchain.com\"\n ],\n \"gln\": [\n \"5790001398644\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"phone_number\": [\n \"+4738260107\"\n ],\n \"mcc\": [\n 5814\n ],\n \"mcc_ranges\": [\n {\n \"start\": 5814,\n \"end\": 5815\n }\n ],\n \"bax\": [\n \"102603\"\n ],\n \"terminal_id\": [\n \"T0292\"\n ]\n }\n },\n \"reward\": {\n \"value\": 10000,\n \"values\": [\n {\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ],\n \"value\": 123\n }\n ],\n \"base\": \"gross\",\n \"effect\": \"discount\"\n }\n}")
.asString();{
"requirement": {
"purchase_from": "2023-11-07T05:31:56Z",
"purchase_to": "2023-11-07T05:31:56Z",
"customer": {
"addresses": [
{
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
],
"custom_type": [
"offsite"
],
"type": [
"custom"
]
}
],
"company": {
"bussiness_name": [
"TKP tech AS"
],
"department": [
"production",
"research"
],
"industry": [
"J62.0.1",
"J62.0.2"
],
"number_of_employees": [
"20"
],
"organization_number": [
"123456789MVA"
],
"website": [
"https://dintero.com"
]
},
"date_of_birth": [
"1990-09-20",
"1990-05-10"
],
"enrolled_by": {
"type": [
"url"
],
"value": [
"https://mypage.example.dintero.com"
]
},
"favorite_store": [
"sc029"
],
"first_name": [
"John"
],
"gender": [
"male"
],
"last_name": [
"Doe"
],
"marketing_consent": {
"email": {
"consent": [
"true"
]
},
"sms": {
"consent": [
"true"
]
}
},
"status": [
"vip"
],
"term": {
"id": [
"<string>"
]
},
"type": [
"<string>"
],
"attributes": {}
},
"item": {
"quantity": 0,
"mixes": [
{
"quantity": 1,
"reward_eligible": true,
"items": [
{
"id": "b714118"
},
{
"group_id": "g4"
}
]
}
],
"items": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"store_ids": [
"sc029"
],
"gross_amount": 0,
"net_amount": 0,
"currencies": [
{
"anything-but": [
"NOK"
]
}
],
"stamp": 5,
"discount_code": "TACO",
"store": {
"id": [
"sc029"
],
"name": [
"SC Oslo"
],
"business_name": [
"SC Oslo AS"
],
"address": {
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
]
},
"chain": [
"SuperChain"
],
"email": [
"contact@superchain.com"
],
"gln": [
"5790001398644"
],
"organization_number": [
"123456789MVA"
],
"phone_number": [
"+4738260107"
],
"mcc": [
5814
],
"mcc_ranges": [
{
"start": 5814,
"end": 5815
}
],
"bax": [
"102603"
],
"terminal_id": [
"T0292"
]
}
},
"reward": {
"value": 10000,
"values": [
{
"items": [
{
"id": "b714118",
"group_id": "B1"
}
],
"value": 123
}
],
"base": "gross",
"effect": "discount"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "1c92f7e1-2897-4d46-bdcc-c127a914fb4e",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_by": "1c92f7e1-2897-4d46-bdcc-c127a914fb4e",
"deleted_at": "2023-11-07T05:31:56Z",
"campaign_id": "<string>",
"active": true,
"private": false,
"updated_by": "3d1e4824-5474-48e7-a369-4f603fa4c5b8",
"name": "Spar 100,-",
"receipt_text": "Mai Salg",
"visible_from": "2023-11-07T05:31:56Z",
"description": "Gjør et Stablestol kupp!",
"limitation": {
"dynamic_purchase_to_days": 2,
"discount_activation": [
{
"type": "deactivate_if_discount_active",
"value": "<string>"
}
],
"discount_hours": {
"hours": [
{
"start": "10:00",
"end": "20:00"
}
],
"timezone": "Europe/Oslo"
},
"discount_reward_usage": 1,
"discount_combination": -1,
"discount_eligible": "item_eligible_for_discount",
"discount_repeat_usage": -1,
"stamp_expire_days": 100,
"blacklist": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"metadata": {
"campaign_id": "V101",
"is_featured": true,
"dintero:private_text:kind": "Gold"
},
"links": [
{
"href": "https://example.dintero.com/c/photos/2018/6_20_thumbnail_discount_image.png",
"rel": "thumbnail_discount_image"
},
{
"href": "https://example.dintero.com/c/photos/2018/6_20_medium_discount_image.png",
"rel": "medium_discount_image"
},
{
"href": "https://example.dintero.com/shop?utm_source=dintero&utm_medium=email&utm_campaign=spring-summer",
"rel": "webshoop"
},
{
"href": "https://example.dintero.com/newsletter/2018.pdf",
"rel": "newletter",
"type": "application/pdf"
}
]
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}Create new discount
Create a new discount for an account.
A new discount will be unavailable for purchases until the discount is given to one or more customer.
Discount can be given to a customer by either adding a automation to the discount that will grant the discount to the customer from events received or by adding customers to the discount.
scopes:
- admin:discounts
- write:discounts
curl --request POST \
--url https://api.dintero.com/v1/accounts/{aid}/discounts/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"requirement": {
"purchase_from": "2023-11-07T05:31:56Z",
"purchase_to": "2023-11-07T05:31:56Z",
"customer": {
"addresses": [
{
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
],
"custom_type": [
"offsite"
],
"type": [
"custom"
]
}
],
"company": {
"bussiness_name": [
"TKP tech AS"
],
"department": [
"production",
"research"
],
"industry": [
"J62.0.1",
"J62.0.2"
],
"number_of_employees": [
"20"
],
"organization_number": [
"123456789MVA"
],
"website": [
"https://dintero.com"
]
},
"date_of_birth": [
"1990-09-20",
"1990-05-10"
],
"enrolled_by": {
"type": [
"url"
],
"value": [
"https://mypage.example.dintero.com"
]
},
"favorite_store": [
"sc029"
],
"first_name": [
"John"
],
"gender": [
"male"
],
"last_name": [
"Doe"
],
"marketing_consent": {
"email": {
"consent": [
"true"
]
},
"sms": {
"consent": [
"true"
]
}
},
"status": [
"vip"
],
"term": {
"id": [
"<string>"
]
},
"type": [
"<string>"
],
"attributes": {}
},
"item": {
"quantity": 0,
"mixes": [
{
"quantity": 1,
"reward_eligible": true,
"items": [
{
"id": "b714118"
},
{
"group_id": "g4"
}
]
}
],
"items": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"store_ids": [
"sc029"
],
"gross_amount": 0,
"net_amount": 0,
"currencies": [
{
"anything-but": [
"NOK"
]
}
],
"stamp": 5,
"discount_code": "TACO",
"store": {
"id": [
"sc029"
],
"name": [
"SC Oslo"
],
"business_name": [
"SC Oslo AS"
],
"address": {
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
]
},
"chain": [
"SuperChain"
],
"email": [
"contact@superchain.com"
],
"gln": [
"5790001398644"
],
"organization_number": [
"123456789MVA"
],
"phone_number": [
"+4738260107"
],
"mcc": [
5814
],
"mcc_ranges": [
{
"start": 5814,
"end": 5815
}
],
"bax": [
"102603"
],
"terminal_id": [
"T0292"
]
}
},
"reward": {
"value": 10000,
"values": [
{
"items": [
{
"id": "b714118",
"group_id": "B1"
}
],
"value": 123
}
],
"base": "gross",
"effect": "discount"
}
}
'import requests
url = "https://api.dintero.com/v1/accounts/{aid}/discounts/rules"
payload = {
"requirement": {
"purchase_from": "2023-11-07T05:31:56Z",
"purchase_to": "2023-11-07T05:31:56Z",
"customer": {
"addresses": [
{
"country": ["NO"],
"postal_code": ["0349"],
"postal_place": ["Oslo"],
"custom_type": ["offsite"],
"type": ["custom"]
}
],
"company": {
"bussiness_name": ["TKP tech AS"],
"department": ["production", "research"],
"industry": ["J62.0.1", "J62.0.2"],
"number_of_employees": ["20"],
"organization_number": ["123456789MVA"],
"website": ["https://dintero.com"]
},
"date_of_birth": ["1990-09-20", "1990-05-10"],
"enrolled_by": {
"type": ["url"],
"value": ["https://mypage.example.dintero.com"]
},
"favorite_store": ["sc029"],
"first_name": ["John"],
"gender": ["male"],
"last_name": ["Doe"],
"marketing_consent": {
"email": { "consent": ["true"] },
"sms": { "consent": ["true"] }
},
"status": ["vip"],
"term": { "id": ["<string>"] },
"type": ["<string>"],
"attributes": {}
},
"item": {
"quantity": 0,
"mixes": [
{
"quantity": 1,
"reward_eligible": True,
"items": [{ "id": "b714118" }, { "group_id": "g4" }]
}
],
"items": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"store_ids": ["sc029"],
"gross_amount": 0,
"net_amount": 0,
"currencies": [{ "anything-but": ["NOK"] }],
"stamp": 5,
"discount_code": "TACO",
"store": {
"id": ["sc029"],
"name": ["SC Oslo"],
"business_name": ["SC Oslo AS"],
"address": {
"country": ["NO"],
"postal_code": ["0349"],
"postal_place": ["Oslo"]
},
"chain": ["SuperChain"],
"email": ["contact@superchain.com"],
"gln": ["5790001398644"],
"organization_number": ["123456789MVA"],
"phone_number": ["+4738260107"],
"mcc": [5814],
"mcc_ranges": [
{
"start": 5814,
"end": 5815
}
],
"bax": ["102603"],
"terminal_id": ["T0292"]
}
},
"reward": {
"value": 10000,
"values": [
{
"items": [
{
"id": "b714118",
"group_id": "B1"
}
],
"value": 123
}
],
"base": "gross",
"effect": "discount"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
requirement: {
purchase_from: '2023-11-07T05:31:56Z',
purchase_to: '2023-11-07T05:31:56Z',
customer: {
addresses: [
{
country: ['NO'],
postal_code: ['0349'],
postal_place: ['Oslo'],
custom_type: ['offsite'],
type: ['custom']
}
],
company: {
bussiness_name: ['TKP tech AS'],
department: ['production', 'research'],
industry: ['J62.0.1', 'J62.0.2'],
number_of_employees: ['20'],
organization_number: ['123456789MVA'],
website: ['https://dintero.com']
},
date_of_birth: ['1990-09-20', '1990-05-10'],
enrolled_by: {type: ['url'], value: ['https://mypage.example.dintero.com']},
favorite_store: ['sc029'],
first_name: ['John'],
gender: ['male'],
last_name: ['Doe'],
marketing_consent: {email: {consent: ['true']}, sms: {consent: ['true']}},
status: ['vip'],
term: {id: ['<string>']},
type: ['<string>'],
attributes: {}
},
item: {
quantity: 0,
mixes: [
{quantity: 1, reward_eligible: true, items: [{id: 'b714118'}, {group_id: 'g4'}]}
],
items: [{id: 'b714118', group_id: 'B1'}]
},
store_ids: ['sc029'],
gross_amount: 0,
net_amount: 0,
currencies: [{'anything-but': ['NOK']}],
stamp: 5,
discount_code: 'TACO',
store: {
id: ['sc029'],
name: ['SC Oslo'],
business_name: ['SC Oslo AS'],
address: {country: ['NO'], postal_code: ['0349'], postal_place: ['Oslo']},
chain: ['SuperChain'],
email: ['contact@superchain.com'],
gln: ['5790001398644'],
organization_number: ['123456789MVA'],
phone_number: ['+4738260107'],
mcc: [5814],
mcc_ranges: [{start: 5814, end: 5815}],
bax: ['102603'],
terminal_id: ['T0292']
}
},
reward: {
value: 10000,
values: [{items: [{id: 'b714118', group_id: 'B1'}], value: 123}],
base: 'gross',
effect: 'discount'
}
})
};
fetch('https://api.dintero.com/v1/accounts/{aid}/discounts/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dintero.com/v1/accounts/{aid}/discounts/rules"
payload := strings.NewReader("{\n \"requirement\": {\n \"purchase_from\": \"2023-11-07T05:31:56Z\",\n \"purchase_to\": \"2023-11-07T05:31:56Z\",\n \"customer\": {\n \"addresses\": [\n {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ],\n \"custom_type\": [\n \"offsite\"\n ],\n \"type\": [\n \"custom\"\n ]\n }\n ],\n \"company\": {\n \"bussiness_name\": [\n \"TKP tech AS\"\n ],\n \"department\": [\n \"production\",\n \"research\"\n ],\n \"industry\": [\n \"J62.0.1\",\n \"J62.0.2\"\n ],\n \"number_of_employees\": [\n \"20\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"website\": [\n \"https://dintero.com\"\n ]\n },\n \"date_of_birth\": [\n \"1990-09-20\",\n \"1990-05-10\"\n ],\n \"enrolled_by\": {\n \"type\": [\n \"url\"\n ],\n \"value\": [\n \"https://mypage.example.dintero.com\"\n ]\n },\n \"favorite_store\": [\n \"sc029\"\n ],\n \"first_name\": [\n \"John\"\n ],\n \"gender\": [\n \"male\"\n ],\n \"last_name\": [\n \"Doe\"\n ],\n \"marketing_consent\": {\n \"email\": {\n \"consent\": [\n \"true\"\n ]\n },\n \"sms\": {\n \"consent\": [\n \"true\"\n ]\n }\n },\n \"status\": [\n \"vip\"\n ],\n \"term\": {\n \"id\": [\n \"<string>\"\n ]\n },\n \"type\": [\n \"<string>\"\n ],\n \"attributes\": {}\n },\n \"item\": {\n \"quantity\": 0,\n \"mixes\": [\n {\n \"quantity\": 1,\n \"reward_eligible\": true,\n \"items\": [\n {\n \"id\": \"b714118\"\n },\n {\n \"group_id\": \"g4\"\n }\n ]\n }\n ],\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ]\n },\n \"store_ids\": [\n \"sc029\"\n ],\n \"gross_amount\": 0,\n \"net_amount\": 0,\n \"currencies\": [\n {\n \"anything-but\": [\n \"NOK\"\n ]\n }\n ],\n \"stamp\": 5,\n \"discount_code\": \"TACO\",\n \"store\": {\n \"id\": [\n \"sc029\"\n ],\n \"name\": [\n \"SC Oslo\"\n ],\n \"business_name\": [\n \"SC Oslo AS\"\n ],\n \"address\": {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ]\n },\n \"chain\": [\n \"SuperChain\"\n ],\n \"email\": [\n \"contact@superchain.com\"\n ],\n \"gln\": [\n \"5790001398644\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"phone_number\": [\n \"+4738260107\"\n ],\n \"mcc\": [\n 5814\n ],\n \"mcc_ranges\": [\n {\n \"start\": 5814,\n \"end\": 5815\n }\n ],\n \"bax\": [\n \"102603\"\n ],\n \"terminal_id\": [\n \"T0292\"\n ]\n }\n },\n \"reward\": {\n \"value\": 10000,\n \"values\": [\n {\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ],\n \"value\": 123\n }\n ],\n \"base\": \"gross\",\n \"effect\": \"discount\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.dintero.com/v1/accounts/{aid}/discounts/rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"requirement\": {\n \"purchase_from\": \"2023-11-07T05:31:56Z\",\n \"purchase_to\": \"2023-11-07T05:31:56Z\",\n \"customer\": {\n \"addresses\": [\n {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ],\n \"custom_type\": [\n \"offsite\"\n ],\n \"type\": [\n \"custom\"\n ]\n }\n ],\n \"company\": {\n \"bussiness_name\": [\n \"TKP tech AS\"\n ],\n \"department\": [\n \"production\",\n \"research\"\n ],\n \"industry\": [\n \"J62.0.1\",\n \"J62.0.2\"\n ],\n \"number_of_employees\": [\n \"20\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"website\": [\n \"https://dintero.com\"\n ]\n },\n \"date_of_birth\": [\n \"1990-09-20\",\n \"1990-05-10\"\n ],\n \"enrolled_by\": {\n \"type\": [\n \"url\"\n ],\n \"value\": [\n \"https://mypage.example.dintero.com\"\n ]\n },\n \"favorite_store\": [\n \"sc029\"\n ],\n \"first_name\": [\n \"John\"\n ],\n \"gender\": [\n \"male\"\n ],\n \"last_name\": [\n \"Doe\"\n ],\n \"marketing_consent\": {\n \"email\": {\n \"consent\": [\n \"true\"\n ]\n },\n \"sms\": {\n \"consent\": [\n \"true\"\n ]\n }\n },\n \"status\": [\n \"vip\"\n ],\n \"term\": {\n \"id\": [\n \"<string>\"\n ]\n },\n \"type\": [\n \"<string>\"\n ],\n \"attributes\": {}\n },\n \"item\": {\n \"quantity\": 0,\n \"mixes\": [\n {\n \"quantity\": 1,\n \"reward_eligible\": true,\n \"items\": [\n {\n \"id\": \"b714118\"\n },\n {\n \"group_id\": \"g4\"\n }\n ]\n }\n ],\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ]\n },\n \"store_ids\": [\n \"sc029\"\n ],\n \"gross_amount\": 0,\n \"net_amount\": 0,\n \"currencies\": [\n {\n \"anything-but\": [\n \"NOK\"\n ]\n }\n ],\n \"stamp\": 5,\n \"discount_code\": \"TACO\",\n \"store\": {\n \"id\": [\n \"sc029\"\n ],\n \"name\": [\n \"SC Oslo\"\n ],\n \"business_name\": [\n \"SC Oslo AS\"\n ],\n \"address\": {\n \"country\": [\n \"NO\"\n ],\n \"postal_code\": [\n \"0349\"\n ],\n \"postal_place\": [\n \"Oslo\"\n ]\n },\n \"chain\": [\n \"SuperChain\"\n ],\n \"email\": [\n \"contact@superchain.com\"\n ],\n \"gln\": [\n \"5790001398644\"\n ],\n \"organization_number\": [\n \"123456789MVA\"\n ],\n \"phone_number\": [\n \"+4738260107\"\n ],\n \"mcc\": [\n 5814\n ],\n \"mcc_ranges\": [\n {\n \"start\": 5814,\n \"end\": 5815\n }\n ],\n \"bax\": [\n \"102603\"\n ],\n \"terminal_id\": [\n \"T0292\"\n ]\n }\n },\n \"reward\": {\n \"value\": 10000,\n \"values\": [\n {\n \"items\": [\n {\n \"id\": \"b714118\",\n \"group_id\": \"B1\"\n }\n ],\n \"value\": 123\n }\n ],\n \"base\": \"gross\",\n \"effect\": \"discount\"\n }\n}")
.asString();{
"requirement": {
"purchase_from": "2023-11-07T05:31:56Z",
"purchase_to": "2023-11-07T05:31:56Z",
"customer": {
"addresses": [
{
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
],
"custom_type": [
"offsite"
],
"type": [
"custom"
]
}
],
"company": {
"bussiness_name": [
"TKP tech AS"
],
"department": [
"production",
"research"
],
"industry": [
"J62.0.1",
"J62.0.2"
],
"number_of_employees": [
"20"
],
"organization_number": [
"123456789MVA"
],
"website": [
"https://dintero.com"
]
},
"date_of_birth": [
"1990-09-20",
"1990-05-10"
],
"enrolled_by": {
"type": [
"url"
],
"value": [
"https://mypage.example.dintero.com"
]
},
"favorite_store": [
"sc029"
],
"first_name": [
"John"
],
"gender": [
"male"
],
"last_name": [
"Doe"
],
"marketing_consent": {
"email": {
"consent": [
"true"
]
},
"sms": {
"consent": [
"true"
]
}
},
"status": [
"vip"
],
"term": {
"id": [
"<string>"
]
},
"type": [
"<string>"
],
"attributes": {}
},
"item": {
"quantity": 0,
"mixes": [
{
"quantity": 1,
"reward_eligible": true,
"items": [
{
"id": "b714118"
},
{
"group_id": "g4"
}
]
}
],
"items": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"store_ids": [
"sc029"
],
"gross_amount": 0,
"net_amount": 0,
"currencies": [
{
"anything-but": [
"NOK"
]
}
],
"stamp": 5,
"discount_code": "TACO",
"store": {
"id": [
"sc029"
],
"name": [
"SC Oslo"
],
"business_name": [
"SC Oslo AS"
],
"address": {
"country": [
"NO"
],
"postal_code": [
"0349"
],
"postal_place": [
"Oslo"
]
},
"chain": [
"SuperChain"
],
"email": [
"contact@superchain.com"
],
"gln": [
"5790001398644"
],
"organization_number": [
"123456789MVA"
],
"phone_number": [
"+4738260107"
],
"mcc": [
5814
],
"mcc_ranges": [
{
"start": 5814,
"end": 5815
}
],
"bax": [
"102603"
],
"terminal_id": [
"T0292"
]
}
},
"reward": {
"value": 10000,
"values": [
{
"items": [
{
"id": "b714118",
"group_id": "B1"
}
],
"value": 123
}
],
"base": "gross",
"effect": "discount"
},
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "1c92f7e1-2897-4d46-bdcc-c127a914fb4e",
"updated_at": "2023-11-07T05:31:56Z",
"deleted_by": "1c92f7e1-2897-4d46-bdcc-c127a914fb4e",
"deleted_at": "2023-11-07T05:31:56Z",
"campaign_id": "<string>",
"active": true,
"private": false,
"updated_by": "3d1e4824-5474-48e7-a369-4f603fa4c5b8",
"name": "Spar 100,-",
"receipt_text": "Mai Salg",
"visible_from": "2023-11-07T05:31:56Z",
"description": "Gjør et Stablestol kupp!",
"limitation": {
"dynamic_purchase_to_days": 2,
"discount_activation": [
{
"type": "deactivate_if_discount_active",
"value": "<string>"
}
],
"discount_hours": {
"hours": [
{
"start": "10:00",
"end": "20:00"
}
],
"timezone": "Europe/Oslo"
},
"discount_reward_usage": 1,
"discount_combination": -1,
"discount_eligible": "item_eligible_for_discount",
"discount_repeat_usage": -1,
"stamp_expire_days": 100,
"blacklist": [
{
"id": "b714118",
"group_id": "B1"
}
]
},
"metadata": {
"campaign_id": "V101",
"is_featured": true,
"dintero:private_text:kind": "Gold"
},
"links": [
{
"href": "https://example.dintero.com/c/photos/2018/6_20_thumbnail_discount_image.png",
"rel": "thumbnail_discount_image"
},
{
"href": "https://example.dintero.com/c/photos/2018/6_20_medium_discount_image.png",
"rel": "medium_discount_image"
},
{
"href": "https://example.dintero.com/shop?utm_source=dintero&utm_medium=email&utm_campaign=spring-summer",
"rel": "webshoop"
},
{
"href": "https://example.dintero.com/newsletter/2018.pdf",
"rel": "newletter",
"type": "application/pdf"
}
]
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"errors": [
{}
]
}
}Authorizations
Bearer authentication (token authentication) should be used for accessing the API.
Use Get Token to get an access token for client credentials. Pass the token in the request header:
Authorization: Bearer {access_token}where the access_token is JSON Web Tokens (JWT).
Path Parameters
An id that uniquely identifies the account.
9Body
Discount to create
Discount base requirement
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The campaign the rule belongs to
the discount is active and can be available for purchase (if given to any or all customers)
the discount will be excluded from public discount collection (GET /discounts/public/rules).
"Spar 100,-"
Text that should be used when displaying the discount, e.g. on receipt
"Mai Salg"
Make the discount visible to the customer from given date. Default behavior is to only return discount to the customer where the current time is between purchase_from and purchase_to
"Gjør et Stablestol kupp!"
Show child attributes
Show child attributes
Additional metadata about the discount
Metadata prefixed with dintero:exclude:public: will
be excluded when listing the rules from the public endpoint
and included in all other endpoints that returns discount rules
{
"campaign_id": "V101",
"is_featured": true,
"dintero:private_text:kind": "Gold"
}Links to resources related to the discount
Show child attributes
Show child attributes
[
{
"href": "https://example.dintero.com/c/photos/2018/6_20_thumbnail_discount_image.png",
"rel": "thumbnail_discount_image"
},
{
"href": "https://example.dintero.com/c/photos/2018/6_20_medium_discount_image.png",
"rel": "medium_discount_image"
},
{
"href": "https://example.dintero.com/shop?utm_source=dintero&utm_medium=email&utm_campaign=spring-summer",
"rel": "webshoop"
},
{
"href": "https://example.dintero.com/newsletter/2018.pdf",
"rel": "newletter",
"type": "application/pdf"
}
]Response
Discount created
Discount base requirement
Show child attributes
Show child attributes
Show child attributes
Show child attributes
An UUID that uniquely identifies the resource
The date-time when the resource was created
The ID of the user/client created the resource
"1c92f7e1-2897-4d46-bdcc-c127a914fb4e"
The date-time when the resource was last updated
The ID of the user/client created the resource
"1c92f7e1-2897-4d46-bdcc-c127a914fb4e"
The campaign the rule belongs to
the discount is active and can be available for purchase (if given to any or all customers)
the discount will be excluded from public discount collection (GET /discounts/public/rules).
The ID of the user/client that last updated the resource
"3d1e4824-5474-48e7-a369-4f603fa4c5b8"
The discount base type * receipt discount is given on receipt * item discount is given to items
item, receipt "Spar 100,-"
Text that should be used when displaying the discount, e.g. on receipt
"Mai Salg"
Make the discount visible to the customer from given date. Default behavior is to only return discount to the customer where the current time is between purchase_from and purchase_to
"Gjør et Stablestol kupp!"
Show child attributes
Show child attributes
Additional metadata about the discount
Metadata prefixed with dintero:exclude:public: will
be excluded when listing the rules from the public endpoint
and included in all other endpoints that returns discount rules
{
"campaign_id": "V101",
"is_featured": true,
"dintero:private_text:kind": "Gold"
}Links to resources related to the discount
Show child attributes
Show child attributes
[
{
"href": "https://example.dintero.com/c/photos/2018/6_20_thumbnail_discount_image.png",
"rel": "thumbnail_discount_image"
},
{
"href": "https://example.dintero.com/c/photos/2018/6_20_medium_discount_image.png",
"rel": "medium_discount_image"
},
{
"href": "https://example.dintero.com/shop?utm_source=dintero&utm_medium=email&utm_campaign=spring-summer",
"rel": "webshoop"
},
{
"href": "https://example.dintero.com/newsletter/2018.pdf",
"rel": "newletter",
"type": "application/pdf"
}
]