English
API ReferenceSign In

Create an Invoice

Last updated 06/03/2021

Setting Up Your Invoice

Before you create an invoice, make sure you have setup your invoices according to your needs:

  1. Setup your business logo; Make sure you have uploaded your business logo that will be used in your invoice. You can upload your business logo by going to Settings > Your Business and Profile > Your business.
  2. Activate your payment channel on your invoice; Make sure your active payment channels are selected as payment methods in the invoice before you create any invoice. You can change your desired payment methods by going to Settings > Accepting Money > Invoices > Customize Invoice. Click "Payment Method" and tick all your desired payment methods.
  3. Finalize your invoice setting; Make sure your invoice setting has been adjusted to your needs. Go to Settings > Accepting Money > Invoices > Customize Invoice and click "Customize Appearance" and "Invoice Settings" to change your invoice's appearance and rules.

For more information about how you can customize your invoice setting, please go to Customize Your Invoice page.

Create an Invoice

You can create invoice via Xendit Dashboard or API depending on what might suit your business needs. Below are the the overview you may want to consider when choosing between the two options

Invoice Creation PlatformBenefitsTrade-offs
Dashboard- Doesnt require technical integration

- Create invoice anywhere and anytime as long as you have access to Xendit dashboard

- Step-by-step invoice creation is easy to understand
Invoice creation is done manually (can't be automated)
API- Invoice creation is automated via API

- Create invoice within seconds

- User Interface can be customized based on your business needs
Requires developer resources for technical integration

Create Invoice via Dashboard

To create an invoice via dashboard, you Account User should have at least EDIT permission. Follow these steps to create an invoice via Xendit dashboard:

  1. Login to your Xendit dashboard
  2. Go to Accept Payments > Invoices
  3. Click "Create" to create an invoice and use the information below as your guide
FieldWhat to Fill
External IDUnique identifier of an invoice in your system. There are no character restrictions for External ID. Create your identifier as you like
Sample: HOUSE.AP/INV/XXV/341293TPR0004XJEDBDIEFDJIAGDY
EmailEmail address of your customer (the one you want to bill). You can choose whether Xendit sends an invoice created, paid, and expired email to your customer by clicking the “send invoice to this email” checkbox
AmountThe total amount your customer will pay for the specific invoice (can be in IDR, PHP or USD)
Invoice DueThe time you want the invoice to expire. Click on the calendar icon to select the invoice expiry date. Click on the clock icon to set the invoice expiry time within the date you specified
Invoice ReminderThe time you want Xendit to email your customer to remind them to pay the invoice. Select "Do not send a reminder" to not send a reminder, or select from one of the dropdown reminder options (from one hour before the invoice expires to 30 days before the invoice expires) to send a reminder
DescriptionShort description for your end customer to read. You can use this free field to type notes or describe the purpose of the invoice
Sample: June 2021 electricity bill payment for Apartment Unit #1A

Create Invoice via API

Follow these steps to create an invoice via API:

  1. Follow the instruction in Xendit API Reference on Create Invoice section to start creating your invoice via API
  2. Setup your Invoice Callback URL in Xendit Dashboard for "Invoices Paid"

Example of Create Invoice via API

<?php

  use Xendit\Xendit;
  require 'vendor/autoload.php';

  Xendit::setApiKey('xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==');

  $params = [ 
    'external_id' => 'demo_1475801962607',
    'payer_email' => 'alfina@xendit.co',
    'description' => 'Trip to Bali',
    'amount' => 50000
  ];

  $createInvoice = \Xendit\Invoice::create($params);
  var_dump($createInvoice);

?>
const x = new require('xendit-node')({ secretKey: 'xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==' });

const { Invoice } = x;
const invoiceSpecificOptions = {};
const i = new Invoice(invoiceSpecificOptions);

const resp = await i.createInvoice({
  externalID: 'demo_1475801962607',
  amount: 230000,
  payerEmail: 'sample_email@xendit.co',
  description: 'Trip to Bali',
});
console.log(resp);
Xendit.apiKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw==";
try {
  Map<String, Object> params = new HashMap<>();
  params.put("external_id", "demo_1475801962607");
  params.put("amount", 50000);
  params.put("payer_email", "customer@domain.com");
  params.put("description", "Trip to Bali");

  Invoice invoice = Invoice.create(params);
} catch (XenditException e) {
  e.printStackTrace();
}
xendit.Opt.SecretKey = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="

data := invoice.CreateParams{
  ExternalID:  "demo_1475801962607",
  Amount:      50000,
  PayerEmail:  "alfina@xendit.co",
  Description: "Trip to Bali",
}

resp, err := invoice.Create(&data)
if err != nil {
  log.Fatal(err)
}

fmt.Printf("created invoice: %+v\n", resp)
from xendit import Xendit

api_key = "xnd_development_P4qDfOss0OCpl8RtKrROHjaQYNCk9dN5lSfk+R1l9Wbe+rSiCwZ3jw=="
xendit_instance = Xendit(api_key=api_key)
Invoice = xendit_instance.Invoice

invoice = Invoice.create(
    external_id="invoice-1593684000",
    amount=20000,
    payer_email="customer@domain.com",
    description="Invoice Demo #123",
)
print(invoice)

For more sample codes and library, visit our Demo Store or simply go to this library.

Testing Invoice Payment

Test Xendit integrations by simulating payments to your invoice! This simulation will result in your invoice status showing up as Paid/Settled in your Dashboard. We also initiate a callback to your Callback URL. Please remember that all of these simulations should only be done in Test Mode.

Test Invoice Payment via Invoice UI

Test invoice payment via Invoice UI by following these simple steps:

  1. Create an invoice
  2. Open the Invoice URL link
  3. Choose your desired payment channel
  4. Click the “Click here to simulate your payment with [your payment channel]” button at the red banner above the invoice UI
  5. Invoice is successfully Paid/Settled

Test Invoice Payment via Amount

Test invoice payment via amount by following these simple steps:

  1. Create an invoice with the amount of IDR 3,000,000
  2. Go to your Invoice Tab in Xendit dashboard
  3. Invoice is successfully Paid/Settled

Test Invoice Payment via Cards

Test invoice payment via Cards payment by following these simple steps:

  1. Create an invoice with Credit Card chosen as one of the payment method
  2. Open the invoice URL link
  3. Choose Credit / Debit Card in the payment method
  4. Fill the card number with 4000 0000 0000 0002, any CVV and future expiry date (to test cards installments on invoice, please see the test card numbers here)
  5. Input "1234" in the 3DS authorization page
  6. Invoice is successfully Paid/Settled

Invoice Statuses

To enhance your experience, Xendit Invoice has its own status that will help you to easily identify which invoice is already paid, not paid, or can't be paid anymore. These are the possible statuses Invoices can have:

StatusDescription
UnpaidInvoice has been successfully created and can be paid by your customer until the expiry date you have set
PaidInvoice has been successfully paid by your customer

You can also get paid email notifications by activating paid email notifications on Settings > Invoices > Customize Invoice
SettledThe funds have settled to your Xendit account and can be withdrawn from your balance tab

Please note that not all invoices reach settled status (eg. BCA Switcher) and not all will be settled at the same time. Settlement time depends on the payment method and channel used by your customer to pay for the invoice
ExpiredInvoice has expired before your customer was able to pay for it. Invoice can no longer be paid or reactivated to be active

You can customize invoice expiration for all invoices at Settings > Invoices > Customize Invoice, or set duration per invoice at invoice creation
ActiveFor recurring and on-demand invoices to continue being sent to your customer to pay in the interval and duration you had specified
StoppedRecurring and on-demand invoices that will no longer be able to be recreated or sent to your customer