Criar nova assinatura
Cria uma nova assinatura, que representa uma cobrança recorrente, vinculando um cliente a um plano específico.
application/json
Request Body required
Descreve os dados a serem incluídos no corpo da requisição.
customer object required
plan object required
coupon_codes string[]
Responses
- 200
- 401
- 422
- 500
Assinatura criada com sucesso
application/json
Schema
Example (from schema)
Schema
subscription object
customer object
{
"subscription": {
"id": 42,
"uuid": "8b2cad02-06f0-42be-84ac-101b23a1bb0d",
"amount": 2500,
"plan_id": 2500,
"status": "credit",
"created_at": "2017-07-21 05:20:00"
},
"customer": {
"id": 42,
"name": "Jhon Doe",
"email": "jhon@doe.com",
"cpf": "833.828.600-15",
"cnpj": "95.135.209/0001-79",
"phone": "(11) 11111-1111",
"cep": "01423-910",
"address": "Rua José Maria Lisboa",
"number": 42,
"district": "Jardim Paulista",
"city": "São Paulo",
"state": "SP",
"country": "BR"
}
}
Não autorizado
application/json
Schema
Example (from schema)
Example
Schema
message string required
{
"message": "string"
}
{
"message": "Unauthenticated"
}
Erro na validação de dados
application/json
Schema
Example (from schema)
Example
Schema
message string required
errors object
{
"message": "string",
"errors": {}
}
{
"message": "The given data was invalid.",
"errors": {
"name": "The name field is required."
}
}
Houve um erro inesperado
application/json
Schema
Example (from schema)
Example
Schema
message string required
{
"message": "string"
}
{
"message": "An unexpected error occurred"
}
POST /subscriptions
Authorization
name: Authorizationtype: apiKeyin: headerdescription: Todas as requisições que requerem autenticação devem incluir no cabeçalho `Authorization` o token de API enviado pela nossa equipe. O token deve ser fornecido no seguinte formato: ``` Authorization: Bearer <token> ```
Request
Request
curl / cURL
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
python / requests
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
go / native
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
nodejs / axios
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
ruby / Net::HTTP
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
csharp / RestSharp
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
php / cURL
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
java / OkHttp
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'
powershell / RestMethod
curl -L -X POST 'https://sandbox.payments.cefis.com.br/api/v1/subscriptions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <API_KEY_VALUE>' \
--data-raw '{
"customer": {
"id": 0
},
"plan": {
"id": 0
},
"coupon_codes": [
[
"ABC123",
"DEF456"
]
]
}'