Crear línea de factura en Stripe, con una API

Añade una línea a una factura en borrador, con descripción e importe en la unidad más pequeña de la moneda, como centavos. Envía amount, o unit_amount_decimal con quantity. Sin invoice, la línea espera a la próxima factura del cliente.

Identificador
stripe_create_invoice_item

La llamada

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

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

Tu sistema envía el id de la conexión de tu cliente y los argumentos de la tool. Los headers son los mismos de toda la API de Connect: el token de tu producto y el token de tu cliente.

Parámetros

Las descripciones de los parámetros siguen la documentación oficial de la app, en inglés.

ParámetroTipoObligatorioDescripción
customerstringSíId of the customer billed, starting with cus_, the same as the invoice, from Search customers or Create customer.
invoicestringNoId of the draft invoice, starting with in_, from Create invoice or Search invoices.
descriptionstringNoText of the line, shown on the invoice.
amountintegerNoTotal of the line in the smallest unit of the currency, for example 15000 for BRL 150.00. A negative amount lowers the invoice total.
unit_amount_decimalstringNoPrice of one unit in the smallest unit of the currency, as a decimal string like 1500.5, multiplied by quantity. Use it instead of amount.
quantityintegerNoNumber of units, with unit_amount_decimal. The default is 1.
currencystringNoThree-letter currency code in lowercase, for example brl. It must match the currency of the invoice.

Conexiones posibles

Tu cliente conecta su cuenta de Stripe una sola vez, con uno de los modos de abajo. La misma conexión sirve para todas las tools del toolkit.

Clave de API

Tu cliente pega la clave de la app en una pantalla de Connect, o tu sistema envía la clave con POST /api/customer-toolkits, sin pantalla.

La respuesta

Si la llamada tiene éxito, Connect conserva el status y el cuerpo de la respuesta de la app. Los errores HTTP devueltos por la app usan el objeto {error, api_error}; la autenticación o validación pueden fallar antes de la ejecución. El header X-Toolkit-Execution-Id identifica la ejecución registrada, disponible en GET /api/tools/executions/{uuid}.

Lista para agentes de IA

El input de esta tool es un JSON Schema, disponible en GET /api/tools/stripe_create_invoice_item. Se convierte en la definición de tool de tu agente sin conversión.

Otras tools de Stripe

Ver las 12 tools

Toolkits de la misma categoría

Ver los 100 toolkits

Mira Connect aplicado a tu producto.

Pruébalo durante 15 días sin tarjeta, o cuéntale tu caso a nuestro equipo.