E-Receipts
An e-receipt is the digital version of a ticket or sales receipt. It is a payment voucher that you can give to your customer without requesting their tax information. This voucher includes all the sales information so that it can be invoiced if the customer requests it or alternatively can be included in a global invoice at the end of the month.
By creating a digital receipt in Facturapi, your customers will have access to a website where they can fill in their tax information and download their invoice (self-invoice portal).
You can also create a global invoice at the end of the month that includes all those receipts that were not invoiced (known as global invoice).
Create a receipt
To see the descriptions of all the parameters, consult the complete reference of the method Create Receipt.
- Node.js
- C#
- PHP
- cURL
const facturapi = new Facturapi('sk_test_API_KEY');
const receipt = await facturapi.receipts.create({
folio_number: 1234,
payment_form: Facturapi.PaymentForm.DINERO_ELECTRONICO,
items: [{
quantity: 1,
product: {
description: 'Ukelele',
product_key: '60131324',
price: 345.60,
sku: 'ABC1234'
}
}]
});
var facturapi = new FacturapiClient("sk_test_API_KEY");
var receipt = await facturapi.Receipt.CreateAsync(new Dictionary<string, object>
{
["folio_number"] = 1234,
["payment_form"] = Facturapi.PaymentForm.DINERO_ELECTRONICO,
["items"] = new Dictionary<string, object>[]
{
new Dictionary<string, object>
{
["description"] = "Ukelele",
["product_key"] = "60131324",
["price"] = 345.60,
["sku"] = "ABC1234"
}
}
});
$facturapi = new Facturapi("sk_test_API_KEY");
$receipt = $facturapi->Receipts->create([
"folio_number" => 1234,
"payment_form" => "03",
"items" => [
[
"description" => "Ukelele",
"product_key" => "60131324",
"price" => 345.60,
"sku" => "ABC1234"
]
]
]);
curl https://www.facturapi.io/v1/receipts \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folio_number": 1234,
"payment_form": "03",
"items": [{
"quantity": 1,
"product": {
"description": "Ukelele",
"product_key": "60131324",
"price": 345.60,
"sku": "ABC1234"
}
}]
}'
Self-invoice portal
When you create an e-receipt, you have the option to send it via email to your customer. This email will contain a link to a self-invoice portal where your customer can fill in their tax information and download their invoice.
For more information, see the article on Self-Invoice.
Convert an e-receipt into an invoice
Por medio del método Facturar Recibo puedes convertir un e-receipt en una factura. Para ello, debes enviar los datos del cliente y otros datos que no se solicitan al crear el recibo.
- Node.js
- C#
- PHP
- cURL
const invoice = await facturapi.receipts.invoice(receipt.id, {
customer: {
legal_name: 'Roger Watters',
tax_id: 'ROWA121212A11',
email: 'roger@pinkfloyd.com'
},
folio_number: 914,
series: 'F'
});
var invoice = await facturapi.Receipt.InvoiceAsync(receipt.Id, new Dictionary<string, object>
{
["customer"] = new Dictionary<string, object>
{
["legal_name"] = "Roger Watters",
["tax_id"] = "ROWA121212A11",
["email"] = "roger@pinkfloyd.com"
},
["folio_number"] = 914,
["series"] = "F"
});
$invoice = $facturapi->Receipts->invoice($receipt->id, [
"customer" => [
"legal_name" => "Roger Watters",
"tax_id" => "ROWA121212A11",
"email" => "roger@pinkfloyd.com"
],
"folio_number" => 914,
"series" => "F"
]);
curl https://www.facturapi.io/v1/receipts/5ebd8e56f5687a013ca0df46/invoice \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"customer": {
"legal_name": "Roger Watters",
"tax_id": "ROWA121212A11",
"email": "roger@pinkfloyd.com"
},
"folio_number": 914,
"series": "F"
}'