When you connect Stripe to Facturaz, two systems can end up producing documents for the same payment: Stripe generates its own receipts and invoices, and Facturaz generates the official Veri*Factu invoice. Stripe's documents have no fiscal validity in Spain, so a customer could receive two papers and not know which one counts.
The fix takes about five minutes, and you only do it once on your own Stripe account: mark Stripe's invoices as proforma and let Facturaz issue the official ones.
1. Add a "PROFORMA" prefix to Stripe invoices
In the Stripe Dashboard, open Settings > Billing > Invoice template. In the Prefix field, type PROFORMA- and save. Stripe invoices are then numbered PROFORMA-0001, PROFORMA-0002, making it clear they are not fiscal documents.
2. Add an informational note
In the same Invoice template section, find the Footer or Memo field and add a line such as: "This document is for information only and has no fiscal validity. The official invoice is issued by Facturaz in compliance with Veri*Factu." Save your changes.
3. Turn off Stripe invoice emails
Open Settings > Billing > Emails and disable Email invoices and receipts to customers, so customers only receive the official invoice from Facturaz. If you still want Stripe to send a simple payment confirmation, leave receipts enabled and only disable invoices.
4. Hide invoices in the Customer Portal
If you use the Stripe Customer Portal, open Settings > Billing > Customer portal and turn off Invoice history visibility. Otherwise customers would still see the proforma documents there.
5. Ask for the buyer's NIF on sales over €400
A sale over €400, VAT included, needs a full invoice with the buyer's NIF (Real Decreto 1619/2012, articles 4 and 6.1.d). If the NIF is missing, Facturaz saves the sale as a draft and you add it there. To have these invoices go out on their own, ask for the NIF when your customer pays. Pick how you sell:
I sell with Stripe Checkout or Payment Links
For business buyers, switch on tax ID collection in Stripe. The buyer ticks that they are buying as a business and types their NIF or EU VAT number.
For private buyers and buyers from abroad, add a text custom field with the label NIF / NIE / Pasaporte. Facturaz recognises it by its label.
My webshop takes payments with a Stripe plugin, such as WooCommerce
Add a field called NIF / NIE / Pasaporte to your shop's checkout. Then ask your developer or the Stripe plugin's support to send it to Stripe as metadata named facturazTaxId. WooCommerce explains how in its Stripe guide.
I built my own checkout (developers)Add the buyer's tax ID to my Stripe payments so Facturaz can issue full invoices for them. Read this whole brief before changing any code. How Facturaz works Facturaz (facturaz.es) is connected to my Stripe account and turns each paid sale into a Spanish invoice. A sale over €400 (the total the buyer pays: VAT, shipping and tips included) needs a full invoice with the buyer's NIF, NIE, passport or EU VAT number (Real Decreto 1619/2012, articles 4 and 6.1.d). Without an ID, Facturaz keeps that sale as a draft until I add it by hand. A sale of €400 or less can go without one, but when the buyer gives an ID, the invoice carries it. Facturaz reads each sale from one Stripe event, depending on how it was paid: - A Checkout Session in payment mode, Payment Links included: checkout.session.completed, or checkout.session.async_payment_succeeded for delayed methods. - A Stripe invoice, subscriptions included: invoice.paid. - Any other PaymentIntent (your own form, Stripe Terminal, the Dashboard): payment_intent.succeeded. Where Facturaz finds the ID, first found wins: 1. Stripe's own tax IDs: the tax ID form in Checkout (customer_details.tax_ids), the tax IDs saved on the Customer, or the invoice's customer tax IDs. 2. A Checkout custom field with the key facturazTaxId. On a Payment Link made in the Dashboard, a text field whose label names the ID, such as "NIF / NIE / Pasaporte". 3. Metadata with the key facturazTaxId. Checkout: the session, then its PaymentIntent, then the Customer. Stripe invoice: the invoice, then the subscription, then the Checkout Session that started the subscription, then the Customer. Other PaymentIntents: the PaymentIntent, then its Customer. Where Facturaz finds the buyer's name, address and country: - Checkout: customer_details. The name is business_name, else individual_name, else name. - Stripe invoice: the invoice's customer_name and customer_address. Stripe copies them from the Customer when the invoice is finalized and never updates them after. - Other PaymentIntents: with a Customer, the Customer's name and address (the billing details are not read). Without a Customer, the charge's billing_details. A card-present payment without a Customer names nobody. What to build 1. Find every place in this codebase that takes a Stripe payment and tell me which of the cases below each one is. Change all of them. 2. Checkout Sessions with ui_mode hosted_page or embedded_page, and Payment Links created with the API: - Business buyers: tax_id_collection: { enabled: true }. Never set tax_id_collection.required: it makes every buyer in a supported country enter a business tax ID, so private buyers could not pay. - Everyone else, this custom field: custom_fields: [{ key: 'facturazTaxId', label: { type: 'custom', custom: 'NIF / NIE / Pasaporte' }, type: 'text', optional: !idRequired, }] idRequired is true when the total the buyer pays can be over €400 (40000 cents in EUR). If the total is fixed when you create the session, compare it. If the buyer can still change it on the page (adjustable quantities, promotion codes, optional items, shipping rates, Stripe Tax adding tax on top of the price), the field can't follow the final total. Ask me whether to make it required whenever the total could pass €400, or keep it optional and let those sales wait as drafts. - Checkout allows three custom fields. If a session already has three, tell me instead of removing one. - billing_address_collection: 'required', so the invoice carries the buyer's address and country. - name_collection: { individual: { enabled: true, optional: true } }, so the invoice carries the buyer's own name rather than the cardholder's. A business's legal name comes from the tax ID form. - A business that says it is buying as a business sees both the tax ID form and the custom field. Over €400 it fills both, and Stripe's tax ID is used. 3. Checkout Sessions with ui_mode elements: custom fields aren't allowed there. - Add your own text input labelled "NIF / NIE / Pasaporte", required while the session's live total is over €400. - Before the buyer confirms, send the value to your server and call checkout.sessions.update(sessionId, { metadata: { facturazTaxId: value } }). - Business buyers: tax_id_collection on the session and Stripe's Tax ID Element. Turn on name_collection.business so the element asks for the legal name. - Collect the buyer's name with name_collection.individual and checkout.updateIndividualName. 4. Your own form with the Payment Element and PaymentIntents, no Checkout Session: - Add the same input, required when the amount is over €400. - Put metadata: { facturazTaxId: value } on the PaymentIntent before it is confirmed: when you create it, or with paymentIntents.update before confirmPayment. Facturaz reads the PaymentIntent as it was when it succeeded, so metadata added later is never seen. - If the PaymentIntent has a Customer, set the Customer's name and address before the payment (customers.update). Without a Customer, pass billing_details with name and address. The Payment Element doesn't ask for a name on card payments by default: set fields.billingDetails.name to 'always' or collect it yourself. - Stripe Terminal: attach a Customer with the buyer's name and address and put the ID in the PaymentIntent's metadata. 5. Subscriptions and other Stripe invoices: - Started in Checkout: step 2 covers it. Facturaz reads the custom field of the session that started the subscription on every renewal. Base idRequired on the largest invoice it will produce, renewals included. - Created with the API, and invoices made in Stripe: put metadata: { facturazTaxId: value } on the Customer. Facturaz reads the Customer when each invoice is paid, so a change reaches the next invoices. Metadata on the subscription works too, but only for invoices finalized after it was set. - Set the Customer's name and address before the first invoice is finalized. Rules - Spell the key facturazTaxId everywhere. Facturaz also accepts other cases and separators, but keep one spelling. - Send what the buyer typed, trimmed. Only check it isn't empty: Facturaz checks the control character of Spanish NIF, NIE and CIF numbers and checks EU VAT numbers in VIES. A sale with an ID that fails waits as a draft showing what the buyer typed. - A sale with an ID needs the buyer's name, at any amount, and a passport or other foreign ID needs the buyer's country. Without them the sale waits as a draft. - An EU VAT number in the facturazTaxId field doesn't change what Stripe Tax charges. For reverse charge, the business must use Stripe's tax ID form. - Don't put metadata named source with a value starting with facturaz_ on any payment: Facturaz skips those as its own. - In another currency, the €400 limit is in euros at the ECB rate of the sale date, and Facturaz holds those sales for me to check. - The ID is personal data: don't log it or send it to analytics. Test Facturaz only reads live payments, so a test-mode payment never becomes an invoice. Test in Stripe test mode that the ID lands where Facturaz reads it: pay over €400 with a DNI (12345678Z), check the field or metadata in the event, the session, the PaymentIntent or the Customer, and check the name and country are there. Do the same with a business tax ID through Stripe's form. When you're done, list each payment path you changed and how you tested it.
Business buyers: tax_id_collection on the Checkout Session, never with required (private buyers couldn't pay). A tax ID given there always takes priority, and it's the only one that changes what Stripe Tax charges.
Everyone else: one name, facturazTaxId. In hosted or embedded Checkout, a text custom field with that key, required when the total the buyer pays can be over €400:
custom_fields: [{
key: 'facturazTaxId',
label: { type: 'custom', custom: 'NIF / NIE / Pasaporte' },
type: 'text',
optional: !idRequired,
}]Checkout in elements mode has no custom fields: send the ID from your own field as metadata on the Checkout Session (checkout.sessions.update) before the buyer pays. With the Payment Element and your own PaymentIntents, put it in the PaymentIntent's metadata before you confirm it. For a subscription created with the API, put it on the Customer. A subscription started in Checkout keeps its custom field.
metadata: { facturazTaxId: 'X1234567L' }A sale with an ID needs the buyer's name, at any amount, and a passport needs their country. Facturaz only reads live payments, so a test payment never becomes an invoice.
What Facturaz checks
A Spanish NIF, NIE or CIF must pass its check character and an EU VAT number is checked in VIES. An ID that doesn't pass never reaches an invoice: the sale waits as a draft, its notice shows what the buyer typed and you correct it there. A sale over €400 with no ID at all, such as a card reader payment, waits the same way.
The result
- Customers receive only the official Veri*Factu invoice from Facturaz.
- Stripe's documents are clearly marked PROFORMA for your own records.
- No duplicates and no confusion about which invoice is valid.
One current limitation: with Stripe invoices hidden, customers can no longer view them in the Stripe Customer Portal. This is the cleanest way to avoid duplicates today.
