curl --request GET \
--url https://api.sandbox.gravitypay.app/v1/payment-methods \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.gravitypay.app/v1/payment-methods"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.gravitypay.app/v1/payment-methods', 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.sandbox.gravitypay.app/v1/payment-methods",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.gravitypay.app/v1/payment-methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.gravitypay.app/v1/payment-methods")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.gravitypay.app/v1/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "payment_methods",
"pix": {
"available": true,
"provider": "ASAAS"
},
"boleto": {
"available": true,
"provider": "ASAAS"
},
"card": {
"available": true,
"provider": "ASAAS",
"input": "raw",
"pagarmePublicKey": null,
"efiPayeeCode": null,
"efiSandbox": false
},
"installments": [
{
"count": 1,
"installmentInCents": 15900,
"totalInCents": 15900,
"hasInterest": false
},
{
"count": 2,
"installmentInCents": 8501,
"totalInCents": 17002,
"hasInterest": true
},
{
"count": 3,
"installmentInCents": 5822,
"totalInCents": 17467,
"hasInterest": true
}
]
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>",
"param": "<string>",
"requiredScope": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>",
"param": "<string>",
"requiredScope": "<string>"
}
}{
"error": {
"type": "insufficient_scope",
"message": "Esta chave de API não tem o escopo students:read.",
"requiredScope": "students:read"
}
}Métodos de pagamento da loja
O que a loja da chave aceita, sem precisar de cobrança: o gateway de cada método (mesma regra do checkout hospedado), como o cartão deve ser enviado e, com amountInCents, a tabela de parcelas (a mesma do checkout hospedado). Considera cobrança em BRL.
card.input: raw (Asaas, cartão aberto), pagarme_token (Pagar.me, tokenize com pagarmePublicKey), efi_token (Efí, tokenize com efiPayeeCode), hosted_only (Stripe, só checkout hospedado). Método indisponível: available: false, provider: null e, no cartão, input: null.
Serve também para validar a chave ao salvar: 200 é chave boa, 401 inválida, 403 sem escopo.
Escopo exigido: charges:read.
curl --request GET \
--url https://api.sandbox.gravitypay.app/v1/payment-methods \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sandbox.gravitypay.app/v1/payment-methods"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sandbox.gravitypay.app/v1/payment-methods', 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.sandbox.gravitypay.app/v1/payment-methods",
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: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sandbox.gravitypay.app/v1/payment-methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.sandbox.gravitypay.app/v1/payment-methods")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.gravitypay.app/v1/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "payment_methods",
"pix": {
"available": true,
"provider": "ASAAS"
},
"boleto": {
"available": true,
"provider": "ASAAS"
},
"card": {
"available": true,
"provider": "ASAAS",
"input": "raw",
"pagarmePublicKey": null,
"efiPayeeCode": null,
"efiSandbox": false
},
"installments": [
{
"count": 1,
"installmentInCents": 15900,
"totalInCents": 15900,
"hasInterest": false
},
{
"count": 2,
"installmentInCents": 8501,
"totalInCents": 17002,
"hasInterest": true
},
{
"count": 3,
"installmentInCents": 5822,
"totalInCents": 17467,
"hasInterest": true
}
]
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>",
"param": "<string>",
"requiredScope": "<string>"
}
}{
"error": {
"type": "<string>",
"message": "<string>",
"code": "<string>",
"param": "<string>",
"requiredScope": "<string>"
}
}{
"error": {
"type": "insufficient_scope",
"message": "Esta chave de API não tem o escopo students:read.",
"requiredScope": "students:read"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Valor da cobrança. Sem ele, installments vem null.
x >= 1Máximo de parcelas (1 a 12).
1 <= x <= 12true: o comprador paga o juro do parcelamento; false: a loja absorve. Mesmo default da cobrança.

