Introdução
Documentação da API QRC SSG
A API fornece serviços para geração e gerenciamento de QR Code para pagamentos. As principais funcionalidades incluem:
- Geração de um QR Code para pagamento.
- Consulta do status de um QR Code gerado (PENDING, PAID, CANCELLED e REFUNDED).
- Cancelamento de um QR Code antes do pagamento.
- Estorno de pagamento via QR Code, quando necessário.
Essa API garante uma integração eficiente e segura para operações de pagamento via QR Code.
Autenticando Requisições
Para autenticar requisições, inclua um cabeçalho Authorization
com o valor "Bearer {ACCESS_TOKEN}"
.
Obtenha o token de acesso através do endpoint POST /oauth/token
Todos os endpoints que precisam de autenticação estão marcados com um selo requires authentication na documentação abaixo.
Endpoints
Solicitar um QR Code
requires authentication
Este endpoint tem por objetivo gerar um novo QR Code para pagamento. O campo id presente na resposta bem sucedida desta solicitação é um identificador único universal (UUID) do seu QR Code gerado.
Example request:
curl --request POST \
"https://apipix.pdvssgbank.com/api/qrcode/new" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"value\": 365.99,
\"device_code\": \"019499ed-eb1a-715f-8eb6-253b93278952\"
}"
$client = new \GuzzleHttp\Client();
$url = 'https://apipix.pdvssgbank.com/api/qrcode/new';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'value' => 365.99,
'device_code' => '019499ed-eb1a-715f-8eb6-253b93278952',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
"https://apipix.pdvssgbank.com/api/qrcode/new"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"value": 365.99,
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
import requests
import json
url = 'https://apipix.pdvssgbank.com/api/qrcode/new'
payload = {
"value": 365.99,
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952"
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (201, QR Code gerado):
{
"id": "0192fee7-4c2a-73bb-a74a-856ec3c77842",
"qr_code_text": "eyJpZCI6ICIzOGYzOTcxOC1kMWRlLTQzZTItODQ0NC01ZWU2YTY0ZTVkNWEiLCAiYW1vdW50IjogIjM2NTUwIiwgIml0ZW1zIjogW3siaXRlbV90aXRsZSI6ICJSRVRJUkFEQSIsICJ1bml0X3ByaWNlIjogMzY1LjUsICJxdWFudGl0eSI6IDEsICJ0aXRsZSI6ICJSRVRJUkFEQSJ9XX0=",
"status": "PENDING",
"value": "365.99"
}
Example response (400, Bad Request: dado obrigatório não informado):
{
"message": "O campo {fieldName} é obrigatório.",
"errors": {
"fieldName": [
"O campo {fieldName} é obrigatório."
]
}
}
Example response (401, Unauthenticated: access_token expirado/inválido):
{
"message": "Unauthenticated."
}
Example response (404, Not Found: device_code informado não encontrado):
{
"message": "O device_code informado não foi encontrado.",
"errors": {
"device_code": [
"O device_code informado não foi encontrado."
]
}
}
Example response (422, Unprocessable Entity: campo informado com formato inválido):
{
"message": "O campo value deve ser um número com duas casas decimais.",
"errors": {
"value": [
"O campo value deve ser um número com duas casas decimais."
]
}
}
Example response (500, Internal Server Error: erro ao criar o QR Code):
{
"message": "Erro ao criar o QR Code."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Consultar Status de um QR Code
requires authentication
Este endpoint tem o objetivo de consultar o status de um QR Code. Os possíveis status de resposta para um QR Code são: PENDING, PAID, CANCELLED e REFUNDED. Para obter o status do QR Code, devem ser passados via URL Param o uuid (ID gerado pro seu QR Code) e o Query Param device_code contendo seu device_code.
Example request:
curl --request GET \
--get "https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/status?device_code=019499ed-eb1a-715f-8eb6-253b93278952" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
$client = new \GuzzleHttp\Client();
$url = 'https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/status';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'query' => [
'device_code' => '019499ed-eb1a-715f-8eb6-253b93278952',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
"https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/status"
);
const params = {
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
import requests
import json
url = 'https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/status'
params = {
'device_code': '019499ed-eb1a-715f-8eb6-253b93278952',
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers, params=params)
response.json()
Example response (200, Success: Status QR Code):
{
"status": "PENDING"
}
Example response (400, Bad Request: dado obrigatório não informado):
{
"message": "O campo device_code é obrigatório.",
"errors": {
"device_code": [
"O campo device_code é obrigatório."
]
}
}
Example response (401, Unauthenticated: access_token expirado/inválido):
{
"message": "Unauthenticated."
}
Example response (404, Not Found: dado informado não encontrado):
{
"message": "O {fieldName} informado não foi encontrado.",
"errors": {
"{fieldName}": [
"O {fieldName} informado não foi encontrado."
]
}
}
Example response (500, Internal Server Error: erro ao consultar o QR Code):
{
"message": "Não foi possível consultar o QR Code",
"errors": {
"uuid": [
"Não foi possível consultar o QR Code"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Cancelar um QR Code
requires authentication
Este endpoint tem o objetivo de cancelar um QR Code gerado pelo endpoint "Solicitar um QR Code". Para que o QR Code seja cancelado, o mesmo deve ter o status "PENDING". Para o cancelamento do QR Code, devem ser passados via query string o uuid e o body contendo:
- value - o tipo deve ser float e o valor no formato BRL
- device_code - o tipo deve ser string
Example request:
curl --request DELETE \
"https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/cancel" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"value\": 365.99,
\"device_code\": \"019499ed-eb1a-715f-8eb6-253b93278952\"
}"
$client = new \GuzzleHttp\Client();
$url = 'https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/cancel';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'value' => 365.99,
'device_code' => '019499ed-eb1a-715f-8eb6-253b93278952',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
"https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/cancel"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"value": 365.99,
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952"
};
fetch(url, {
method: "DELETE",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
import requests
import json
url = 'https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/cancel'
payload = {
"value": 365.99,
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952"
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers, json=payload)
response.json()
Example response (200, Success: QR Code cancelado):
{
"status": "CANCELLED"
}
Example response (400, Bad Request: dado obrigatório não informado):
{
"message": "O campo {fieldName} é obrigatório.",
"errors": {
"{fieldName}": [
"O campo {fieldName} é obrigatório."
]
}
}
Example response (401, Unauthenticated: access_token expirado/inválido):
{
"message": "Unauthenticated."
}
Example response (404, Not Found: dado informado não encontrado):
{
"message": "O {fieldName} informado não foi encontrado.",
"errors": {
"{fieldName}": [
"O {fieldName} informado não foi encontrado."
]
}
}
Example response (409, Conflict: QR Code pago não pode ser cancelado):
{
"message": "Não é possível cancelar um QR Code pago.",
"errors": {
"uuid": [
"Não é possível cancelar um QR Code pago."
]
}
}
Example response (422, Unprocessable Entity: campo informado com formato inválido):
{
"message": "O campo value deve ser um número com duas casas decimais.",
"errors": {
"value": [
"O campo value deve ser um número com duas casas decimais."
]
}
}
Example response (500, Internal Server Error: erro ao cancelar o QR Code):
{
"message": "Não foi possível cancelar o QR Code",
"errors": {
"uuid": [
"Não foi possível cancelar o QR Code"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Estornar um QR Code
requires authentication
Este endpoint tem o objetivo de estornar um QR Code. Para que o estorno seja realizado o QR Code deve estar com status "PAID". Para o estorno do QR Code, devem ser passados via query string o uuid e o body contendo:
- value - o tipo deve ser float e o valor no formato BRL
- device_code - o tipo deve ser string
Example request:
curl --request DELETE \
"https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/refund" \
--header "Authorization: Bearer {ACCESS_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"value\": 365.99,
\"device_code\": \"019499ed-eb1a-715f-8eb6-253b93278952\"
}"
$client = new \GuzzleHttp\Client();
$url = 'https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/refund';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {ACCESS_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'value' => 365.99,
'device_code' => '019499ed-eb1a-715f-8eb6-253b93278952',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
"https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/refund"
);
const headers = {
"Authorization": "Bearer {ACCESS_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"value": 365.99,
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952"
};
fetch(url, {
method: "DELETE",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
import requests
import json
url = 'https://apipix.pdvssgbank.com/api/qrcode/6ff8f7f6-1eb3-3525-be4a-3932c805afed/refund'
payload = {
"value": 365.99,
"device_code": "019499ed-eb1a-715f-8eb6-253b93278952"
}
headers = {
'Authorization': 'Bearer {ACCESS_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers, json=payload)
response.json()
Example response (200, Success: QR Code estornado):
{
"id": "0192fee7-4c2a-73bb-a74a-856ec3c77842",
"value": 365.99,
"status": "REFUNDED"
}
Example response (400, Bad Request: dado obrigatório não informado):
{
"message": "O campo {fieldName} é obrigatório.",
"errors": {
"{fieldName}": [
"O campo {fieldName} é obrigatório."
]
}
}
Example response (400, Bad Request: valor solicitado para estorno maior/menor do que o valor pago):
{
"message": "Não é possível estornar um valor maior/menor do que o valor do QR Code.",
"errors": {
"value": [
"Não é possível estornar um valor maior/menor do que o valor do QR Code."
]
}
}
Example response (401, Unauthenticated: access_token expirado/inválido):
{
"message": "Unauthenticated."
}
Example response (404, Not Found: dado informado não encontrado):
{
"message": "O {fieldName} informado não foi encontrado.",
"errors": {
"{fieldName}": [
"O {fieldName} informado não foi encontrado."
]
}
}
Example response (422, Unprocessable Entity: campo informado com formato inválido):
{
"message": "O campo value deve ser um número com duas casas decimais.",
"errors": {
"value": [
"O campo value deve ser um número com duas casas decimais."
]
}
}
Example response (500, Internal Server Error: erro ao estornar o QR Code):
{
"message": "Não foi possível estornar o QR Code",
"errors": {
"uuid": [
"Não foi possível estornar o QR Code"
]
}
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Token de Acesso
Utilizamos o framework OAuth 2.0 para autorização. Por padrão, sempre utilizamos o client_credentials como grant_type.
Obter token de acesso
Endpoint para obter o access_token
, chave utilizada para autorização em todos os endpoints protegidos da API no cabeçalho Authorization
do tipo Bearer
. Um access_token
tem uma duração padrão de 24h.
Example request:
curl --request POST \
"https://apipix.pdvssgbank.com/oauth/token" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"grant_type\": \"client_credentials\",
\"client_id\": \"{CLIENT_ID}\",
\"client_secret\": \"{CLIENT_SECRET}\"
}"
$client = new \GuzzleHttp\Client();
$url = 'https://apipix.pdvssgbank.com/oauth/token';
$response = $client->post(
$url,
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'grant_type' => 'client_credentials',
'client_id' => '{CLIENT_ID}',
'client_secret' => '{CLIENT_SECRET}',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
const url = new URL(
"https://apipix.pdvssgbank.com/oauth/token"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"grant_type": "client_credentials",
"client_id": "{CLIENT_ID}",
"client_secret": "{CLIENT_SECRET}"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
import requests
import json
url = 'https://apipix.pdvssgbank.com//oauth/token'
payload = {
"grant_type": "client_credentials",
"client_id": "{CLIENT_ID}",
"client_secret": "{CLIENT_SECRET}"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
Example response (200, access_token gerado):
{
"token_type": "Bearer",
"expires_in": 31536000,
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciO..."
}
Example response (400, Bad Request: grant_type inválido/não informado):
{
"error": "unsupported_grant_type",
"error_description": "The authorization grant type is not supported by the authorization server.",
"hint": "Check that all required parameters have been provided",
"message": "The authorization grant type is not supported by the authorization server."
}
Example response (400, Bad Request: client_id não informado):
{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"hint": "Check the `client_id` parameter",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}
Example response (400, Bad Request: client_id/client_secret não encontrado):
{
"error": "invalid_request",
"error_description": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.",
"hint": "Check the `client_id` parameter",
"message": "The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed."
}
Example response (401, Unauthorized: client_id/client_secret não encontrado):
{
"error": "invalid_client",
"error_description": "Client authentication failed",
"message": "Client authentication failed"
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Response
Response Fields
token_type
string
Tipo do token. Padrão: Bearer
expires_in
integer
Segundos restantes para o token expirar
access_token
string
Token de acesso