curl --request POST \
--url https://hg.cash/api/v1/checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "<string>",
"successUrl": "<string>",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cancelUrl": "<string>",
"webhookUrl": "<string>",
"expiresInSeconds": 123,
"idempotencyKey": "<string>",
"metadata": {},
"payer": {
"name": "<string>",
"document": "<string>",
"email": "jsmith@example.com"
},
"paymentMethodId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {}
}
'import requests
url = "https://hg.cash/api/v1/checkouts"
payload = {
"amount": "<string>",
"successUrl": "<string>",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cancelUrl": "<string>",
"webhookUrl": "<string>",
"expiresInSeconds": 123,
"idempotencyKey": "<string>",
"metadata": {},
"payer": {
"name": "<string>",
"document": "<string>",
"email": "jsmith@example.com"
},
"paymentMethodId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {}
}
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({
amount: '<string>',
successUrl: '<string>',
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cancelUrl: '<string>',
webhookUrl: '<string>',
expiresInSeconds: 123,
idempotencyKey: '<string>',
metadata: {},
payer: {name: '<string>', document: '<string>', email: 'jsmith@example.com'},
paymentMethodId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
customer: {}
})
};
fetch('https://hg.cash/api/v1/checkouts', 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://hg.cash/api/v1/checkouts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>',
'successUrl' => '<string>',
'accountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cancelUrl' => '<string>',
'webhookUrl' => '<string>',
'expiresInSeconds' => 123,
'idempotencyKey' => '<string>',
'metadata' => [
],
'payer' => [
'name' => '<string>',
'document' => '<string>',
'email' => 'jsmith@example.com'
],
'paymentMethodId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customer' => [
]
]),
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://hg.cash/api/v1/checkouts"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cancelUrl\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"expiresInSeconds\": 123,\n \"idempotencyKey\": \"<string>\",\n \"metadata\": {},\n \"payer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"paymentMethodId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer\": {}\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://hg.cash/api/v1/checkouts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cancelUrl\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"expiresInSeconds\": 123,\n \"idempotencyKey\": \"<string>\",\n \"metadata\": {},\n \"payer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"paymentMethodId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hg.cash/api/v1/checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cancelUrl\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"expiresInSeconds\": 123,\n \"idempotencyKey\": \"<string>\",\n \"metadata\": {},\n \"payer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"paymentMethodId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"publicToken": "<string>",
"checkoutUrl": "<string>",
"status": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"accountDisplay": {},
"qrCode": "<string>",
"pixCopiaECola": "<string>",
"checkoutUrlProvider": "<string>"
}Criar sessão de checkout
Cria um checkout hospedado para AR (transferência + DNI), BR (QR PIX), CL (iframe do provedor) ou BO (pagamento QR).
Retorna checkoutUrl para o pagador e campos opcionais do provedor (QR, URL do iframe).
curl --request POST \
--url https://hg.cash/api/v1/checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "<string>",
"successUrl": "<string>",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cancelUrl": "<string>",
"webhookUrl": "<string>",
"expiresInSeconds": 123,
"idempotencyKey": "<string>",
"metadata": {},
"payer": {
"name": "<string>",
"document": "<string>",
"email": "jsmith@example.com"
},
"paymentMethodId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {}
}
'import requests
url = "https://hg.cash/api/v1/checkouts"
payload = {
"amount": "<string>",
"successUrl": "<string>",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"cancelUrl": "<string>",
"webhookUrl": "<string>",
"expiresInSeconds": 123,
"idempotencyKey": "<string>",
"metadata": {},
"payer": {
"name": "<string>",
"document": "<string>",
"email": "jsmith@example.com"
},
"paymentMethodId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customer": {}
}
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({
amount: '<string>',
successUrl: '<string>',
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
cancelUrl: '<string>',
webhookUrl: '<string>',
expiresInSeconds: 123,
idempotencyKey: '<string>',
metadata: {},
payer: {name: '<string>', document: '<string>', email: 'jsmith@example.com'},
paymentMethodId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
customer: {}
})
};
fetch('https://hg.cash/api/v1/checkouts', 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://hg.cash/api/v1/checkouts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => '<string>',
'successUrl' => '<string>',
'accountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'cancelUrl' => '<string>',
'webhookUrl' => '<string>',
'expiresInSeconds' => 123,
'idempotencyKey' => '<string>',
'metadata' => [
],
'payer' => [
'name' => '<string>',
'document' => '<string>',
'email' => 'jsmith@example.com'
],
'paymentMethodId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customer' => [
]
]),
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://hg.cash/api/v1/checkouts"
payload := strings.NewReader("{\n \"amount\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cancelUrl\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"expiresInSeconds\": 123,\n \"idempotencyKey\": \"<string>\",\n \"metadata\": {},\n \"payer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"paymentMethodId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer\": {}\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://hg.cash/api/v1/checkouts")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cancelUrl\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"expiresInSeconds\": 123,\n \"idempotencyKey\": \"<string>\",\n \"metadata\": {},\n \"payer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"paymentMethodId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hg.cash/api/v1/checkouts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"<string>\",\n \"successUrl\": \"<string>\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"cancelUrl\": \"<string>\",\n \"webhookUrl\": \"<string>\",\n \"expiresInSeconds\": 123,\n \"idempotencyKey\": \"<string>\",\n \"metadata\": {},\n \"payer\": {\n \"name\": \"<string>\",\n \"document\": \"<string>\",\n \"email\": \"jsmith@example.com\"\n },\n \"paymentMethodId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"publicToken": "<string>",
"checkoutUrl": "<string>",
"status": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"accountDisplay": {},
"qrCode": "<string>",
"pixCopiaECola": "<string>",
"checkoutUrlProvider": "<string>"
}Autorizações
Token de autenticação da API do usuário com o formato cash_<64-char-hex>. Valor de exemplo cash_16cdc3b6f83c72d9d2680adca4f430962981f6bf32613a129dded0aa060387d2.
Corpo
País do checkout (AR, BR, CL ou BO)
AR, BR, CL, BO Valor decimal como string
URL de redirecionamento após pagamento bem-sucedido
ID da conta HG.Cash que receberá o pagamento
URL de redirecionamento se o pagador cancelar
URL de webhook opcional para eventos desta sessão
Tempo de expiração da sessão em segundos
Chave de idempotência opcional para evitar duplicatas
Idioma da interface do checkout
es, en Metadados opacos anexados à sessão
BR exige name, document e email; BO exige name, document e email
Show child attributes
Show child attributes
Obrigatório para CL
Obrigatório para CL (veja os campos customer de ClInboundTransactionRequest)

