v1

latestOpenAPI 3.1.02026-07-241040774.6 KB

Criar fatura

Este recurso cria uma fatura (invoice) de acordo com o identificador do ciclo a ser cobrado (cycle_id) de um determinada assinatura (subscription_id).

post/subscriptions/{subscription_id}/cycles/{cycle_id}/pay

Path parameters

subscription_idstring required

Código da assinatura.<br>Formato: sub_XXXXXXXXXXXXXXXX.

cycle_idstring required

Código do ciclo.<br>Formato: cycle_XXXXXXXXXXXXXXXX.

Request body

metadatastring

Objeto chave/valor utilizado para armazenar informações adicionais sobre a fatura. Saiba mais sobre metadata

Response

200

idstring
codestring
urlstring
amountinteger
statusstring
payment_methodstring
due_atstring
created_atstring

Example response

{
  "id": "in_6d2BVXnaUdT8DOkL",
  "code": "59QDSPB5NP",
  "url": "/invoices/in_6d2BVXnaUdT8DOkL",
  "amount": 1490,
  "status": "paid",
  "payment_method": "credit_card",
  "due_at": "2017-04-04T00:00:00Z",
  "created_at": "2017-04-04T15:10:35Z",
  "items": [
    {
      "name": "Nome - teste",
      "amount": 1490,
      "quantity": 1,
      "description": "Bola"
    }
  ],
  "customer": {
    "id": "cus_J4wRXJ0U6ytZrpAx",
    "name": "Tony Star8k",
    "email": "tstark@avengers.com",
    "created_at": "2016-09-28T21:04:37Z",
    "updated_at": "2017-04-04T15:08:20Z"
  },
  "subscription": {
    "id": "sub_KrmEXBxHVIRAJxDG",
    "code": "KERZFJ6TQZ",
    "start_at": "2017-04-04T00:00:00Z",
    "interval": "month",
    "interval_count": 1,
    "billing_type": "postpaid",
    "next_billing_at": "2017-05-04T00:00:00Z",
    "payment_method": "credit_card",
    "currency": "BRL",
    "statement_descriptor": "Spotify",
    "installments": 1,
    "status": "active",
    "created_at": "2017-04-04T15:10:01Z",
    "updated_at": "2017-04-04T15:10:01Z"
  },
  "cycle": {
    "id": "cycle_WE1ZYoX7uEfbRar4",
    "start_at": "2017-04-04T00:00:00Z",
    "end_at": "2017-05-03T23:59:59",
    "billing_at": "2017-05-04T00:00:00Z"
  },
  "charge": {
    "id": "ch_x75JLo9SRFnEo6jY",
    "code": "KERZFJ6TQZ-01",
    "gateway_id": "477bcafc-194b-4aa9-bb18-6fc621e49c22",
    "amount": 1490,
    "status": "paid",
    "currency": "BRL",
    "payment_method": "credit_card",
    "due_at": "2017-04-04T00:00:00Z",
    "paid_at": "2017-04-04T15:10:46Z",
    "created_at": "2017-04-04T15:10:35Z",
    "updated_at": "2017-04-04T15:10:35Z",
    "last_transaction": {
      "id": "tran_mnVqmLOfJGhzWKzW",
      "transaction_type": "credit_card",
      "funding_source": "prepaid",
      "gateway_id": "da859279-6251-4721-9909-4d8a1142f098",
      "amount": 1490,
      "status": "captured",
      "success": true,
      "installments": 1,
      "statement_descriptor": "Spotify",
      "acquirer_name": "simulator",
      "acquirer_affiliation_code": "MUNDI",
      "acquirer_tid": "704735",
      "acquirer_nsu": "999048",
      "acquirer_auth_code": "468669",
      "acquirer_message": "Simulator|Transação de simulação autorizada com sucesso",
      "acquirer_return_code": "0",
      "operation_type": "auth_and_capture",
      "credit_card": {
        "id": "card_pEYq7rDbFeiW8V6k",
        "first_six_digits": "542501",
        "last_four_digits": "8229",
        "brand": "Amex",
        "holder_name": "Tony Stark",
        "exp_month": 1,
        "exp_year": 2018,
        "status": "active",
        "created_at": "2016-11-16T17:02:39Z",
        "updated_at": "2016-12-29T12:03:24Z",
        "billing_address": {
          "line_1": "10880, Malibu Point, Malibu Central",
          "zip_code": "90265",
          "city": "Malibu",
          "state": "CA",
          "country": "US"
        }
      },
      "created_at": "2017-04-04T15:10:35Z",
      "updated_at": "2017-04-04T15:10:35Z"
    }
  }
}