Skip to main content
POST
/
api
/
subscriptions
Criar uma nova assinatura
curl --request POST \
  --url https://{site}.payloop.dev/api/subscriptions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "subscription": {
    "interval": 123,
    "interval_unit": "month",
    "customer_id": 123,
    "subscription_items": [
      {
        "product_id": 1,
        "quantity": 1
      }
    ]
  }
}
'
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "activate_on_payment": true,
    "activated_at": "2023-11-07T05:31:56Z",
    "balance_in_cents": 123,
    "created_at": "2023-11-07T05:31:56Z",
    "current_period_started_at": "2023-11-07T05:31:56Z",
    "current_period_ends_at": "2023-11-07T05:31:56Z",
    "interval": 123,
    "interval_unit": "month",
    "state": "created",
    "previous_state": "created",
    "prepaid": true,
    "updated_at": "2023-11-07T05:31:56Z",
    "customer": {
      "id": 123,
      "created_at": "2023-11-07T05:31:56Z",
      "updated_at": "2023-11-07T05:31:56Z",
      "email": "[email protected]",
      "first_name": "John",
      "last_name": "Doe",
      "address": "Av. Paulista, 1000",
      "address_2": "Apto 101",
      "city": "São Paulo",
      "state": "SP",
      "zip": "01310100",
      "country": "BR",
      "phone": "11999999999",
      "document_number": "63054375056 ou 41903356000112"
    },
    "items": [
      {
        "id": 123,
        "quantity": 123,
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z",
        "product": {
          "id": 123,
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "name": "Maranhão familiar",
          "description": "Plano familiar com telemedicina para você e sua família",
          "handle": "maranhao-familiar"
        },
        "price_point": {
          "id": 123,
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "name": "Mensal",
          "handle": "familiar-mensal",
          "price_int_cents": 2050
        }
      }
    ]
  },
  "errors": "<string>",
  "meta": {}
}

Authorizations

Authorization
string
header
required

Cabeçalho de autenticação no formato Bearer token.

Body

application/json

Payload da requisição para criação de uma assinatura.

subscription
object

Response

created

Objeto de retorno de criação de assinatura.

data
object

Objeto de retorno de criação de assinatura.

errors
string | null
meta
object