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.
Optionally, you can associate a customer to the receipt by sending the customer field
(either the ID of an existing customer or the customer object to create it).
- Node.js
- C#
- Java
- 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"
}
}
});
import io.facturapi.Facturapi;
import java.util.List;
import java.util.Map;
Facturapi facturapi = new Facturapi("sk_test_API_KEY");
var receipt = facturapi.receipts().create(Map.of(
"folio_number", 1234,
"payment_form", "03",
"items", List.of(Map.of(
"quantity", 1,
"product", Map.of(
"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/v2/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"
}
}]
}'
Receipt customer
A receipt can exist without an assigned customer. This state means the invoicing destination is not decided yet.
You can associate a customer when calling
Create Receipt, by sending the
customer field, or later with
Assign or reassign customer to receipt.
In both cases, you can send the ID of an existing customer or a customer object to create one.
curl https://www.facturapi.io/v2/receipts/58e93bd8e86eb318b019743d \
-H "Authorization: Bearer sk_test_API_KEY" \
-H "Content-Type: application/json" \
-X PUT \
-d '{
"customer": "58e93bd8e86eb318b0197456"
}'
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.
Ways to invoice receipts
Open receipts can be invoiced to a specific customer or included in a global invoice
to PUBLICO EN GENERAL.
- Convert e-receipt to invoice creates
an invoice for a single receipt. If you send
customer, that customer is used as the invoice recipient and overrides the customer previously assigned to the receipt. If you omitcustomer, the receipt must already have an assigned customer. - Create invoice from multiple receipts
creates an invoice for several receipts selected by
key. If you sendcustomer, that customer is used for every included receipt. If you omitcustomer, all receipts must already have the same assigned customer; if they have different customers or any receipt has no customer, the operation fails. - PDF preview for multiple receipts invoice
and
dry_runvalidate the same customer rules as real invoice creation, but do not persist changes. - Global invoice also groups
multiple receipts, but always invoices them to the generic
PUBLICO EN GENERALcustomer. Included receipts are associated with that customer and theirstatuschanges to"invoiced_globally".
Convert an e-receipt into an invoice
With Convert e-receipt to invoice
you can convert an e-receipt into an invoice for a specific customer. If the receipt
already has an assigned customer, you can omit customer; if you send customer, that
customer becomes the invoice recipient.
- 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/v2/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"
}'
Convert multiple receipts into one invoice
Create invoice from multiple receipts
creates a single invoice from open receipts selected by key.
You can also send dry_run: true to validate the operation and get a summary without
creating the invoice, or use the PDF preview.