Crear factura en Stripe, con una API

Crea una factura en borrador para un cliente. Añade las líneas con Create invoice item y envíala por email con Send invoice. Con collection_method send_invoice, envía days_until_due o due_date.

Identificador
stripe_create_invoice

La llamada

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>"
  }
}

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 to bill, starting with cus_, from Search customers or Create customer.
collection_methodstringNosend_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_dueintegerNoDays from creation until the invoice is due. Only with collection_method send_invoice.
due_dateintegerNoDue date as a Unix timestamp in seconds, instead of days_until_due. Only with collection_method send_invoice.
currencystringNoThree-letter currency code in lowercase, for example brl. The default is the currency of the customer.
descriptionstringNoMemo shown on the invoice.
footerstringNoFooter shown on the invoice.
auto_advancebooleanNotrue 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_behaviorstringNoinclude adds to the new invoice the invoice items of the customer not yet on any invoice. The default is exclude.Valores: exclude, include

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. 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.