Revisá recibos, creá ajustes, actualizá estados pendientes, enviá emails y generá links al PDF.
Usá Invoices como vista contable de lo que el customer debe o pagó. Usá Transactions para revisar cada intento de pago que buscó saldar un recibo.
import { Commet } from "@commet/node";const commet = new Commet({ apiKey: "ck_xxx" });const response = await commet.invoices.list();from commet import Commetcommet = Commet("ck_xxx")invoices_list_result = commet.invoices.list()client, err := commet.New("ck_xxx")if err != nil { log.Fatal(err)}ctx := context.Background()invoicesListResult, err := client.Invoices.List(ctx, nil)if err != nil { log.Fatal(err)}import co.commet.Commet;import co.commet.params.ListInvoicesParams;var commet = Commet.builder().apiKey("ck_xxx").build();var invoicesListResult = commet.invoices().list(ListInvoicesParams.builder().build());use Commet\Commet;$commet = new Commet('ck_xxx');$invoicesListResult = $commet->invoices->list();Abrí un recibo en el dashboard para ver line items, impuestos, contexto de la suscripción, intentos de pago y datos del customer.
import { Commet } from "@commet/node";const commet = new Commet({ apiKey: "ck_xxx" });const invoice = await commet.invoices.createAdjustment({ customerId: "user_123", amount: 5000, description: "Customer requested",});from commet import Commetcommet = Commet("ck_xxx")invoice = commet.invoices.create_adjustment( customer_id="user_123", amount=5000, description="Customer requested",)client, err := commet.New("ck_xxx")if err != nil { log.Fatal(err)}ctx := context.Background()invoice, err := client.Invoices.CreateAdjustment(ctx, &commet.CreateAdjustmentInvoiceParams{ CustomerID: "user_123", Amount: 5000, Description: "Customer requested",})if err != nil { log.Fatal(err)}import co.commet.Commet;import co.commet.params.CreateAdjustmentInvoiceParams;var commet = Commet.builder().apiKey("ck_xxx").build();var invoice = commet.invoices().createAdjustment( CreateAdjustmentInvoiceParams.builder("user_123", 5000L, "Customer requested").build());use Commet\Commet;$commet = new Commet('ck_xxx');$invoice = $commet->invoices->createAdjustment( customerId: 'user_123', amount: 5000, description: 'Customer requested',);Usá un monto positivo para un cargo adicional y uno negativo para un crédito. Es un documento contable puntual; no cambia el plan ni las próximas renovaciones.
import { Commet } from "@commet/node";const commet = new Commet({ apiKey: "ck_xxx" });const invoice = await commet.invoices.updateStatus({ id: "inv_xxx", status: "paid",});from commet import Commetcommet = Commet("ck_xxx")invoice = commet.invoices.update_status( "inv_xxx", status="paid",)client, err := commet.New("ck_xxx")if err != nil { log.Fatal(err)}ctx := context.Background()invoice, err := client.Invoices.UpdateStatus(ctx, "inv_xxx", &commet.UpdateInvoiceStatusParams{ Status: "paid",})if err != nil { log.Fatal(err)}import co.commet.Commet;import co.commet.params.UpdateInvoiceStatusParams;var commet = Commet.builder().apiKey("ck_xxx").build();var invoice = commet.invoices().updateStatus( "inv_xxx", UpdateInvoiceStatusParams.builder("paid").build());use Commet\Commet;$commet = new Commet('ck_xxx');$invoice = $commet->invoices->updateStatus( id: 'inv_xxx', status: 'paid',);Solo un recibo pendiente puede marcarse como paid o void. Esto registra un pago externo o un write-off deliberado; no crea una transacción en el proveedor.
import { Commet } from "@commet/node";const commet = new Commet({ apiKey: "ck_xxx" });const sentInvoice = await commet.invoices.send({ id: "inv_xxx" });from commet import Commetcommet = Commet("ck_xxx")sent_invoice = commet.invoices.send("inv_xxx")client, err := commet.New("ck_xxx")if err != nil { log.Fatal(err)}ctx := context.Background()sentInvoice, err := client.Invoices.Send(ctx, "inv_xxx", nil)if err != nil { log.Fatal(err)}import co.commet.Commet;import co.commet.params.SendInvoiceParams;var commet = Commet.builder().apiKey("ck_xxx").build();var sentInvoice = commet.invoices().send("inv_xxx", SendInvoiceParams.builder().build());use Commet\Commet;$commet = new Commet('ck_xxx');$sentInvoice = $commet->invoices->send(id: 'inv_xxx');import { Commet } from "@commet/node";const commet = new Commet({ apiKey: "ck_xxx" });const invoiceDownload = await commet.invoices.getDownloadUrl({ id: "inv_xxx" });from commet import Commetcommet = Commet("ck_xxx")invoice_download = commet.invoices.get_download_url("inv_xxx")client, err := commet.New("ck_xxx")if err != nil { log.Fatal(err)}ctx := context.Background()invoiceDownload, err := client.Invoices.GetDownloadURL(ctx, "inv_xxx", nil)if err != nil { log.Fatal(err)}import co.commet.Commet;import co.commet.params.DownloadInvoiceParams;var commet = Commet.builder().apiKey("ck_xxx").build();var invoiceDownload = commet.invoices().getDownloadUrl( "inv_xxx", DownloadInvoiceParams.builder().build());use Commet\Commet;$commet = new Commet('ck_xxx');$invoiceDownload = $commet->invoices->getDownloadUrl(id: 'inv_xxx');El link al PDF está firmado y vence a los siete días. Generalo cuando el customer solicite el documento en lugar de guardar una URL pública permanente.
Para entender renovaciones automáticas y timing de overage, leé Recibos y ciclos de billing.
¿Cómo está esta guía?