Criar checkout
curl --request POST \
--url https://api.hubfy.io/v1/checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Fotografia Essencial",
"items": [
{
"offer_id": "prc_4f8k2m9q1x7c3v5b"
}
],
"payment_methods": [
"credit_card"
],
"max_installments": 12,
"interest_payer": "buyer"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Fotografia Essencial',
items: [{offer_id: 'prc_4f8k2m9q1x7c3v5b'}],
payment_methods: ['credit_card'],
max_installments: 12,
interest_payer: 'buyer'
})
};
fetch('https://api.hubfy.io/v1/checkouts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hubfy.io/v1/checkouts"
payload = {
"title": "Fotografia Essencial",
"items": [{ "offer_id": "prc_4f8k2m9q1x7c3v5b" }],
"payment_methods": ["credit_card"],
"max_installments": 12,
"interest_payer": "buyer"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "chk_4f8k2m9q1x7c3v5b",
"status": "active",
"dashboard_url": "https://dashboard.hubfy.io/acc_3h6k9n2q5t8w1z4c/dashboard"
}{
"error": {
"code": "invalid_parameter",
"message": "email: Invalid email address",
"param": null,
"type": "invalid_request_error",
"doc_url": null
}
}{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key",
"param": null,
"type": "authentication_error",
"doc_url": null
}
}{
"error": {
"code": "insufficient_permission",
"message": "Esta credencial não tem a área orders em Ver e alterar.",
"param": null,
"type": "permission_error",
"doc_url": null
}
}{
"error": {
"code": "not_found",
"message": "Pedido ord_4f8k2m9q1x7c3v5b não encontrado nesta conta.",
"param": null,
"type": "invalid_request_error",
"doc_url": null
}
}{
"error": {
"code": "idempotency_key_in_use",
"message": "Outra chamada com esta idempotency_key está em andamento.",
"param": null,
"type": "invalid_request_error",
"doc_url": null
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Account request limit exceeded; retry after 60 seconds",
"param": null,
"type": "rate_limit_error",
"doc_url": null
}
}Produtos e checkouts
Criar checkout
Cria um checkout (página de pagamento) em rascunho com uma ou mais ofertas (offer_id prc_ de GET /v1/products/{product_id}; só avulsas ou só assinaturas do mesmo período). POST /v1/checkouts na API da Hubfy: parâmetros, resposta, erros e exemplos. Também no conector MCP (create_checkout).
POST
/
v1
/
checkouts
Criar checkout
curl --request POST \
--url https://api.hubfy.io/v1/checkouts \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Fotografia Essencial",
"items": [
{
"offer_id": "prc_4f8k2m9q1x7c3v5b"
}
],
"payment_methods": [
"credit_card"
],
"max_installments": 12,
"interest_payer": "buyer"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: 'Fotografia Essencial',
items: [{offer_id: 'prc_4f8k2m9q1x7c3v5b'}],
payment_methods: ['credit_card'],
max_installments: 12,
interest_payer: 'buyer'
})
};
fetch('https://api.hubfy.io/v1/checkouts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.hubfy.io/v1/checkouts"
payload = {
"title": "Fotografia Essencial",
"items": [{ "offer_id": "prc_4f8k2m9q1x7c3v5b" }],
"payment_methods": ["credit_card"],
"max_installments": 12,
"interest_payer": "buyer"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "chk_4f8k2m9q1x7c3v5b",
"status": "active",
"dashboard_url": "https://dashboard.hubfy.io/acc_3h6k9n2q5t8w1z4c/dashboard"
}{
"error": {
"code": "invalid_parameter",
"message": "email: Invalid email address",
"param": null,
"type": "invalid_request_error",
"doc_url": null
}
}{
"error": {
"code": "invalid_api_key",
"message": "Invalid API key",
"param": null,
"type": "authentication_error",
"doc_url": null
}
}{
"error": {
"code": "insufficient_permission",
"message": "Esta credencial não tem a área orders em Ver e alterar.",
"param": null,
"type": "permission_error",
"doc_url": null
}
}{
"error": {
"code": "not_found",
"message": "Pedido ord_4f8k2m9q1x7c3v5b não encontrado nesta conta.",
"param": null,
"type": "invalid_request_error",
"doc_url": null
}
}{
"error": {
"code": "idempotency_key_in_use",
"message": "Outra chamada com esta idempotency_key está em andamento.",
"param": null,
"type": "invalid_request_error",
"doc_url": null
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Account request limit exceeded; retry after 60 seconds",
"param": null,
"type": "rate_limit_error",
"doc_url": null
}
}Autorizações
Cabeçalhos
Corpo
application/json