Criar fatura no Stripe, por uma API

Cria uma fatura em rascunho para um cliente. Adicione as linhas com Create invoice item e envie por email com Send invoice. Com collection_method send_invoice, envie days_until_due ou due_date.

Identificador
stripe_create_invoice

A chamada

POST https://connect.reportei.com/api/tools/stripe_create_invoice/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "customer": "<customer>"
  }
}

Seu sistema envia o id da conexão do cliente e os argumentos da tool. Os headers são os mesmos de toda a API do Connect: o token do seu produto e o token do cliente.

Parâmetros

As descrições dos parâmetros seguem a documentação oficial do app, em inglês.

ParâmetroTipoObrigatórioDescrição
customerstringSimId of the customer to bill, starting with cus_, from Search customers or Create customer.
collection_methodstringNãosend_invoice emails the invoice with payment instructions; charge_automatically, the default, charges the default payment method of the customer.Valores: charge_automatically, send_invoice
days_until_dueintegerNãoDays from creation until the invoice is due. Only with collection_method send_invoice.
due_dateintegerNãoDue date as a Unix timestamp in seconds, instead of days_until_due. Only with collection_method send_invoice.
currencystringNãoThree-letter currency code in lowercase, for example brl. The default is the currency of the customer.
descriptionstringNãoMemo shown on the invoice.
footerstringNãoFooter shown on the invoice.
auto_advancebooleanNãotrue lets Stripe finalize and collect the invoice on its own, about an hour after creation. The default is false, and the invoice stays a draft until Send invoice.
pending_invoice_items_behaviorstringNãoinclude adds to the new invoice the invoice items of the customer not yet on any invoice. The default is exclude.Valores: exclude, include

Conexões possíveis

O seu cliente conecta a conta do Stripe uma vez, por um dos modos abaixo. A mesma conexão serve para todas as tools do toolkit.

Chave de API

O cliente cola a chave do app numa tela do Connect, ou o seu sistema envia a chave por POST /api/customer-toolkits, sem tela.

A resposta

Em caso de sucesso, o Connect preserva o status e o corpo da resposta do app. Erros HTTP retornados pelo app usam o envelope {error, api_error}; falhas de autenticação ou validação podem ocorrer antes da execução. O header X-Toolkit-Execution-Id identifica a execução registrada, consultável em GET /api/tools/executions/{uuid}.

Pronta para agentes de IA

O input desta tool é um JSON Schema, disponível em GET /api/tools/stripe_create_invoice. Ele vira a definição de tool do seu agente sem conversão.

Outras tools do Stripe

Ver as 12 tools

Toolkits da mesma categoria

Ver os 100 toolkits

Veja o Connect aplicado ao seu produto.

Teste por 15 dias sem cartão, ou mostre seu cenário ao nosso time.