Assinaturas

Planos

get
Listar planos

https://api.dooki.com.br/v2/public/billing/plans
Request
Response
200: OK
{
"data": [
{
"id": 13,
"name": "Starter",
"amount": 123123,
"transaction_fee": 1123.12,
"trial_days": 7,
"features": [
[
"Foo"
]
]
},
{
"id": 14,
"name": "Pro",
"amount": 123123,
"transaction_fee": 1123.12,
"trial_days": 7,
"features": [
[
"Foo"
]
]
},
{
"id": 15,
"name": "Enterprise",
"amount": 123123,
"transaction_fee": 1123.12,
"trial_days": 7,
"features": [
[
"Foo"
],
[
"Bar"
]
]
}
],
}

get
Listar cartões

https://api.dooki.com.br/v2/:alias/billing/cards
Listagem de todos os cartões do usuário logado.
Request
Response
Headers
Authorization
required
string
Token de autenticação
200: OK
{
"data": [
{
"id": 123,
"user_id": 123,
"default": true,
"holder_name": "John Snow",
"brand": "visa",
"truncated_number": "4012********1112",
"month": "06",
"year": "2020",
"icon_url": "https://github.bubbstore.com/svg/visa.svg",
"created_at": {
"date": "2019-10-18 09:14:29",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"updated_at": {
"date": "2019-10-18 09:14:29",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
}
}
]
}

post
Novo cartão

https://api.dooki.com.br/v2/:alias/billing/cards
Cadastro de um novo cartão de crédito. Importante: não é possível cadastrar o mesmo cartão duas vezes.
Request
Response
Headers
Authorization
required
string
Token de autenticação
Body Parameters
year
required
number
Ano de vencimento
month
required
number
Mês de vencimento
cvv
required
number
Código de segurança do cartão
number
required
number
Número do cartão
holder_name
required
string
Nome do titular do cartão
default
required
boolean
Marca se o cartão é padrão
200: OK
Cake successfully retrieved.
{
"name": "Cake's name",
"recipe": "Cake's recipe name",
"cake": "Binary cake"
}

Assinaturas

get
Listar assinatura

https://api.dooki.com.br/v2/:alias/billing/subscriptions
Includes disponíveis: card, plan, user
Request
Response
Headers
Authorization
required
string
Token de autenticação
200: OK

post
Nova assinatura

https://api.dooki.com.br/v2/:alias/billing/subscriptions
Importante: só é possível uma assinatura por loja.
Request
Response
Headers
Authorization
required
string
Token de autenticação
Body Parameters
plan_id
required
number
ID do plano
user_card_id
required
number
ID do cartão do usuário
200: OK
Cake successfully retrieved.
{
"id": 123,
"user_id": 123,
"plan_id": 123,
"user_card_id": 123,
"amount": 14700,
"transaction_fee": 2.5,
"next_charge_day": {
"date": "2019-10-25 00:00:00",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"next_revenue_charge_day": {
"date": "2019-10-21 00:00:00",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"status": "trial",
"trial_ends_at": {
"date": "2019-10-25 00:00:00",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"cancelled_at": null,
"created_at": {
"date": "2019-10-18 09:22:06",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"updated_at": {
"date": "2019-10-18 09:22:06.000000",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"card": {
"data": {
"id": 123,
"user_id": 123,
"default": true,
"holder_name": "John Snow",
"brand": "visa",
"truncated_number": "4012********1112",
"month": 6,
"year": 2020,
"icon_url": "https://github.bubbstore.com/svg/visa.svg",
"created_at": {
"date": "2019-10-18 09:14:29",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"updated_at": {
"date": "2019-10-18 09:14:29",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
}
}
},
"plan": {
"data": {
"id": 123,
"name": "Starter",
"amount": 14700,
"transaction_fee": "2.50",
"trial_days": 7
}
}
}

get
Pré-cancelar uma assinatura

https://api.dooki.com.br/v2/:alias/billing/subscriptions/:id/cancel
Request
Response
200: OK

put
Cancelar uma assinatura

https://api.dooki.com.br/v2/:alias/billing/subscriptions/:id/cancel
Request
Response
200: OK

put
Reativar uma assinatura

https://api.dooki.com.br/v2/:alias/billing/subscriptions/:id/reactivate
Request
Response
200: OK

get
Listar cobranças

https://api.dooki.com.br/v2/:alias/billing/charges
Includes disponíveis: subscription, plan
Request
Response
Path Parameters
optional
string
200: OK
{
"data": [
{
"id": 123,
"subscription_id": 123,
"description": "Assinatura Plano Starter",
"type": "revenue",
"amount": 4842,
"status": "paid",
"start_at": {
"date": "2019-10-01 00:00:00",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"end_at": {
"date": "2019-10-13 00:00:00",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"created_at": {
"date": "2019-10-15 08:19:57",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"updated_at": {
"date": "2019-10-17 14:01:48",
"timezone_type": 3,
"timezone": "America/Sao_Paulo"
},
"subscription": {
// Objeto subscription
},
"plan": {
// Objeto plan
}
}
]
}