Iniciar assinatura
curl --request POST \
--url https://api.ephra.io/v1/subscriptions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"productId": "cmty05wl0000apyg1bx1566ej",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c",
"holderName": "MARIANA R ALVES"
},
"customer": {
"name": "Mariana Ribeiro Alves",
"email": "mariana.alves@exemplo.com.br",
"documentType": "cpf",
"document": "39053344705"
}
}
'import requests
url = "https://api.ephra.io/v1/subscriptions"
payload = {
"productId": "cmty05wl0000apyg1bx1566ej",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c",
"holderName": "MARIANA R ALVES"
},
"customer": {
"name": "Mariana Ribeiro Alves",
"email": "mariana.alves@exemplo.com.br",
"documentType": "cpf",
"document": "39053344705"
}
}
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: 'cmty05wl0000apyg1bx1566ej',
offerSlug: 'plano-mensal-premium',
card: {
cardToken: 'ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c',
holderName: 'MARIANA R ALVES'
},
customer: {
name: 'Mariana Ribeiro Alves',
email: 'mariana.alves@exemplo.com.br',
documentType: 'cpf',
document: '39053344705'
}
})
};
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' => 'cmty05wl0000apyg1bx1566ej',
'offerSlug' => 'plano-mensal-premium',
'card' => [
'cardToken' => 'ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c',
'holderName' => 'MARIANA R ALVES'
],
'customer' => [
'name' => 'Mariana Ribeiro Alves',
'email' => 'mariana.alves@exemplo.com.br',
'documentType' => 'cpf',
'document' => '39053344705'
]
]),
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\": \"cmty05wl0000apyg1bx1566ej\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c\",\n \"holderName\": \"MARIANA R ALVES\"\n },\n \"customer\": {\n \"name\": \"Mariana Ribeiro Alves\",\n \"email\": \"mariana.alves@exemplo.com.br\",\n \"documentType\": \"cpf\",\n \"document\": \"39053344705\"\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://api.ephra.io/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"cmty05wl0000apyg1bx1566ej\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c\",\n \"holderName\": \"MARIANA R ALVES\"\n },\n \"customer\": {\n \"name\": \"Mariana Ribeiro Alves\",\n \"email\": \"mariana.alves@exemplo.com.br\",\n \"documentType\": \"cpf\",\n \"document\": \"39053344705\"\n }\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\": \"cmty05wl0000apyg1bx1566ej\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c\",\n \"holderName\": \"MARIANA R ALVES\"\n },\n \"customer\": {\n \"name\": \"Mariana Ribeiro Alves\",\n \"email\": \"mariana.alves@exemplo.com.br\",\n \"documentType\": \"cpf\",\n \"document\": \"39053344705\"\n }\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": "cmty05wl0000apyg1bx1566ej",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c",
"holderName": "MARIANA R ALVES"
},
"customer": {
"name": "Mariana Ribeiro Alves",
"email": "mariana.alves@exemplo.com.br",
"documentType": "cpf",
"document": "39053344705"
}
}
'import requests
url = "https://api.ephra.io/v1/subscriptions"
payload = {
"productId": "cmty05wl0000apyg1bx1566ej",
"offerSlug": "plano-mensal-premium",
"card": {
"cardToken": "ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c",
"holderName": "MARIANA R ALVES"
},
"customer": {
"name": "Mariana Ribeiro Alves",
"email": "mariana.alves@exemplo.com.br",
"documentType": "cpf",
"document": "39053344705"
}
}
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: 'cmty05wl0000apyg1bx1566ej',
offerSlug: 'plano-mensal-premium',
card: {
cardToken: 'ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c',
holderName: 'MARIANA R ALVES'
},
customer: {
name: 'Mariana Ribeiro Alves',
email: 'mariana.alves@exemplo.com.br',
documentType: 'cpf',
document: '39053344705'
}
})
};
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' => 'cmty05wl0000apyg1bx1566ej',
'offerSlug' => 'plano-mensal-premium',
'card' => [
'cardToken' => 'ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c',
'holderName' => 'MARIANA R ALVES'
],
'customer' => [
'name' => 'Mariana Ribeiro Alves',
'email' => 'mariana.alves@exemplo.com.br',
'documentType' => 'cpf',
'document' => '39053344705'
]
]),
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\": \"cmty05wl0000apyg1bx1566ej\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c\",\n \"holderName\": \"MARIANA R ALVES\"\n },\n \"customer\": {\n \"name\": \"Mariana Ribeiro Alves\",\n \"email\": \"mariana.alves@exemplo.com.br\",\n \"documentType\": \"cpf\",\n \"document\": \"39053344705\"\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://api.ephra.io/v1/subscriptions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"cmty05wl0000apyg1bx1566ej\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c\",\n \"holderName\": \"MARIANA R ALVES\"\n },\n \"customer\": {\n \"name\": \"Mariana Ribeiro Alves\",\n \"email\": \"mariana.alves@exemplo.com.br\",\n \"documentType\": \"cpf\",\n \"document\": \"39053344705\"\n }\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\": \"cmty05wl0000apyg1bx1566ej\",\n \"offerSlug\": \"plano-mensal-premium\",\n \"card\": {\n \"cardToken\": \"ct_9f8a7b6c5d4e3f2a1b0c9d8e7f6a5b4c\",\n \"holderName\": \"MARIANA R ALVES\"\n },\n \"customer\": {\n \"name\": \"Mariana Ribeiro Alves\",\n \"email\": \"mariana.alves@exemplo.com.br\",\n \"documentType\": \"cpf\",\n \"document\": \"39053344705\"\n }\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"
}
}
}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
