Criar Assinatura
curl --request POST \
--url https://pay.autorizou.dev/api/v1/charges/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"code": "<string>",
"mcc": "<string>",
"notification_url": "<string>",
"offer_id": "<string>",
"interval": "<string>",
"start_at": "<string>",
"best_charge_day": 123,
"trial_days": 123,
"next_charge_amount": 123,
"customer": {
"customer.id": "<string>",
"customer.name": "<string>",
"customer.email": "<string>",
"customer.documents": [
{
"customer.documents[].type": "<string>",
"customer.documents[].value": "<string>"
}
],
"customer.phone": {
"customer.phone.type": "<string>",
"customer.phone.ddi": "<string>",
"customer.phone.ddd": "<string>",
"customer.phone.number": "<string>"
},
"customer.addresses": [
{
"customer.addresses[].type": "<string>",
"customer.addresses[].postal_code": "<string>",
"customer.addresses[].line_1": "<string>",
"customer.addresses[].line_2": "<string>",
"customer.addresses[].number": "<string>",
"customer.addresses[].neighborhood": "<string>",
"customer.addresses[].city": "<string>",
"customer.addresses[].state": "<string>",
"customer.addresses[].country": "<string>"
}
]
},
"payment": {
"payment.amount": 123,
"payment.currency": "<string>",
"payment.payment_method": "<string>",
"payment.installments": 123,
"payment.credit_card": {
"payment.credit_card.id": "<string>",
"payment.credit_card.statement_descriptor": "<string>",
"payment.credit_card.capture": true,
"payment.credit_card.processing_model": "<string>"
},
"payment.bank_slip": {
"payment.bank_slip.due_at": "<string>"
},
"payment.pix": {
"payment.pix.expires_at": "<string>"
},
"payment.pix_recurring": {
"payment.pix_recurring.recurring_statement": "<string>",
"payment.pix_recurring.recurring_amount": 123,
"payment.pix_recurring.min_amount": 123,
"payment.pix_recurring.retry_policy": true
},
"payment.google_pay": {
"payment.google_pay.google_pay_token": "<string>",
"payment.google_pay.statement_descriptor": "<string>",
"payment.google_pay.capture": true,
"payment.google_pay.capture_delay_hours": 123
},
"payment.split": [
{
"payment.split[].recipient_id": 123,
"payment.split[].amount": 123,
"payment.split[].type": "<string>",
"payment.split[].allow_charge_processing_fee": true,
"payment.split[].allow_charge_remainder_fee": true,
"payment.split[].is_liable": true
}
]
},
"items": [
{
"items[].name": "<string>",
"items[].description": "<string>",
"items[].quantity": 123,
"items[].amount": 123
}
]
}
'import requests
url = "https://pay.autorizou.dev/api/v1/charges/subscriptions"
payload = {
"description": "<string>",
"code": "<string>",
"mcc": "<string>",
"notification_url": "<string>",
"offer_id": "<string>",
"interval": "<string>",
"start_at": "<string>",
"best_charge_day": 123,
"trial_days": 123,
"next_charge_amount": 123,
"customer": {
"customer.id": "<string>",
"customer.name": "<string>",
"customer.email": "<string>",
"customer.documents": [
{
"customer.documents[].type": "<string>",
"customer.documents[].value": "<string>"
}
],
"customer.phone": {
"customer.phone.type": "<string>",
"customer.phone.ddi": "<string>",
"customer.phone.ddd": "<string>",
"customer.phone.number": "<string>"
},
"customer.addresses": [
{
"customer.addresses[].type": "<string>",
"customer.addresses[].postal_code": "<string>",
"customer.addresses[].line_1": "<string>",
"customer.addresses[].line_2": "<string>",
"customer.addresses[].number": "<string>",
"customer.addresses[].neighborhood": "<string>",
"customer.addresses[].city": "<string>",
"customer.addresses[].state": "<string>",
"customer.addresses[].country": "<string>"
}
]
},
"payment": {
"payment.amount": 123,
"payment.currency": "<string>",
"payment.payment_method": "<string>",
"payment.installments": 123,
"payment.credit_card": {
"payment.credit_card.id": "<string>",
"payment.credit_card.statement_descriptor": "<string>",
"payment.credit_card.capture": True,
"payment.credit_card.processing_model": "<string>"
},
"payment.bank_slip": { "payment.bank_slip.due_at": "<string>" },
"payment.pix": { "payment.pix.expires_at": "<string>" },
"payment.pix_recurring": {
"payment.pix_recurring.recurring_statement": "<string>",
"payment.pix_recurring.recurring_amount": 123,
"payment.pix_recurring.min_amount": 123,
"payment.pix_recurring.retry_policy": True
},
"payment.google_pay": {
"payment.google_pay.google_pay_token": "<string>",
"payment.google_pay.statement_descriptor": "<string>",
"payment.google_pay.capture": True,
"payment.google_pay.capture_delay_hours": 123
},
"payment.split": [
{
"payment.split[].recipient_id": 123,
"payment.split[].amount": 123,
"payment.split[].type": "<string>",
"payment.split[].allow_charge_processing_fee": True,
"payment.split[].allow_charge_remainder_fee": True,
"payment.split[].is_liable": True
}
]
},
"items": [
{
"items[].name": "<string>",
"items[].description": "<string>",
"items[].quantity": 123,
"items[].amount": 123
}
]
}
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({
description: '<string>',
code: '<string>',
mcc: '<string>',
notification_url: '<string>',
offer_id: '<string>',
interval: '<string>',
start_at: '<string>',
best_charge_day: 123,
trial_days: 123,
next_charge_amount: 123,
customer: {
'customer.id': '<string>',
'customer.name': '<string>',
'customer.email': '<string>',
'customer.documents': [
{
'customer.documents[].type': '<string>',
'customer.documents[].value': '<string>'
}
],
'customer.phone': {
'customer.phone.type': '<string>',
'customer.phone.ddi': '<string>',
'customer.phone.ddd': '<string>',
'customer.phone.number': '<string>'
},
'customer.addresses': [
{
'customer.addresses[].type': '<string>',
'customer.addresses[].postal_code': '<string>',
'customer.addresses[].line_1': '<string>',
'customer.addresses[].line_2': '<string>',
'customer.addresses[].number': '<string>',
'customer.addresses[].neighborhood': '<string>',
'customer.addresses[].city': '<string>',
'customer.addresses[].state': '<string>',
'customer.addresses[].country': '<string>'
}
]
},
payment: {
'payment.amount': 123,
'payment.currency': '<string>',
'payment.payment_method': '<string>',
'payment.installments': 123,
'payment.credit_card': {
'payment.credit_card.id': '<string>',
'payment.credit_card.statement_descriptor': '<string>',
'payment.credit_card.capture': true,
'payment.credit_card.processing_model': '<string>'
},
'payment.bank_slip': {'payment.bank_slip.due_at': '<string>'},
'payment.pix': {'payment.pix.expires_at': '<string>'},
'payment.pix_recurring': {
'payment.pix_recurring.recurring_statement': '<string>',
'payment.pix_recurring.recurring_amount': 123,
'payment.pix_recurring.min_amount': 123,
'payment.pix_recurring.retry_policy': true
},
'payment.google_pay': {
'payment.google_pay.google_pay_token': '<string>',
'payment.google_pay.statement_descriptor': '<string>',
'payment.google_pay.capture': true,
'payment.google_pay.capture_delay_hours': 123
},
'payment.split': [
{
'payment.split[].recipient_id': 123,
'payment.split[].amount': 123,
'payment.split[].type': '<string>',
'payment.split[].allow_charge_processing_fee': true,
'payment.split[].allow_charge_remainder_fee': true,
'payment.split[].is_liable': true
}
]
},
items: [
{
'items[].name': '<string>',
'items[].description': '<string>',
'items[].quantity': 123,
'items[].amount': 123
}
]
})
};
fetch('https://pay.autorizou.dev/api/v1/charges/subscriptions', 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://pay.autorizou.dev/api/v1/charges/subscriptions",
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([
'description' => '<string>',
'code' => '<string>',
'mcc' => '<string>',
'notification_url' => '<string>',
'offer_id' => '<string>',
'interval' => '<string>',
'start_at' => '<string>',
'best_charge_day' => 123,
'trial_days' => 123,
'next_charge_amount' => 123,
'customer' => [
'customer.id' => '<string>',
'customer.name' => '<string>',
'customer.email' => '<string>',
'customer.documents' => [
[
'customer.documents[].type' => '<string>',
'customer.documents[].value' => '<string>'
]
],
'customer.phone' => [
'customer.phone.type' => '<string>',
'customer.phone.ddi' => '<string>',
'customer.phone.ddd' => '<string>',
'customer.phone.number' => '<string>'
],
'customer.addresses' => [
[
'customer.addresses[].type' => '<string>',
'customer.addresses[].postal_code' => '<string>',
'customer.addresses[].line_1' => '<string>',
'customer.addresses[].line_2' => '<string>',
'customer.addresses[].number' => '<string>',
'customer.addresses[].neighborhood' => '<string>',
'customer.addresses[].city' => '<string>',
'customer.addresses[].state' => '<string>',
'customer.addresses[].country' => '<string>'
]
]
],
'payment' => [
'payment.amount' => 123,
'payment.currency' => '<string>',
'payment.payment_method' => '<string>',
'payment.installments' => 123,
'payment.credit_card' => [
'payment.credit_card.id' => '<string>',
'payment.credit_card.statement_descriptor' => '<string>',
'payment.credit_card.capture' => true,
'payment.credit_card.processing_model' => '<string>'
],
'payment.bank_slip' => [
'payment.bank_slip.due_at' => '<string>'
],
'payment.pix' => [
'payment.pix.expires_at' => '<string>'
],
'payment.pix_recurring' => [
'payment.pix_recurring.recurring_statement' => '<string>',
'payment.pix_recurring.recurring_amount' => 123,
'payment.pix_recurring.min_amount' => 123,
'payment.pix_recurring.retry_policy' => true
],
'payment.google_pay' => [
'payment.google_pay.google_pay_token' => '<string>',
'payment.google_pay.statement_descriptor' => '<string>',
'payment.google_pay.capture' => true,
'payment.google_pay.capture_delay_hours' => 123
],
'payment.split' => [
[
'payment.split[].recipient_id' => 123,
'payment.split[].amount' => 123,
'payment.split[].type' => '<string>',
'payment.split[].allow_charge_processing_fee' => true,
'payment.split[].allow_charge_remainder_fee' => true,
'payment.split[].is_liable' => true
]
]
],
'items' => [
[
'items[].name' => '<string>',
'items[].description' => '<string>',
'items[].quantity' => 123,
'items[].amount' => 123
]
]
]),
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://pay.autorizou.dev/api/v1/charges/subscriptions"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"mcc\": \"<string>\",\n \"notification_url\": \"<string>\",\n \"offer_id\": \"<string>\",\n \"interval\": \"<string>\",\n \"start_at\": \"<string>\",\n \"best_charge_day\": 123,\n \"trial_days\": 123,\n \"next_charge_amount\": 123,\n \"customer\": {\n \"customer.id\": \"<string>\",\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.documents\": [\n {\n \"customer.documents[].type\": \"<string>\",\n \"customer.documents[].value\": \"<string>\"\n }\n ],\n \"customer.phone\": {\n \"customer.phone.type\": \"<string>\",\n \"customer.phone.ddi\": \"<string>\",\n \"customer.phone.ddd\": \"<string>\",\n \"customer.phone.number\": \"<string>\"\n },\n \"customer.addresses\": [\n {\n \"customer.addresses[].type\": \"<string>\",\n \"customer.addresses[].postal_code\": \"<string>\",\n \"customer.addresses[].line_1\": \"<string>\",\n \"customer.addresses[].line_2\": \"<string>\",\n \"customer.addresses[].number\": \"<string>\",\n \"customer.addresses[].neighborhood\": \"<string>\",\n \"customer.addresses[].city\": \"<string>\",\n \"customer.addresses[].state\": \"<string>\",\n \"customer.addresses[].country\": \"<string>\"\n }\n ]\n },\n \"payment\": {\n \"payment.amount\": 123,\n \"payment.currency\": \"<string>\",\n \"payment.payment_method\": \"<string>\",\n \"payment.installments\": 123,\n \"payment.credit_card\": {\n \"payment.credit_card.id\": \"<string>\",\n \"payment.credit_card.statement_descriptor\": \"<string>\",\n \"payment.credit_card.capture\": true,\n \"payment.credit_card.processing_model\": \"<string>\"\n },\n \"payment.bank_slip\": {\n \"payment.bank_slip.due_at\": \"<string>\"\n },\n \"payment.pix\": {\n \"payment.pix.expires_at\": \"<string>\"\n },\n \"payment.pix_recurring\": {\n \"payment.pix_recurring.recurring_statement\": \"<string>\",\n \"payment.pix_recurring.recurring_amount\": 123,\n \"payment.pix_recurring.min_amount\": 123,\n \"payment.pix_recurring.retry_policy\": true\n },\n \"payment.google_pay\": {\n \"payment.google_pay.google_pay_token\": \"<string>\",\n \"payment.google_pay.statement_descriptor\": \"<string>\",\n \"payment.google_pay.capture\": true,\n \"payment.google_pay.capture_delay_hours\": 123\n },\n \"payment.split\": [\n {\n \"payment.split[].recipient_id\": 123,\n \"payment.split[].amount\": 123,\n \"payment.split[].type\": \"<string>\",\n \"payment.split[].allow_charge_processing_fee\": true,\n \"payment.split[].allow_charge_remainder_fee\": true,\n \"payment.split[].is_liable\": true\n }\n ]\n },\n \"items\": [\n {\n \"items[].name\": \"<string>\",\n \"items[].description\": \"<string>\",\n \"items[].quantity\": 123,\n \"items[].amount\": 123\n }\n ]\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://pay.autorizou.dev/api/v1/charges/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"mcc\": \"<string>\",\n \"notification_url\": \"<string>\",\n \"offer_id\": \"<string>\",\n \"interval\": \"<string>\",\n \"start_at\": \"<string>\",\n \"best_charge_day\": 123,\n \"trial_days\": 123,\n \"next_charge_amount\": 123,\n \"customer\": {\n \"customer.id\": \"<string>\",\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.documents\": [\n {\n \"customer.documents[].type\": \"<string>\",\n \"customer.documents[].value\": \"<string>\"\n }\n ],\n \"customer.phone\": {\n \"customer.phone.type\": \"<string>\",\n \"customer.phone.ddi\": \"<string>\",\n \"customer.phone.ddd\": \"<string>\",\n \"customer.phone.number\": \"<string>\"\n },\n \"customer.addresses\": [\n {\n \"customer.addresses[].type\": \"<string>\",\n \"customer.addresses[].postal_code\": \"<string>\",\n \"customer.addresses[].line_1\": \"<string>\",\n \"customer.addresses[].line_2\": \"<string>\",\n \"customer.addresses[].number\": \"<string>\",\n \"customer.addresses[].neighborhood\": \"<string>\",\n \"customer.addresses[].city\": \"<string>\",\n \"customer.addresses[].state\": \"<string>\",\n \"customer.addresses[].country\": \"<string>\"\n }\n ]\n },\n \"payment\": {\n \"payment.amount\": 123,\n \"payment.currency\": \"<string>\",\n \"payment.payment_method\": \"<string>\",\n \"payment.installments\": 123,\n \"payment.credit_card\": {\n \"payment.credit_card.id\": \"<string>\",\n \"payment.credit_card.statement_descriptor\": \"<string>\",\n \"payment.credit_card.capture\": true,\n \"payment.credit_card.processing_model\": \"<string>\"\n },\n \"payment.bank_slip\": {\n \"payment.bank_slip.due_at\": \"<string>\"\n },\n \"payment.pix\": {\n \"payment.pix.expires_at\": \"<string>\"\n },\n \"payment.pix_recurring\": {\n \"payment.pix_recurring.recurring_statement\": \"<string>\",\n \"payment.pix_recurring.recurring_amount\": 123,\n \"payment.pix_recurring.min_amount\": 123,\n \"payment.pix_recurring.retry_policy\": true\n },\n \"payment.google_pay\": {\n \"payment.google_pay.google_pay_token\": \"<string>\",\n \"payment.google_pay.statement_descriptor\": \"<string>\",\n \"payment.google_pay.capture\": true,\n \"payment.google_pay.capture_delay_hours\": 123\n },\n \"payment.split\": [\n {\n \"payment.split[].recipient_id\": 123,\n \"payment.split[].amount\": 123,\n \"payment.split[].type\": \"<string>\",\n \"payment.split[].allow_charge_processing_fee\": true,\n \"payment.split[].allow_charge_remainder_fee\": true,\n \"payment.split[].is_liable\": true\n }\n ]\n },\n \"items\": [\n {\n \"items[].name\": \"<string>\",\n \"items[].description\": \"<string>\",\n \"items[].quantity\": 123,\n \"items[].amount\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.autorizou.dev/api/v1/charges/subscriptions")
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 \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"mcc\": \"<string>\",\n \"notification_url\": \"<string>\",\n \"offer_id\": \"<string>\",\n \"interval\": \"<string>\",\n \"start_at\": \"<string>\",\n \"best_charge_day\": 123,\n \"trial_days\": 123,\n \"next_charge_amount\": 123,\n \"customer\": {\n \"customer.id\": \"<string>\",\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.documents\": [\n {\n \"customer.documents[].type\": \"<string>\",\n \"customer.documents[].value\": \"<string>\"\n }\n ],\n \"customer.phone\": {\n \"customer.phone.type\": \"<string>\",\n \"customer.phone.ddi\": \"<string>\",\n \"customer.phone.ddd\": \"<string>\",\n \"customer.phone.number\": \"<string>\"\n },\n \"customer.addresses\": [\n {\n \"customer.addresses[].type\": \"<string>\",\n \"customer.addresses[].postal_code\": \"<string>\",\n \"customer.addresses[].line_1\": \"<string>\",\n \"customer.addresses[].line_2\": \"<string>\",\n \"customer.addresses[].number\": \"<string>\",\n \"customer.addresses[].neighborhood\": \"<string>\",\n \"customer.addresses[].city\": \"<string>\",\n \"customer.addresses[].state\": \"<string>\",\n \"customer.addresses[].country\": \"<string>\"\n }\n ]\n },\n \"payment\": {\n \"payment.amount\": 123,\n \"payment.currency\": \"<string>\",\n \"payment.payment_method\": \"<string>\",\n \"payment.installments\": 123,\n \"payment.credit_card\": {\n \"payment.credit_card.id\": \"<string>\",\n \"payment.credit_card.statement_descriptor\": \"<string>\",\n \"payment.credit_card.capture\": true,\n \"payment.credit_card.processing_model\": \"<string>\"\n },\n \"payment.bank_slip\": {\n \"payment.bank_slip.due_at\": \"<string>\"\n },\n \"payment.pix\": {\n \"payment.pix.expires_at\": \"<string>\"\n },\n \"payment.pix_recurring\": {\n \"payment.pix_recurring.recurring_statement\": \"<string>\",\n \"payment.pix_recurring.recurring_amount\": 123,\n \"payment.pix_recurring.min_amount\": 123,\n \"payment.pix_recurring.retry_policy\": true\n },\n \"payment.google_pay\": {\n \"payment.google_pay.google_pay_token\": \"<string>\",\n \"payment.google_pay.statement_descriptor\": \"<string>\",\n \"payment.google_pay.capture\": true,\n \"payment.google_pay.capture_delay_hours\": 123\n },\n \"payment.split\": [\n {\n \"payment.split[].recipient_id\": 123,\n \"payment.split[].amount\": 123,\n \"payment.split[].type\": \"<string>\",\n \"payment.split[].allow_charge_processing_fee\": true,\n \"payment.split[].allow_charge_remainder_fee\": true,\n \"payment.split[].is_liable\": true\n }\n ]\n },\n \"items\": [\n {\n \"items[].name\": \"<string>\",\n \"items[].description\": \"<string>\",\n \"items[].quantity\": 123,\n \"items[].amount\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Os dados fornecidos são inválidos",
"errors": {
"payment.amount": ["O campo amount é obrigatório quando offer_id não é fornecido"],
"offer_id": ["Oferta recorrente não encontrada."],
"customer.id": ["Cliente não encontrado"],
"payment.credit_card.id": ["Cartão não encontrado ou não pertence ao cliente"]
}
}
{
"status": "payment_refused",
"payment": {
"status": "refused",
"refused_reason": "Não autorizado",
"return_code": "05"
}
}
Assinaturas
Criar Assinatura
Crie assinaturas recorrentes com cobrança automática de clientes
POST
/
api
/
v1
/
charges
/
subscriptions
Criar Assinatura
curl --request POST \
--url https://pay.autorizou.dev/api/v1/charges/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "<string>",
"code": "<string>",
"mcc": "<string>",
"notification_url": "<string>",
"offer_id": "<string>",
"interval": "<string>",
"start_at": "<string>",
"best_charge_day": 123,
"trial_days": 123,
"next_charge_amount": 123,
"customer": {
"customer.id": "<string>",
"customer.name": "<string>",
"customer.email": "<string>",
"customer.documents": [
{
"customer.documents[].type": "<string>",
"customer.documents[].value": "<string>"
}
],
"customer.phone": {
"customer.phone.type": "<string>",
"customer.phone.ddi": "<string>",
"customer.phone.ddd": "<string>",
"customer.phone.number": "<string>"
},
"customer.addresses": [
{
"customer.addresses[].type": "<string>",
"customer.addresses[].postal_code": "<string>",
"customer.addresses[].line_1": "<string>",
"customer.addresses[].line_2": "<string>",
"customer.addresses[].number": "<string>",
"customer.addresses[].neighborhood": "<string>",
"customer.addresses[].city": "<string>",
"customer.addresses[].state": "<string>",
"customer.addresses[].country": "<string>"
}
]
},
"payment": {
"payment.amount": 123,
"payment.currency": "<string>",
"payment.payment_method": "<string>",
"payment.installments": 123,
"payment.credit_card": {
"payment.credit_card.id": "<string>",
"payment.credit_card.statement_descriptor": "<string>",
"payment.credit_card.capture": true,
"payment.credit_card.processing_model": "<string>"
},
"payment.bank_slip": {
"payment.bank_slip.due_at": "<string>"
},
"payment.pix": {
"payment.pix.expires_at": "<string>"
},
"payment.pix_recurring": {
"payment.pix_recurring.recurring_statement": "<string>",
"payment.pix_recurring.recurring_amount": 123,
"payment.pix_recurring.min_amount": 123,
"payment.pix_recurring.retry_policy": true
},
"payment.google_pay": {
"payment.google_pay.google_pay_token": "<string>",
"payment.google_pay.statement_descriptor": "<string>",
"payment.google_pay.capture": true,
"payment.google_pay.capture_delay_hours": 123
},
"payment.split": [
{
"payment.split[].recipient_id": 123,
"payment.split[].amount": 123,
"payment.split[].type": "<string>",
"payment.split[].allow_charge_processing_fee": true,
"payment.split[].allow_charge_remainder_fee": true,
"payment.split[].is_liable": true
}
]
},
"items": [
{
"items[].name": "<string>",
"items[].description": "<string>",
"items[].quantity": 123,
"items[].amount": 123
}
]
}
'import requests
url = "https://pay.autorizou.dev/api/v1/charges/subscriptions"
payload = {
"description": "<string>",
"code": "<string>",
"mcc": "<string>",
"notification_url": "<string>",
"offer_id": "<string>",
"interval": "<string>",
"start_at": "<string>",
"best_charge_day": 123,
"trial_days": 123,
"next_charge_amount": 123,
"customer": {
"customer.id": "<string>",
"customer.name": "<string>",
"customer.email": "<string>",
"customer.documents": [
{
"customer.documents[].type": "<string>",
"customer.documents[].value": "<string>"
}
],
"customer.phone": {
"customer.phone.type": "<string>",
"customer.phone.ddi": "<string>",
"customer.phone.ddd": "<string>",
"customer.phone.number": "<string>"
},
"customer.addresses": [
{
"customer.addresses[].type": "<string>",
"customer.addresses[].postal_code": "<string>",
"customer.addresses[].line_1": "<string>",
"customer.addresses[].line_2": "<string>",
"customer.addresses[].number": "<string>",
"customer.addresses[].neighborhood": "<string>",
"customer.addresses[].city": "<string>",
"customer.addresses[].state": "<string>",
"customer.addresses[].country": "<string>"
}
]
},
"payment": {
"payment.amount": 123,
"payment.currency": "<string>",
"payment.payment_method": "<string>",
"payment.installments": 123,
"payment.credit_card": {
"payment.credit_card.id": "<string>",
"payment.credit_card.statement_descriptor": "<string>",
"payment.credit_card.capture": True,
"payment.credit_card.processing_model": "<string>"
},
"payment.bank_slip": { "payment.bank_slip.due_at": "<string>" },
"payment.pix": { "payment.pix.expires_at": "<string>" },
"payment.pix_recurring": {
"payment.pix_recurring.recurring_statement": "<string>",
"payment.pix_recurring.recurring_amount": 123,
"payment.pix_recurring.min_amount": 123,
"payment.pix_recurring.retry_policy": True
},
"payment.google_pay": {
"payment.google_pay.google_pay_token": "<string>",
"payment.google_pay.statement_descriptor": "<string>",
"payment.google_pay.capture": True,
"payment.google_pay.capture_delay_hours": 123
},
"payment.split": [
{
"payment.split[].recipient_id": 123,
"payment.split[].amount": 123,
"payment.split[].type": "<string>",
"payment.split[].allow_charge_processing_fee": True,
"payment.split[].allow_charge_remainder_fee": True,
"payment.split[].is_liable": True
}
]
},
"items": [
{
"items[].name": "<string>",
"items[].description": "<string>",
"items[].quantity": 123,
"items[].amount": 123
}
]
}
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({
description: '<string>',
code: '<string>',
mcc: '<string>',
notification_url: '<string>',
offer_id: '<string>',
interval: '<string>',
start_at: '<string>',
best_charge_day: 123,
trial_days: 123,
next_charge_amount: 123,
customer: {
'customer.id': '<string>',
'customer.name': '<string>',
'customer.email': '<string>',
'customer.documents': [
{
'customer.documents[].type': '<string>',
'customer.documents[].value': '<string>'
}
],
'customer.phone': {
'customer.phone.type': '<string>',
'customer.phone.ddi': '<string>',
'customer.phone.ddd': '<string>',
'customer.phone.number': '<string>'
},
'customer.addresses': [
{
'customer.addresses[].type': '<string>',
'customer.addresses[].postal_code': '<string>',
'customer.addresses[].line_1': '<string>',
'customer.addresses[].line_2': '<string>',
'customer.addresses[].number': '<string>',
'customer.addresses[].neighborhood': '<string>',
'customer.addresses[].city': '<string>',
'customer.addresses[].state': '<string>',
'customer.addresses[].country': '<string>'
}
]
},
payment: {
'payment.amount': 123,
'payment.currency': '<string>',
'payment.payment_method': '<string>',
'payment.installments': 123,
'payment.credit_card': {
'payment.credit_card.id': '<string>',
'payment.credit_card.statement_descriptor': '<string>',
'payment.credit_card.capture': true,
'payment.credit_card.processing_model': '<string>'
},
'payment.bank_slip': {'payment.bank_slip.due_at': '<string>'},
'payment.pix': {'payment.pix.expires_at': '<string>'},
'payment.pix_recurring': {
'payment.pix_recurring.recurring_statement': '<string>',
'payment.pix_recurring.recurring_amount': 123,
'payment.pix_recurring.min_amount': 123,
'payment.pix_recurring.retry_policy': true
},
'payment.google_pay': {
'payment.google_pay.google_pay_token': '<string>',
'payment.google_pay.statement_descriptor': '<string>',
'payment.google_pay.capture': true,
'payment.google_pay.capture_delay_hours': 123
},
'payment.split': [
{
'payment.split[].recipient_id': 123,
'payment.split[].amount': 123,
'payment.split[].type': '<string>',
'payment.split[].allow_charge_processing_fee': true,
'payment.split[].allow_charge_remainder_fee': true,
'payment.split[].is_liable': true
}
]
},
items: [
{
'items[].name': '<string>',
'items[].description': '<string>',
'items[].quantity': 123,
'items[].amount': 123
}
]
})
};
fetch('https://pay.autorizou.dev/api/v1/charges/subscriptions', 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://pay.autorizou.dev/api/v1/charges/subscriptions",
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([
'description' => '<string>',
'code' => '<string>',
'mcc' => '<string>',
'notification_url' => '<string>',
'offer_id' => '<string>',
'interval' => '<string>',
'start_at' => '<string>',
'best_charge_day' => 123,
'trial_days' => 123,
'next_charge_amount' => 123,
'customer' => [
'customer.id' => '<string>',
'customer.name' => '<string>',
'customer.email' => '<string>',
'customer.documents' => [
[
'customer.documents[].type' => '<string>',
'customer.documents[].value' => '<string>'
]
],
'customer.phone' => [
'customer.phone.type' => '<string>',
'customer.phone.ddi' => '<string>',
'customer.phone.ddd' => '<string>',
'customer.phone.number' => '<string>'
],
'customer.addresses' => [
[
'customer.addresses[].type' => '<string>',
'customer.addresses[].postal_code' => '<string>',
'customer.addresses[].line_1' => '<string>',
'customer.addresses[].line_2' => '<string>',
'customer.addresses[].number' => '<string>',
'customer.addresses[].neighborhood' => '<string>',
'customer.addresses[].city' => '<string>',
'customer.addresses[].state' => '<string>',
'customer.addresses[].country' => '<string>'
]
]
],
'payment' => [
'payment.amount' => 123,
'payment.currency' => '<string>',
'payment.payment_method' => '<string>',
'payment.installments' => 123,
'payment.credit_card' => [
'payment.credit_card.id' => '<string>',
'payment.credit_card.statement_descriptor' => '<string>',
'payment.credit_card.capture' => true,
'payment.credit_card.processing_model' => '<string>'
],
'payment.bank_slip' => [
'payment.bank_slip.due_at' => '<string>'
],
'payment.pix' => [
'payment.pix.expires_at' => '<string>'
],
'payment.pix_recurring' => [
'payment.pix_recurring.recurring_statement' => '<string>',
'payment.pix_recurring.recurring_amount' => 123,
'payment.pix_recurring.min_amount' => 123,
'payment.pix_recurring.retry_policy' => true
],
'payment.google_pay' => [
'payment.google_pay.google_pay_token' => '<string>',
'payment.google_pay.statement_descriptor' => '<string>',
'payment.google_pay.capture' => true,
'payment.google_pay.capture_delay_hours' => 123
],
'payment.split' => [
[
'payment.split[].recipient_id' => 123,
'payment.split[].amount' => 123,
'payment.split[].type' => '<string>',
'payment.split[].allow_charge_processing_fee' => true,
'payment.split[].allow_charge_remainder_fee' => true,
'payment.split[].is_liable' => true
]
]
],
'items' => [
[
'items[].name' => '<string>',
'items[].description' => '<string>',
'items[].quantity' => 123,
'items[].amount' => 123
]
]
]),
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://pay.autorizou.dev/api/v1/charges/subscriptions"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"mcc\": \"<string>\",\n \"notification_url\": \"<string>\",\n \"offer_id\": \"<string>\",\n \"interval\": \"<string>\",\n \"start_at\": \"<string>\",\n \"best_charge_day\": 123,\n \"trial_days\": 123,\n \"next_charge_amount\": 123,\n \"customer\": {\n \"customer.id\": \"<string>\",\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.documents\": [\n {\n \"customer.documents[].type\": \"<string>\",\n \"customer.documents[].value\": \"<string>\"\n }\n ],\n \"customer.phone\": {\n \"customer.phone.type\": \"<string>\",\n \"customer.phone.ddi\": \"<string>\",\n \"customer.phone.ddd\": \"<string>\",\n \"customer.phone.number\": \"<string>\"\n },\n \"customer.addresses\": [\n {\n \"customer.addresses[].type\": \"<string>\",\n \"customer.addresses[].postal_code\": \"<string>\",\n \"customer.addresses[].line_1\": \"<string>\",\n \"customer.addresses[].line_2\": \"<string>\",\n \"customer.addresses[].number\": \"<string>\",\n \"customer.addresses[].neighborhood\": \"<string>\",\n \"customer.addresses[].city\": \"<string>\",\n \"customer.addresses[].state\": \"<string>\",\n \"customer.addresses[].country\": \"<string>\"\n }\n ]\n },\n \"payment\": {\n \"payment.amount\": 123,\n \"payment.currency\": \"<string>\",\n \"payment.payment_method\": \"<string>\",\n \"payment.installments\": 123,\n \"payment.credit_card\": {\n \"payment.credit_card.id\": \"<string>\",\n \"payment.credit_card.statement_descriptor\": \"<string>\",\n \"payment.credit_card.capture\": true,\n \"payment.credit_card.processing_model\": \"<string>\"\n },\n \"payment.bank_slip\": {\n \"payment.bank_slip.due_at\": \"<string>\"\n },\n \"payment.pix\": {\n \"payment.pix.expires_at\": \"<string>\"\n },\n \"payment.pix_recurring\": {\n \"payment.pix_recurring.recurring_statement\": \"<string>\",\n \"payment.pix_recurring.recurring_amount\": 123,\n \"payment.pix_recurring.min_amount\": 123,\n \"payment.pix_recurring.retry_policy\": true\n },\n \"payment.google_pay\": {\n \"payment.google_pay.google_pay_token\": \"<string>\",\n \"payment.google_pay.statement_descriptor\": \"<string>\",\n \"payment.google_pay.capture\": true,\n \"payment.google_pay.capture_delay_hours\": 123\n },\n \"payment.split\": [\n {\n \"payment.split[].recipient_id\": 123,\n \"payment.split[].amount\": 123,\n \"payment.split[].type\": \"<string>\",\n \"payment.split[].allow_charge_processing_fee\": true,\n \"payment.split[].allow_charge_remainder_fee\": true,\n \"payment.split[].is_liable\": true\n }\n ]\n },\n \"items\": [\n {\n \"items[].name\": \"<string>\",\n \"items[].description\": \"<string>\",\n \"items[].quantity\": 123,\n \"items[].amount\": 123\n }\n ]\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://pay.autorizou.dev/api/v1/charges/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"mcc\": \"<string>\",\n \"notification_url\": \"<string>\",\n \"offer_id\": \"<string>\",\n \"interval\": \"<string>\",\n \"start_at\": \"<string>\",\n \"best_charge_day\": 123,\n \"trial_days\": 123,\n \"next_charge_amount\": 123,\n \"customer\": {\n \"customer.id\": \"<string>\",\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.documents\": [\n {\n \"customer.documents[].type\": \"<string>\",\n \"customer.documents[].value\": \"<string>\"\n }\n ],\n \"customer.phone\": {\n \"customer.phone.type\": \"<string>\",\n \"customer.phone.ddi\": \"<string>\",\n \"customer.phone.ddd\": \"<string>\",\n \"customer.phone.number\": \"<string>\"\n },\n \"customer.addresses\": [\n {\n \"customer.addresses[].type\": \"<string>\",\n \"customer.addresses[].postal_code\": \"<string>\",\n \"customer.addresses[].line_1\": \"<string>\",\n \"customer.addresses[].line_2\": \"<string>\",\n \"customer.addresses[].number\": \"<string>\",\n \"customer.addresses[].neighborhood\": \"<string>\",\n \"customer.addresses[].city\": \"<string>\",\n \"customer.addresses[].state\": \"<string>\",\n \"customer.addresses[].country\": \"<string>\"\n }\n ]\n },\n \"payment\": {\n \"payment.amount\": 123,\n \"payment.currency\": \"<string>\",\n \"payment.payment_method\": \"<string>\",\n \"payment.installments\": 123,\n \"payment.credit_card\": {\n \"payment.credit_card.id\": \"<string>\",\n \"payment.credit_card.statement_descriptor\": \"<string>\",\n \"payment.credit_card.capture\": true,\n \"payment.credit_card.processing_model\": \"<string>\"\n },\n \"payment.bank_slip\": {\n \"payment.bank_slip.due_at\": \"<string>\"\n },\n \"payment.pix\": {\n \"payment.pix.expires_at\": \"<string>\"\n },\n \"payment.pix_recurring\": {\n \"payment.pix_recurring.recurring_statement\": \"<string>\",\n \"payment.pix_recurring.recurring_amount\": 123,\n \"payment.pix_recurring.min_amount\": 123,\n \"payment.pix_recurring.retry_policy\": true\n },\n \"payment.google_pay\": {\n \"payment.google_pay.google_pay_token\": \"<string>\",\n \"payment.google_pay.statement_descriptor\": \"<string>\",\n \"payment.google_pay.capture\": true,\n \"payment.google_pay.capture_delay_hours\": 123\n },\n \"payment.split\": [\n {\n \"payment.split[].recipient_id\": 123,\n \"payment.split[].amount\": 123,\n \"payment.split[].type\": \"<string>\",\n \"payment.split[].allow_charge_processing_fee\": true,\n \"payment.split[].allow_charge_remainder_fee\": true,\n \"payment.split[].is_liable\": true\n }\n ]\n },\n \"items\": [\n {\n \"items[].name\": \"<string>\",\n \"items[].description\": \"<string>\",\n \"items[].quantity\": 123,\n \"items[].amount\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pay.autorizou.dev/api/v1/charges/subscriptions")
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 \"description\": \"<string>\",\n \"code\": \"<string>\",\n \"mcc\": \"<string>\",\n \"notification_url\": \"<string>\",\n \"offer_id\": \"<string>\",\n \"interval\": \"<string>\",\n \"start_at\": \"<string>\",\n \"best_charge_day\": 123,\n \"trial_days\": 123,\n \"next_charge_amount\": 123,\n \"customer\": {\n \"customer.id\": \"<string>\",\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.documents\": [\n {\n \"customer.documents[].type\": \"<string>\",\n \"customer.documents[].value\": \"<string>\"\n }\n ],\n \"customer.phone\": {\n \"customer.phone.type\": \"<string>\",\n \"customer.phone.ddi\": \"<string>\",\n \"customer.phone.ddd\": \"<string>\",\n \"customer.phone.number\": \"<string>\"\n },\n \"customer.addresses\": [\n {\n \"customer.addresses[].type\": \"<string>\",\n \"customer.addresses[].postal_code\": \"<string>\",\n \"customer.addresses[].line_1\": \"<string>\",\n \"customer.addresses[].line_2\": \"<string>\",\n \"customer.addresses[].number\": \"<string>\",\n \"customer.addresses[].neighborhood\": \"<string>\",\n \"customer.addresses[].city\": \"<string>\",\n \"customer.addresses[].state\": \"<string>\",\n \"customer.addresses[].country\": \"<string>\"\n }\n ]\n },\n \"payment\": {\n \"payment.amount\": 123,\n \"payment.currency\": \"<string>\",\n \"payment.payment_method\": \"<string>\",\n \"payment.installments\": 123,\n \"payment.credit_card\": {\n \"payment.credit_card.id\": \"<string>\",\n \"payment.credit_card.statement_descriptor\": \"<string>\",\n \"payment.credit_card.capture\": true,\n \"payment.credit_card.processing_model\": \"<string>\"\n },\n \"payment.bank_slip\": {\n \"payment.bank_slip.due_at\": \"<string>\"\n },\n \"payment.pix\": {\n \"payment.pix.expires_at\": \"<string>\"\n },\n \"payment.pix_recurring\": {\n \"payment.pix_recurring.recurring_statement\": \"<string>\",\n \"payment.pix_recurring.recurring_amount\": 123,\n \"payment.pix_recurring.min_amount\": 123,\n \"payment.pix_recurring.retry_policy\": true\n },\n \"payment.google_pay\": {\n \"payment.google_pay.google_pay_token\": \"<string>\",\n \"payment.google_pay.statement_descriptor\": \"<string>\",\n \"payment.google_pay.capture\": true,\n \"payment.google_pay.capture_delay_hours\": 123\n },\n \"payment.split\": [\n {\n \"payment.split[].recipient_id\": 123,\n \"payment.split[].amount\": 123,\n \"payment.split[].type\": \"<string>\",\n \"payment.split[].allow_charge_processing_fee\": true,\n \"payment.split[].allow_charge_remainder_fee\": true,\n \"payment.split[].is_liable\": true\n }\n ]\n },\n \"items\": [\n {\n \"items[].name\": \"<string>\",\n \"items[].description\": \"<string>\",\n \"items[].quantity\": 123,\n \"items[].amount\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"message": "Os dados fornecidos são inválidos",
"errors": {
"payment.amount": ["O campo amount é obrigatório quando offer_id não é fornecido"],
"offer_id": ["Oferta recorrente não encontrada."],
"customer.id": ["Cliente não encontrado"],
"payment.credit_card.id": ["Cartão não encontrado ou não pertence ao cliente"]
}
}
{
"status": "payment_refused",
"payment": {
"status": "refused",
"refused_reason": "Não autorizado",
"return_code": "05"
}
}
Permite criar assinaturas recorrentes (semanal, mensal ou anual) com cobrança automática. Ideal para serviços SaaS, academias, escolas e outros modelos de negócio baseados em recorrência.
PIX Recorrente - Cobranças Automáticas:
Há três jeitos de vender uma assinatura, todos no mesmo modelo:
- Oferta recorrente com link pronto: crie uma oferta recorrente e compartilhe o
checkout_urldela. O comprador informa os próprios dados e paga. - Link de pagamento recorrente: crie um link com
recurrence_interval. Mesma ideia, sem produto. - Headless (esta rota): você já tem os dados do cliente e do cartão e cria a assinatura direto. Aponte uma oferta recorrente por
offer_idpara herdar a régua de preços, ou envieintervalmaisamountpara uma recorrência simples.
Idempotência (obrigatória)
Esta rota exige o headerIdempotency-Key — uma chave única gerada por assinatura (ex.: um UUID). Sem ele, a resposta é 400.
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000
- Replay: a mesma chave com o mesmo corpo devolve a resposta original (não cria uma segunda assinatura) — seguro para retry.
- Conflito (
409): a mesma chave com corpo diferente é rejeitada. - Em voo: requisição concorrente com a mesma chave recebe
409+ headerRetry-After.
Parâmetros da Requisição
Dados Básicos
string
required
Descrição da assinatura (aparece na fatura)Máximo: 255 caracteres
string
required
Identificador único da assinatura no seu sistemaMáximo: 255 caracteres
string
required
Código MCC (Merchant Category Code) do seu negócioExemplo:
"5734" (Software as a Service)string
URL para receber webhooks sobre eventos da assinaturaFormato: URL válida
Oferta e Recorrência
string
UUID de uma oferta recorrente (criada em Produtos e Ofertas). Quando fornecido, a assinatura herda a régua de preços e o intervalo da oferta, e você não precisa enviar
interval. A régua congela na assinatura no momento em que ela nasce: editar a oferta depois nunca reprecifica quem já assina.string
Intervalo de cobrança (obrigatório se
offer_id não fornecido)Valores: weekly, monthly, yearlydate
Data de início da assinaturaFormato:
YYYY-MM-DDPadrão: data atualinteger
Melhor dia do mês para cobrança (1-31)Padrão: dia da criação
integer
Dias de período de teste gratuitoMínimo:
0 | Máximo: 365integer
required
Valor da próxima cobrança em centavosImportante: Para PIX Recorrente, se não especificado, será usado o valor de
payment.pix_recurring.recurring_amount ou payment.amountExemplo: 4990 = R$ 49,90Cliente
object
required
Show Dados do cliente
Show Dados do cliente
string
UUID do cliente cadastrado (ou crie um novo fornecendo os dados abaixo)
string
Nome completo (obrigatório se criando cliente)Máximo: 64 caracteres
string
Email válido (obrigatório se criando cliente)Máximo: 64 caracteres
array
object
Pagamento
object
required
Show Configurações de pagamento
Show Configurações de pagamento
integer
Valor da assinatura em centavos (obrigatório se não usar
offer_id)Exemplo: 5000 = R$ 50,00string
required
Moeda do pagamentoValor:
BRLstring
required
Método de pagamentoValores:
credit_card, pix, pix_recurring, bank_slip, google_payinteger
required
Número de parcelas (1-12)Padrão:
1object
Configurações do cartão de crédito (obrigatório se
payment_method = "credit_card")Show Dados do cartão
Show Dados do cartão
object
Configurações do boleto (obrigatório se
payment_method = "bank_slip")Show Dados do boleto
Show Dados do boleto
string
required
Data de vencimento (ISO 8601)Exemplo:
"2024-02-01T23:59:59Z"object
Configurações do PIX (obrigatório se
payment_method = "pix")Show Dados do PIX
Show Dados do PIX
string
required
Data/hora de expiração (ISO 8601)Exemplo:
"2024-01-15T18:00:00Z"object
Configurações do PIX Recorrente (obrigatório se
payment_method = "pix_recurring")Show Dados do PIX Recorrente
Show Dados do PIX Recorrente
string
required
Descrição que aparecerá na fatura recorrente do clienteMáximo: 35 caracteresExemplo:
"Assinatura Mensal - Meu App"integer
Valor recorrente em centavos (se diferente do valor inicial)Exemplo:
9990 = R$ 99,90integer
Valor mínimo aceito em centavos para pagamentos recorrentesExemplo:
5000 = R$ 50,00boolean
Se deve tentar novamente em caso de falhaPadrão:
true | Máximo de tentativas: 3object
array
Divisão do pagamento entre destinatários (opcional)
Show Configuração do split
Show Configuração do split
integer
required
ID do destinatário cadastrado
integer
required
Valor em centavos para este destinatário
string
required
Tipo do splitValores:
flat, percentageboolean
required
Se este destinatário paga taxas de processamento
boolean
required
Se este destinatário paga taxas restantes
boolean
required
Se este destinatário é responsável por chargebacks
Itens (Opcional)
array
Exemplos de Requisição
curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
-H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"description": "Assinatura Mensal Premium",
"code": "SUB_PREMIUM_001",
"mcc": "5734",
"interval": "monthly",
"best_charge_day": 10,
"trial_days": 7,
"customer": {
"id": "550e8400-e29b-41d4-a716-446655440000"
},
"payment": {
"amount": 9990,
"currency": "BRL",
"payment_method": "credit_card",
"installments": 1,
"credit_card": {
"id": "3f7d2a91-8c4e-4b6f-9a2d-5e8c1f4b7a30",
"statement_descriptor": "MINHAEMPRESA PREMIUM",
"capture": true,
"processing_model": "merchant_initiated_subscription"
}
}
}'
# A assinatura herda a régua de preços e o intervalo da oferta recorrente.
# Não envie interval nem amount: eles vêm da oferta.
curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
-H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
-d '{
"description": "Clube Órbita - Mensal",
"code": "SUB_ORBITA_001",
"mcc": "5734",
"offer_id": "b9af7796-ac98-47f2-b921-46b0415d7473",
"best_charge_day": 10,
"customer": {
"id": "550e8400-e29b-41d4-a716-446655440000"
},
"payment": {
"currency": "BRL",
"payment_method": "credit_card",
"installments": 1,
"credit_card": {
"id": "3f7d2a91-8c4e-4b6f-9a2d-5e8c1f4b7a30",
"statement_descriptor": "CLUBE ORBITA",
"capture": true,
"processing_model": "merchant_initiated_subscription"
}
}
}'
curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
-H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"description": "Assinatura Anual Básica",
"code": "SUB_BASIC_2024",
"mcc": "5734",
"interval": "yearly",
"customer": {
"name": "Maria Silva",
"email": "maria@exemplo.com.br",
"documents": [
{
"type": "cpf",
"value": "12345678901"
}
],
"phone": {
"type": "mobile",
"ddi": "55",
"ddd": "11",
"number": "987654321"
}
},
"payment": {
"amount": 99900,
"currency": "BRL",
"payment_method": "credit_card",
"installments": 1,
"credit_card": {
"id": "b96e2d54-7a3c-4f8e-91d6-4e7a2c5f8b19",
"statement_descriptor": "MEUAPP ANUAL",
"capture": true,
"processing_model": "merchant_initiated_subscription"
}
}
}'
curl -X POST https://pay.autorizou.dev/api/v1/charges/subscriptions \
-H "Authorization: Bearer 4eC39HqLyjWDarjtT1zdp7dc" \
-H "Content-Type: application/json" \
-d '{
"description": "Assinatura Mensal Premium PIX",
"code": "SUB_PIX_REC_001",
"mcc": "5734",
"interval": "monthly",
"best_charge_day": 10,
"trial_days": 0,
"next_charge_amount": 4990,
"customer": {
"id": "550e8400-e29b-41d4-a716-446655440000"
},
"payment": {
"amount": 4990,
"currency": "BRL",
"payment_method": "pix_recurring",
"installments": 1,
"pix_recurring": {
"recurring_statement": "Assinatura Premium - MeuApp",
"recurring_amount": 4990,
"min_amount": 2000,
"retry_policy": true
}
}
}'
Resposta
string
UUID único da assinatura
string
Hash único da assinatura
string
O momento da assinatura, para você decidir o acesso do cliente.Valores:
trial, pending, active, past_due, unpaid, canceled, ended, completed. Ver Ciclo de vida e estados.boolean
Libere o seu serviço por aqui.
true quando o cliente deve ter acesso. Não recalcule a partir do state.string
Intervalo de cobrança:
weekly, monthly, yearlyinteger
Valor da próxima cobrança em centavos
integer
Número de parcelas
string
Data/hora da próxima cobrança (formato:
DD/MM/YYYY HH:mm:ss)string
Data de início da assinatura
string
Data de término (se aplicável)
integer
Dias de período de teste
integer
Ciclo atual da assinatura
object
Show Dados do pagamento inicial
Show Dados do pagamento inicial
string
UUID do pagamento
string
Hash do pagamento
string
Status do pagamento
string
Método de pagamento usado
integer
Valor em centavos
integer
Número de parcelas
string
Moeda
string
Descrição
object
Dados do cartão (quando aplicável)
object
Dados do PIX (quando aplicável)
object
Dados do PIX Recorrente (quando aplicável)
object
Dados do boleto (quando aplicável)
string
Data de criação
string
Data de atualização
object
Exemplo de Resposta
201 Created
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"hash": "AUTSCC01JZX3Y5T4Q8KWVREGH2M9SR",
"status": "payment_approved",
"interval": "monthly",
"next_charge_amount": 9990,
"installments": 1,
"next_charge_at": "10/02/2024 10:00:00",
"start_at": "10/01/2024",
"end_at": null,
"trial_days": 7,
"current_cycle": 1,
"payment": {
"id": "a52c8e17-6b4d-4f9a-83e2-7d5b1c8f4a26",
"hash": "AUTPCC01JZX3Y5T4Q8KWVREGH2M9SS",
"merchant_reference": "SUB_PREMIUM_001",
"status": "authorized",
"payment_method": "credit_card",
"amount": 9990,
"installments": 1,
"currency": "BRL",
"description": "Assinatura Mensal Premium",
"metadata": null,
"credit_card": {
"id": "3f7d2a91-8c4e-4b6f-9a2d-5e8c1f4b7a30",
"holder": "MARIA SILVA",
"brand": "visa",
"first_6": "424242",
"last_4": "4242",
"exp_month": "12",
"exp_year": "30",
"statement_descriptor": "ASSINATURA PREMIUM",
"capture": true,
"three_ds": null
},
"created_at": "10/01/2024 10:00:00",
"updated_at": "10/01/2024 10:00:05"
},
"fee": {
"fixed_fee_amount": 39,
"platform_fee_percentage": 3.99,
"platform_fee_amount": 399
},
"customer": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Maria Silva",
"email": "maria@exemplo.com.br"
}
}
Códigos de Status
{
"message": "Os dados fornecidos são inválidos",
"errors": {
"payment.amount": ["O campo amount é obrigatório quando offer_id não é fornecido"],
"offer_id": ["Oferta recorrente não encontrada."],
"customer.id": ["Cliente não encontrado"],
"payment.credit_card.id": ["Cartão não encontrado ou não pertence ao cliente"]
}
}
{
"status": "payment_refused",
"payment": {
"status": "refused",
"refused_reason": "Não autorizado",
"return_code": "05"
}
}
PIX Recorrente - Como Funciona
O PIX Recorrente permite cobranças automáticas recorrentes usando o PIX como método de pagamento, sem a necessidade de cartão de crédito.Fluxo de Pagamento
-
Primeiro Pagamento (Autorização)
- Cliente escaneia QR Code e realiza o primeiro pagamento via PIX
- Esse pagamento autoriza cobranças futuras automáticas
- Um
charge_codeúnico é gerado para identificar a autorização recorrente
-
Cobranças Recorrentes Automáticas
- O sistema agenda automaticamente os pagamentos futuros
- Pagamentos são processados 2-10 dias antes da data de vencimento.
- Cliente é notificado antes de cada cobrança
-
Política de Retry (Tentativas)
- Em caso de falha, o sistema tenta novamente automaticamente
- Até 3 tentativas com intervalo de 1 dia entre cada
- Tentativas ocorrem em até 7 dias da data original
Status do Ciclo de Vida do Pagamento PIX Recorrente
Os status de pagamento do PIX Recorrente seguem um fluxo específico diferente dos outros métodos.
| Status | Descrição | Quando Ocorre |
|---|---|---|
waiting_payment | Aguardando o primeiro pagamento PIX | Após criação da assinatura, QR Code gerado |
scheduled | Pagamento agendado para processamento | 3 dias antes da data de cobrança |
processing | Pagamento sendo processado | 2 dias antes da data de cobrança |
authorized | Pagamento autorizado com sucesso | Após confirmação do pagamento |
refused | Pagamento recusado (saldo insuficiente, limite excedido, etc.) | Quando a cobrança falha |
expired | QR Code ou cobrança expirou | Após período de expiração sem pagamento |
settled | Pagamento liquidado | Após processamento final e transferência |
Transições de Status Permitidas
PIX Recorrente - Primeiro Pagamento:waiting_payment → authorized (pagamento confirmado)
waiting_payment → scheduled (para PIX recorrente, quando inicia ciclo)
waiting_payment → expired (QR code expirou)
scheduled → processing (enviado para processadora)
scheduled → authorized (cobrança aprovada)
scheduled → refused (cobrança recusada)
scheduled → error (erro no processamento)
refused → scheduled (retry automático, se retry_policy = true)
Regras Importantes
Janela de Processamento: Pagamentos PIX Recorrentes devem ser enviados entre 2 e 10 dias antes da data de vencimento.
- Valor Mínimo: Defina
min_amountpara evitar cobranças abaixo de um valor específico - Período de Trial: Pode ser usado com
trial_days > 0, mas o primeiro pagamento deve seramount = 0 - Política de Retry: Com
retry_policy = true, até 3 tentativas automáticas em caso de falha - Charge Code: Obrigatório e único por assinatura, usado para identificar a autorização recorrente
Exemplo de Resposta com PIX Recorrente
201 Created
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"hash": "SUB_pixrec123xyz",
"status": "waiting_payment",
"interval": "monthly",
"next_charge_amount": 4990,
"installments": 1,
"next_charge_at": "10/02/2024 10:00:00",
"start_at": "10/01/2024",
"trial_days": 0,
"current_cycle": 1,
"payment": {
"id": "b52e8c94-7d1a-4e6f-93b8-5a2d7e4c1f68",
"hash": "PAY_pixrec789ghi",
"merchant_reference": "SUB_PIX_REC_001",
"status": "waiting_payment",
"payment_method": "pix_recurring",
"amount": 4990,
"installments": 1,
"currency": "BRL",
"description": "Assinatura Mensal Premium PIX",
"pix_recurring": {
"qr_code": "00020126580014br.gov.bcb.pix...",
"qr_code_url": "https://api.autorizou.dev/qr/pixrec456def.png",
"charge_code": "CHG_REC_abc123xyz789",
"recurring_statement": "Assinatura Premium - MeuApp",
"expires_at": "2024-01-15T23:59:59Z"
},
"created_at": "10/01/2024 10:00:00",
"updated_at": "10/01/2024 10:00:00"
},
"customer": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "João Silva",
"email": "joao@exemplo.com.br"
}
}
Próximos Passos
Após criar uma assinatura:- Cancelar assinatura quando necessário
- Consultar pagamentos da assinatura
- Configurar webhooks para acompanhar eventos de cobrança recorrente
- Para PIX Recorrente: exibir QR Code ao cliente e aguardar primeiro pagamento
⌘I