Iniciar assinatura
curl --request POST \
--url https://api.ephra.io/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "prod_ABC123",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b...",
"holderName": "MARIA SILVA"
},
"customer": {
"documentType": "cpf",
"document": "12345678909",
"name": "Maria Silva",
"email": "maria@email.com",
"phone": "+5511999998888",
"billingAddress": {
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>"
}
},
"orderBumpIds": [
"<string>"
],
"couponTag": "<string>",
"postbackUrl": "<string>",
"description": "<string>"
}
'import requests
url = "https://api.ephra.io/v1/subscriptions"
payload = {
"productId": "prod_ABC123",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b...",
"holderName": "MARIA SILVA"
},
"customer": {
"documentType": "cpf",
"document": "12345678909",
"name": "Maria Silva",
"email": "maria@email.com",
"phone": "+5511999998888",
"billingAddress": {
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>"
}
},
"orderBumpIds": ["<string>"],
"couponTag": "<string>",
"postbackUrl": "<string>",
"description": "<string>"
}
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({
productId: 'prod_ABC123',
offerSlug: 'plano-mensal-premium',
card: {cardToken: 'ct_9f8a7b...', holderName: 'MARIA SILVA'},
customer: {
documentType: 'cpf',
document: '12345678909',
name: 'Maria Silva',
email: 'maria@email.com',
phone: '+5511999998888',
billingAddress: {
street: '<string>',
number: '<string>',
neighborhood: '<string>',
city: '<string>',
state: '<string>',
zipCode: '<string>'
}
},
orderBumpIds: ['<string>'],
couponTag: '<string>',
postbackUrl: '<string>',
description: '<string>'
})
};
fetch('https://api.ephra.io/v1/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://api.ephra.io/v1/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([
'productId' => 'prod_ABC123',
'offerSlug' => 'plano-mensal-premium',
'card' => [
'cardToken' => 'ct_9f8a7b...',
'holderName' => 'MARIA SILVA'
],
'customer' => [
'documentType' => 'cpf',
'document' => '12345678909',
'name' => 'Maria Silva',
'email' => 'maria@email.com',
'phone' => '+5511999998888',
'billingAddress' => [
'street' => '<string>',
'number' => '<string>',
'neighborhood' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipCode' => '<string>'
]
],
'orderBumpIds' => [
'<string>'
],
'couponTag' => '<string>',
'postbackUrl' => '<string>',
'description' => '<string>'
]),
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://api.ephra.io/v1/subscriptions"
payload := strings.NewReader("{\n \"productId\": \"prod_ABC123\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b...\",\n \"holderName\": \"MARIA SILVA\"\n },\n \"customer\": {\n \"documentType\": \"cpf\",\n \"document\": \"12345678909\",\n \"name\": \"Maria Silva\",\n \"email\": \"maria@email.com\",\n \"phone\": \"+5511999998888\",\n \"billingAddress\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\"\n }\n },\n \"orderBumpIds\": [\n \"<string>\"\n ],\n \"couponTag\": \"<string>\",\n \"postbackUrl\": \"<string>\",\n \"description\": \"<string>\"\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://api.ephra.io/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"prod_ABC123\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b...\",\n \"holderName\": \"MARIA SILVA\"\n },\n \"customer\": {\n \"documentType\": \"cpf\",\n \"document\": \"12345678909\",\n \"name\": \"Maria Silva\",\n \"email\": \"maria@email.com\",\n \"phone\": \"+5511999998888\",\n \"billingAddress\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\"\n }\n },\n \"orderBumpIds\": [\n \"<string>\"\n ],\n \"couponTag\": \"<string>\",\n \"postbackUrl\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ephra.io/v1/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 \"productId\": \"prod_ABC123\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b...\",\n \"holderName\": \"MARIA SILVA\"\n },\n \"customer\": {\n \"documentType\": \"cpf\",\n \"document\": \"12345678909\",\n \"name\": \"Maria Silva\",\n \"email\": \"maria@email.com\",\n \"phone\": \"+5511999998888\",\n \"billingAddress\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\"\n }\n },\n \"orderBumpIds\": [\n \"<string>\"\n ],\n \"couponTag\": \"<string>\",\n \"postbackUrl\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Assinatura criada com sucesso",
"data": {
"transaction": {
"id": "clx_tx_123",
"status": "paid",
"card": {
"token": "ct_...",
"brand": "visa",
"last4": "1111"
},
"fees": 349
},
"subscription": {
"id": "clx_sub_123",
"status": "active",
"nextChargeAt": "2026-08-11T12:00:00.000Z"
}
}
}Assinaturas
Iniciar assinatura
Faz a 1ª cobrança no cartão e cria a assinatura. A partir daí a recorrência é gerenciada pela Ephra. Não envie amountInCents — o valor vem da oferta/plano. A assinatura só nasce se a 1ª cobrança for aprovada; se data.subscription não vier na resposta, a cobrança foi recusada (veja data.transaction.refuseReason).
POST
/
v1
/
subscriptions
Iniciar assinatura
curl --request POST \
--url https://api.ephra.io/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "prod_ABC123",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b...",
"holderName": "MARIA SILVA"
},
"customer": {
"documentType": "cpf",
"document": "12345678909",
"name": "Maria Silva",
"email": "maria@email.com",
"phone": "+5511999998888",
"billingAddress": {
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>"
}
},
"orderBumpIds": [
"<string>"
],
"couponTag": "<string>",
"postbackUrl": "<string>",
"description": "<string>"
}
'import requests
url = "https://api.ephra.io/v1/subscriptions"
payload = {
"productId": "prod_ABC123",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b...",
"holderName": "MARIA SILVA"
},
"customer": {
"documentType": "cpf",
"document": "12345678909",
"name": "Maria Silva",
"email": "maria@email.com",
"phone": "+5511999998888",
"billingAddress": {
"street": "<string>",
"number": "<string>",
"neighborhood": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>"
}
},
"orderBumpIds": ["<string>"],
"couponTag": "<string>",
"postbackUrl": "<string>",
"description": "<string>"
}
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({
productId: 'prod_ABC123',
offerSlug: 'plano-mensal-premium',
card: {cardToken: 'ct_9f8a7b...', holderName: 'MARIA SILVA'},
customer: {
documentType: 'cpf',
document: '12345678909',
name: 'Maria Silva',
email: 'maria@email.com',
phone: '+5511999998888',
billingAddress: {
street: '<string>',
number: '<string>',
neighborhood: '<string>',
city: '<string>',
state: '<string>',
zipCode: '<string>'
}
},
orderBumpIds: ['<string>'],
couponTag: '<string>',
postbackUrl: '<string>',
description: '<string>'
})
};
fetch('https://api.ephra.io/v1/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://api.ephra.io/v1/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([
'productId' => 'prod_ABC123',
'offerSlug' => 'plano-mensal-premium',
'card' => [
'cardToken' => 'ct_9f8a7b...',
'holderName' => 'MARIA SILVA'
],
'customer' => [
'documentType' => 'cpf',
'document' => '12345678909',
'name' => 'Maria Silva',
'email' => 'maria@email.com',
'phone' => '+5511999998888',
'billingAddress' => [
'street' => '<string>',
'number' => '<string>',
'neighborhood' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zipCode' => '<string>'
]
],
'orderBumpIds' => [
'<string>'
],
'couponTag' => '<string>',
'postbackUrl' => '<string>',
'description' => '<string>'
]),
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://api.ephra.io/v1/subscriptions"
payload := strings.NewReader("{\n \"productId\": \"prod_ABC123\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b...\",\n \"holderName\": \"MARIA SILVA\"\n },\n \"customer\": {\n \"documentType\": \"cpf\",\n \"document\": \"12345678909\",\n \"name\": \"Maria Silva\",\n \"email\": \"maria@email.com\",\n \"phone\": \"+5511999998888\",\n \"billingAddress\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\"\n }\n },\n \"orderBumpIds\": [\n \"<string>\"\n ],\n \"couponTag\": \"<string>\",\n \"postbackUrl\": \"<string>\",\n \"description\": \"<string>\"\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://api.ephra.io/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"prod_ABC123\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b...\",\n \"holderName\": \"MARIA SILVA\"\n },\n \"customer\": {\n \"documentType\": \"cpf\",\n \"document\": \"12345678909\",\n \"name\": \"Maria Silva\",\n \"email\": \"maria@email.com\",\n \"phone\": \"+5511999998888\",\n \"billingAddress\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\"\n }\n },\n \"orderBumpIds\": [\n \"<string>\"\n ],\n \"couponTag\": \"<string>\",\n \"postbackUrl\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ephra.io/v1/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 \"productId\": \"prod_ABC123\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b...\",\n \"holderName\": \"MARIA SILVA\"\n },\n \"customer\": {\n \"documentType\": \"cpf\",\n \"document\": \"12345678909\",\n \"name\": \"Maria Silva\",\n \"email\": \"maria@email.com\",\n \"phone\": \"+5511999998888\",\n \"billingAddress\": {\n \"street\": \"<string>\",\n \"number\": \"<string>\",\n \"neighborhood\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zipCode\": \"<string>\"\n }\n },\n \"orderBumpIds\": [\n \"<string>\"\n ],\n \"couponTag\": \"<string>\",\n \"postbackUrl\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"message": "Assinatura criada com sucesso",
"data": {
"transaction": {
"id": "clx_tx_123",
"status": "paid",
"card": {
"token": "ct_...",
"brand": "visa",
"last4": "1111"
},
"fees": 349
},
"subscription": {
"id": "clx_sub_123",
"status": "active",
"nextChargeAt": "2026-08-11T12:00:00.000Z"
}
}
}Faz a 1ª cobrança no cartão e cria a assinatura. A partir daí a recorrência é gerenciada pela Ephra — você não guarda o cartão nem agenda cobranças.
Não envie
amountInCents: o valor vem da oferta/plano. A assinatura só nasce se a 1ª cobrança for aprovada — se data.subscription não vier na resposta, a cobrança foi recusada (veja data.transaction.refuseReason).Envie o header
Idempotency-Key (UUID) para evitar cobrança duplicada em retries.Pré-requisitos, ciclo de vida e status em Guias › Assinaturas. O
cardToken (ct_...) vem de Tokenizar cartão.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Evita cobrança duplicada em retries.
Body
application/json
ID do produto de assinatura
Example:
"prod_ABC123"
Slug do plano (oferta de assinatura)
Example:
"plano-mensal-premium"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
IDs de order bumps da 1ª compra
Cupom de desconto
Recebe o postback desta transação
Descrição livre
⌘I
