Enviar configuração de fidelidade
curl --request PUT \
--url https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"program": {
"id": "<string>",
"name": "<string>",
"ownerType": "store",
"rulesUrl": "<string>"
},
"capabilities": {
"balanceTypes": [
"cashback"
],
"partialRedemption": true,
"enrollment": true,
"redemptionLimits": {}
}
}
'import requests
url = "https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config"
payload = {
"program": {
"id": "<string>",
"name": "<string>",
"ownerType": "store",
"rulesUrl": "<string>"
},
"capabilities": {
"balanceTypes": ["cashback"],
"partialRedemption": True,
"enrollment": True,
"redemptionLimits": {}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
program: {id: '<string>', name: '<string>', ownerType: 'store', rulesUrl: '<string>'},
capabilities: {
balanceTypes: ['cashback'],
partialRedemption: true,
enrollment: true,
redemptionLimits: {}
}
})
};
fetch('https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config', 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.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'program' => [
'id' => '<string>',
'name' => '<string>',
'ownerType' => 'store',
'rulesUrl' => '<string>'
],
'capabilities' => [
'balanceTypes' => [
'cashback'
],
'partialRedemption' => true,
'enrollment' => true,
'redemptionLimits' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config"
payload := strings.NewReader("{\n \"program\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"ownerType\": \"store\",\n \"rulesUrl\": \"<string>\"\n },\n \"capabilities\": {\n \"balanceTypes\": [\n \"cashback\"\n ],\n \"partialRedemption\": true,\n \"enrollment\": true,\n \"redemptionLimits\": {}\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"program\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"ownerType\": \"store\",\n \"rulesUrl\": \"<string>\"\n },\n \"capabilities\": {\n \"balanceTypes\": [\n \"cashback\"\n ],\n \"partialRedemption\": true,\n \"enrollment\": true,\n \"redemptionLimits\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"program\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"ownerType\": \"store\",\n \"rulesUrl\": \"<string>\"\n },\n \"capabilities\": {\n \"balanceTypes\": [\n \"cashback\"\n ],\n \"partialRedemption\": true,\n \"enrollment\": true,\n \"redemptionLimits\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"program": {
"id": "<string>",
"name": "<string>",
"ownerType": "store",
"rulesUrl": "<string>"
},
"capabilities": {
"balanceTypes": [
"cashback"
],
"partialRedemption": true,
"enrollment": true,
"redemptionLimits": {
"min": {
"type": "fixed",
"value": 123
},
"max": {
"type": "fixed",
"value": 123
}
}
}
}{
"title": "Unauthorized",
"status": 401
}{
"status": "404",
"title": "Record not found"
}{
"status": "404",
"title": "Record not found"
}Push da configuração
Enviar configuração de fidelidade
Cria ou substitui a configuração do programa de fidelidade do aplicativo autenticado para a loja (a última escrita prevalece). Antes de gravar qualquer coisa, a plataforma faz uma verificação síncrona: um GET /loyalty/ping assinado contra o api_base_url da extensão. Se o operador estiver inacessível ou a verificação da assinatura falhar, nada é gravado e a resposta é 422. Exige o escopo dv.loyalty e a extensão de fidelidade declarada no aplicativo.
PUT
/
merchant
/
v3
/
{merchantId}
/
loyalty
/
config
Enviar configuração de fidelidade
curl --request PUT \
--url https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"program": {
"id": "<string>",
"name": "<string>",
"ownerType": "store",
"rulesUrl": "<string>"
},
"capabilities": {
"balanceTypes": [
"cashback"
],
"partialRedemption": true,
"enrollment": true,
"redemptionLimits": {}
}
}
'import requests
url = "https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config"
payload = {
"program": {
"id": "<string>",
"name": "<string>",
"ownerType": "store",
"rulesUrl": "<string>"
},
"capabilities": {
"balanceTypes": ["cashback"],
"partialRedemption": True,
"enrollment": True,
"redemptionLimits": {}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
program: {id: '<string>', name: '<string>', ownerType: 'store', rulesUrl: '<string>'},
capabilities: {
balanceTypes: ['cashback'],
partialRedemption: true,
enrollment: true,
redemptionLimits: {}
}
})
};
fetch('https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config', 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.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'program' => [
'id' => '<string>',
'name' => '<string>',
'ownerType' => 'store',
'rulesUrl' => '<string>'
],
'capabilities' => [
'balanceTypes' => [
'cashback'
],
'partialRedemption' => true,
'enrollment' => true,
'redemptionLimits' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config"
payload := strings.NewReader("{\n \"program\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"ownerType\": \"store\",\n \"rulesUrl\": \"<string>\"\n },\n \"capabilities\": {\n \"balanceTypes\": [\n \"cashback\"\n ],\n \"partialRedemption\": true,\n \"enrollment\": true,\n \"redemptionLimits\": {}\n }\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"program\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"ownerType\": \"store\",\n \"rulesUrl\": \"<string>\"\n },\n \"capabilities\": {\n \"balanceTypes\": [\n \"cashback\"\n ],\n \"partialRedemption\": true,\n \"enrollment\": true,\n \"redemptionLimits\": {}\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deliveryvip.com.br/merchant/v3/{merchantId}/loyalty/config")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"program\": {\n \"id\": \"<string>\",\n \"name\": \"<string>\",\n \"ownerType\": \"store\",\n \"rulesUrl\": \"<string>\"\n },\n \"capabilities\": {\n \"balanceTypes\": [\n \"cashback\"\n ],\n \"partialRedemption\": true,\n \"enrollment\": true,\n \"redemptionLimits\": {}\n }\n}"
response = http.request(request)
puts response.read_body{
"program": {
"id": "<string>",
"name": "<string>",
"ownerType": "store",
"rulesUrl": "<string>"
},
"capabilities": {
"balanceTypes": [
"cashback"
],
"partialRedemption": true,
"enrollment": true,
"redemptionLimits": {
"min": {
"type": "fixed",
"value": 123
},
"max": {
"type": "fixed",
"value": 123
}
}
}
}{
"title": "Unauthorized",
"status": 401
}{
"status": "404",
"title": "Record not found"
}{
"status": "404",
"title": "Record not found"
}Autorizações
Token de acesso opaco emitido pela API de autenticação (POST /authentication/v1/oauth/token).
Parâmetros de caminho
Id (UUID) da loja na plataforma. A loja precisa estar autorizada para o aplicativo.
Corpo
application/json