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>"
}Crear sesión de checkout
Crea un checkout hospedado para AR (transferencia + DNI), BR (QR PIX), CL (iframe hospedado), BO (pago QR) o CO (checkout hospedado).
Colombia exige country: "CO", amount y successUrl. No exige nombre, documento ni email del pagador. HG configura los medios de pago disponibles; la solicitud de creación no los elige.
El pagador abre checkoutUrl, completa el pago y vuelve a la página de éxito de HG. successUrl se usa solo después de confirmar el pago.
La respuesta de creación de Colombia incluye checkoutUrl y omite checkoutUrlProvider. Las respuestas de consulta, listado y cancelación de Colombia omiten providerData. La creación de Chile incluye checkoutUrlProvider.
expiresInSeconds es opcional. El valor predeterminado es 86400 segundos. El máximo es 604800 segundos.
Una cuenta Bloqueada o Cerrada devuelve 403 con code: ACCOUNT_NOT_OPERATIVE. Una cuenta Restringida devuelve 403 con code: RESTRICTED. Una cuenta COP que no está lista para el checkout devuelve 400 con error: "Account is not ready for checkout". Una cuenta que no es una cuenta de checkout en COP devuelve 400 con error: "Account is not supported for this checkout country".
Si no se puede crear la sesión hospedada, la API devuelve 502 con error: "Failed to create CO payment with provider".
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>"
}Autorizaciones
Token de autenticación de API de usuario con formato cash_<64-char-hex>. Valor de ejemplo cash_16cdc3b6f83c72d9d2680adca4f430962981f6bf32613a129dded0aa060387d2.
Cuerpo
AR, BR, CL, BO, CO Monto decimal como cadena
Opcional. El valor predeterminado es 86400 segundos. El máximo es 604800 segundos.
es, en BR exige name, document y email; BO exige name, document y email. CO no exige campos de payer.
Show child attributes
Show child attributes
Obligatorio para CL
Obligatorio para CL (ver campos customer de ClInboundTransactionRequest)

