List coupons
curl --request GET \
--url https://api-sandbox.fortalpay.tech/v1/coupons \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-sandbox.fortalpay.tech/v1/coupons"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.fortalpay.tech/v1/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api-sandbox.fortalpay.tech/v1/coupons")
.header("Authorization", "<api-key>")
.asString();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.fortalpay.tech/v1/coupons"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api-sandbox.fortalpay.tech/v1/coupons");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"data": {
"page": 123,
"size": 123,
"numberOfElements": 123,
"totalElements": 123,
"totalPages": 123,
"content": [
{
"id": "6f84d2b5-a612-4e67-8af5-69f98de980f5",
"code": "<string>",
"type": "PERCENTAGE",
"value": 10,
"used_count": 123,
"status": "ACTIVE",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"max_uses": 123,
"starts_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
]
},
"success": true,
"error": null
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}Listar cupons
List non-deleted coupons owned by the merchant associated with the API key.
GET
/
coupons
List coupons
curl --request GET \
--url https://api-sandbox.fortalpay.tech/v1/coupons \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api-sandbox.fortalpay.tech/v1/coupons', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api-sandbox.fortalpay.tech/v1/coupons"
headers = {"Authorization": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.fortalpay.tech/v1/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.get("https://api-sandbox.fortalpay.tech/v1/coupons")
.header("Authorization", "<api-key>")
.asString();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.fortalpay.tech/v1/coupons"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}using RestSharp;
var options = new RestClientOptions("https://api-sandbox.fortalpay.tech/v1/coupons");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
{
"data": {
"page": 123,
"size": 123,
"numberOfElements": 123,
"totalElements": 123,
"totalPages": 123,
"content": [
{
"id": "6f84d2b5-a612-4e67-8af5-69f98de980f5",
"code": "<string>",
"type": "PERCENTAGE",
"value": 10,
"used_count": 123,
"status": "ACTIVE",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"max_uses": 123,
"starts_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z"
}
]
},
"success": true,
"error": null
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}{
"data": null,
"success": false,
"error": {
"timestamp": "2023-11-07T05:31:56Z",
"status": 123,
"message": "<string>",
"path": "<string>",
"fields": [
{
"field": "<string>",
"message": "<string>"
}
]
}
}Retorna os cupons não removidos do merchant, ordenados pelos mais recentes.
Use
page para informar a página, começando em 0, e size para definir a quantidade de itens retornados. A ordenação é fixa pela data de criação, da mais recente para a mais antiga.Authorizations
Todas as requisições devem incluir sua API key no cabeçalho Authorization
usando o formato ApiKey <sua_api_key>. Não use o esquema Bearer.
Sem esse cabeçalho, a requisição será rejeitada.
Use fpay_sk_test_... no ambiente de teste e fpay_sk_live_... em produção.
Saiba como criar e usar uma API key.
Query Parameters
Índice da página, começando em zero.
Required range:
x >= 0Quantidade de registros solicitada por página.
Required range:
x >= 1