Stripe metadata for e-invoices: PO number, buyer reference, Leitweg-ID and Peppol ID
By evoicely · Last checked 20 October 2026
Stripe has no fields for the buyer's references that an EN 16931 e-invoice carries: the buyer reference (BT-10, where a Leitweg-ID goes), the purchase order number (BT-13), the contract (BT-12), project (BT-11) and accounting references (BT-19), or the buyer's Peppol ID (BT-49).
Keep them in metadata, which your converter reads, and add them to custom_fields as well if they should appear on Stripe's PDF.
Put a value on the most specific object it belongs to: a PO number on the invoice, a Leitweg-ID or Peppol ID on the Customer. Stripe doesn't copy metadata from the Customer to its invoices, so whatever reads it has to look in each place.
This page lists the terms, their UBL and CII paths, Stripe's limits, and XML that passes the official validators.
The business terms Stripe doesn't have
EN 16931 defines these optional references to the buyer's own documents and systems. None of them has a counterpart on Stripe's Invoice or Customer object (Invoice object, Customer object). Whether you need one depends on your buyer and the format:
| Term | What it is | When you need it |
|---|---|---|
| BT-10 Buyer reference | A reference the buyer gives you to route the invoice internally. For German public buyers, the Leitweg-ID. | Mandatory in XRechnung (rule BR-DE-15). In Peppol BIS, BT-10 or BT-13 must be present (PEPPOL-EN16931-R003). |
| BT-13 Purchase order reference | The buyer's PO number. | When the buyer issued a PO. Many accounts-payable teams match invoices to POs and reject invoices without one. |
| BT-12 Contract reference | The contract the invoice is billed under. | When the buyer asks for it, typical for framework agreements. |
| BT-11 Project reference | The buyer's project the invoice belongs to. | When the buyer asks for it. |
| BT-17 Tender or lot reference | The call for tenders or lot the contract came from. | Public procurement, when the buyer asks for it. |
| BT-19 Buyer accounting reference | The buyer's cost centre or account to book the invoice to. | When the buyer asks for it. BT-133 is the same per line. |
| BT-132 Referenced purchase order line | The line of the PO an invoice line refers to. | Rare for subscriptions; needs BT-13. |
| BT-46 / BT-47 Buyer identifier / legal registration identifier | For example a GLN, or a company register number. | When the buyer asks for it. BT-47 can stand in for the VAT ID under reverse charge (BR-AE-02). |
| BT-49 Buyer electronic address | Where the invoice is delivered electronically: a Peppol participant ID, or an email address where the format allows one. | Mandatory in Peppol BIS and XRechnung 3.0; both rule sets report PEPPOL-EN16931-R010 when it's missing. Stripe's customer_email works only where the email scheme EM is allowed, which Peppol doesn't. |
The rule IDs are from the official rule sets: KoSIT XRechnung schematron and Peppol BIS Billing 3.0 rules. For what BT and BR codes are, see What is EN 16931?.
Where they go in UBL and CII
XRechnung (UBL) and Peppol BIS use UBL; ZUGFeRD, Factur-X and XRechnung (CII) use CII. In CII, all of these except BT-19 sit in ram:ApplicableHeaderTradeAgreement, the header agreement; BT-19 sits in the header settlement, ram:ApplicableHeaderTradeSettlement.
UBL paths are relative to Invoice
(Peppol UBL syntax reference, XRechnung 3.0.2 specification).
| Term | UBL and CII |
|---|---|
| BT-10 | UBL: cbc:BuyerReferenceCII: ram:BuyerReference |
| BT-13 | UBL: cac:OrderReference/CII: ram:BuyerOrderReferencedDocument/ |
| BT-12 | UBL: cac:ContractDocumentReference/CII: ram:ContractReferencedDocument/ |
| BT-11 | UBL: cac:ProjectReference/CII: ram:SpecifiedProcuringProject/ (the schema also needs a ram:Name) |
| BT-17 | UBL: cac:OriginatorDocumentReference/CII: ram:AdditionalReferencedDocument with ram:TypeCode 50 |
| BT-19 | UBL: cbc:AccountingCostCII: ram:ReceivableSpecifiedTradeAccountingAccount/ |
| BT-132 | UBL: cac:InvoiceLine/CII: Line ram:SpecifiedLineTradeAgreement/ |
| BT-133 | UBL: cac:InvoiceLine/CII: Line ram:SpecifiedLineTradeSettlement/ |
| BT-46 | UBL: Buyer cac:PartyIdentification/CII: ram:BuyerTradeParty/, or ram:GlobalID with a scheme |
| BT-47 | UBL: Buyer cac:PartyLegalEntity/CII: ram:BuyerTradeParty/ |
| BT-49 | UBL: cac:AccountingCustomerParty/ with schemeIDCII: ram:BuyerTradeParty/ with schemeID |
Two UBL details. Element order is fixed by the schema: cbc:AccountingCost comes before cbc:BuyerReference, and the document references follow the invoice period in the order of the table above. A validator rejects the file otherwise.
And cac:OrderReference/cbc:ID is mandatory inside cac:OrderReference: if you only have your own sales order number (BT-14, cbc:SalesOrderID), Peppol says to put NA in the ID
(Peppol: cac:OrderReference).
Where Stripe can hold them
Metadata
Most Stripe objects take metadata: up to 50 key-value pairs, keys up to 40 characters (no square brackets), values up to 500 characters. Customers don't see it unless you show it to them, and it's only returned to requests made with a secret key
(Stripe: metadata). For e-invoices, three objects matter:
- Invoice
metadata: for what belongs to one invoice, such as a PO number. It can still be changed after the invoice is finalized, but set it before then, so it's there when the invoice is converted. - Subscription
metadata: for what holds for a whole subscription, such as a PO or contract that covers a year of renewals. - Customer
metadata: for what belongs to the buyer, such as their Peppol ID or a Leitweg-ID that never changes.
Stripe doesn't copy metadata between objects, with a few exceptions. The ones that matter here:
- Customer → invoice: not copied. Metadata on the Customer never appears on its invoices. To read it, expand
customerwhen you fetch the invoice. - Subscription → invoice: a snapshot, in its own place. When a subscription creates an invoice, its metadata is copied to
parent., not to the invoice's ownsubscription_details. metadata metadata. It's an immutable snapshot (Stripe's reference dates it at finalization), so changing the subscription's metadata later doesn't change issued invoices. Theparentfield arrived with API version 2025-03-31; older versions return the same snapshot assubscription_details.metadataat the top level. It's populated for invoices created since 29 June 2023. - Payment Link → Checkout Session: a snapshot. A Payment Link's
metadatais copied to each Checkout Session it creates.
(Stripe: metadata, Invoice parent, Stripe changelog, 2025-03-31, Create a payment link)
Custom fields
Invoice custom_fields are up to 4 name/value pairs (name up to 40 characters, value up to 140) that Stripe prints on the invoice PDF. A Customer's invoice_settings. are the defaults for that customer's invoices, with the same limits
(Create an invoice, Create a customer).
Use them when the buyer should also see the reference on the PDF. They're display labels, though: the name is free text (PO, PO number, Bestellnummer), so they're a poor source for a converter. Keep the machine-readable value in metadata, and set both from the same place so they agree.
Checkout and Payment Links
A Checkout Session has its own metadata (from your code, or copied from the Payment Link). With invoice_creation turned on, invoice_creation. and invoice_data. go onto the invoice Stripe creates after payment.
Checkout can also ask the buyer for up to 3 custom_fields of its own, for example a text field labelled "PO number"; the answers are stored on the Checkout Session, not in its metadata
(Create a Checkout Session).
More in E-invoices for Stripe Checkout and Payment Links.
Which one wins
Stripe has no rule for this; your converter needs one. A sensible order is the most specific first:
- the invoice's own
metadata, - the subscription's snapshot in
parent.,subscription_details. metadata - the Customer's
metadata.
That way a Leitweg-ID or Peppol ID stored once on the Customer applies to every invoice, and a PO number on one invoice overrides a standing one on the subscription.
For a credit note, use the references of the invoice it corrects: Stripe credit notes carry their own metadata, but the buyer will match the credit note to the original order.
Setting it with the API
The keys are yours to choose. These calls use example names; make sure whatever converts the invoice reads the same keys. A PO number on an invoice, also printed on the PDF (set custom fields while the invoice is still a draft):
curl https://api.stripe.com/v1/invoices/in_123 \
-u "$STRIPE_SECRET_KEY:" \
-d "metadata[po_number]=4500012345" \
-d "custom_fields[0][name]=PO number" \
-d "custom_fields[0][value]=4500012345"
A contract that covers all renewals of a subscription:
curl https://api.stripe.com/v1/subscriptions/sub_123 \
-u "$STRIPE_SECRET_KEY:" \
-d "metadata[contract_reference]=RV-2026-017"
A Leitweg-ID that applies to every invoice for this buyer:
curl https://api.stripe.com/v1/customers/cus_123 \
-u "$STRIPE_SECRET_KEY:" \
-d "metadata[leitweg_id]=04011000-1234512345-06"
A renewal invoice then looks like this when you fetch it with expand[]=customer (other fields left out). Each value is in a different place:
{
"object": "invoice",
"number": "A1B2C3-0042",
"metadata": { "po_number": "4500012345" },
"custom_fields": [ { "name": "PO number", "value": "4500012345" } ],
"parent": {
"type": "subscription_details",
"subscription_details": {
"subscription": "sub_123",
"metadata": { "contract_reference": "RV-2026-017" }
}
},
"customer": {
"id": "cus_123",
"metadata": { "leitweg_id": "04011000-1234512345-06" }
}
}
Renewal invoices stay drafts for about an hour after the invoice.created event, so a webhook has time to add the invoice's own references before finalization (Stripe: subscription invoices).
Don't put personal data in metadata that the invoice doesn't need, and never payment details; Stripe advises against storing sensitive information there.
The buyer's Peppol ID (BT-49)
To send over Peppol, both parties are addressed by a participant ID: a scheme code from the Electronic Address Scheme list plus the identifier. In UBL that's cbc:EndpointID with the scheme in schemeID. Some common schemes
(Peppol EAS code list):
| Scheme | Identifier |
|---|---|
0208 | Belgian enterprise number (KBO/BCE) |
9925 | Belgian VAT number |
9930 | German VAT number |
0204 | Peppol Leitweg-ID (German public bodies) |
0088 | Global Location Number (GLN) |
0106 | Dutch Chamber of Commerce (KVK) number |
0009 | French SIRET |
Email (EM) isn't on the list, so Stripe's customer_email can't be BT-49 in a Peppol invoice. Stripe has no field for a Peppol ID.
If you store one, the Customer is the place, as a single value in the scheme:identifier form access points use (0208:0765432146), so the scheme can't get lost.
Often you don't have to ask for it: a Belgian company's ID is usually 0208 plus its enterprise number, which is in its BE VAT number, and the Peppol Directory shows who is registered under which ID.
For a German public buyer, the Peppol ID (often scheme 0204) and the Leitweg-ID in BT-10 can differ; What is a Leitweg-ID has KoSIT's example and the format.
What evoicely reads today
evoicely converts finalized Stripe invoices and credit notes into ZUGFeRD (EN 16931) and XRechnung, and the references it takes from metadata are limited to BT-10:
- BT-10 buyer reference comes from the key
leitweg_id, or elsebuyer_reference. It looks in the invoice's ownmetadata, then the subscription snapshot (parent.), then the Customer'ssubscription_details. metadata metadata, and takes the first object that has either key. Sobuyer_referenceon the invoice beatsleitweg_idon the Customer. If none is set, BT-10 is your Stripe invoice number, which satisfies BR-DE-15 but won't route an invoice inside a public authority. - Credit notes take the buyer reference of the invoice they correct.
- Checkout payments without a Stripe invoice (which evoicely can invoice for you) use the same two keys in the Checkout Session's
metadata, including what a Payment Link copied there. The Customer's metadata isn't read for these, and neither are Checkout's buyer-facingcustom_fields. - Not read today: PO number (BT-13), contract (BT-12), project (BT-11), tender (BT-17) and accounting references (BT-19, BT-133), buyer identifiers (BT-46, BT-47), and any
custom_fields. If a buyer gives you a PO number, put it inbuyer_referencefor now: it then ends up in BT-10, which is where many business buyers look for their reference. - The buyer's Peppol ID isn't read from metadata. For Peppol delivery, evoicely derives it from the buyer's Belgian VAT ID (the
eu_vattax ID on the invoice) as0208plus the enterprise number, and checks that the buyer is registered on Peppol before sending.
What ends up in the XML
A fictional German seller invoices a monthly plan to a fictional municipality. The Customer has leitweg_id in its metadata, and the buyer gave a PO number, a contract, a project and a cost centre.
evoicely's converter produced the XRechnung and the ZUGFeRD XML from that Stripe data with the Leitweg-ID in BT-10. Because evoicely doesn't write BT-11, BT-12, BT-13 or BT-19 yet, we added those elements to the generated files by hand for this page.
The complete UBL file passes the EN 16931 and XRechnung 3.0.2 rules, and the complete CII file passes the EN 16931 rules, checked with the same validator our free validator runs. The <!-- --> comments were added afterwards.
UBL (XRechnung)
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:AccountingCost>1100-4711</cbc:AccountingCost> <!-- BT-19 -->
<cbc:BuyerReference>04011000-1234512345-06</cbc:BuyerReference> <!-- BT-10 -->
<cac:InvoicePeriod>
<cbc:StartDate>2026-10-01</cbc:StartDate>
<cbc:EndDate>2026-10-31</cbc:EndDate>
</cac:InvoicePeriod>
<cac:OrderReference>
<cbc:ID>4500012345</cbc:ID> <!-- BT-13 -->
</cac:OrderReference>
<cac:ContractDocumentReference>
<cbc:ID>RV-2026-017</cbc:ID> <!-- BT-12 -->
</cac:ContractDocumentReference>
<cac:ProjectReference>
<cbc:ID>PRJ-0815</cbc:ID> <!-- BT-11 -->
</cac:ProjectReference>
<cac:AccountingSupplierParty>
...
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">rechnung@musterstadt.example</cbc:EndpointID> <!-- BT-49 -->
...
Move cbc:AccountingCost below cbc:BuyerReference and the schema check fails.
CII (ZUGFeRD EN 16931)
<ram:ApplicableHeaderTradeAgreement>
<ram:BuyerReference>04011000-1234512345-06</ram:BuyerReference> <!-- BT-10 -->
<ram:SellerTradeParty>...</ram:SellerTradeParty>
<ram:BuyerTradeParty>...</ram:BuyerTradeParty>
<ram:BuyerOrderReferencedDocument>
<ram:IssuerAssignedID>4500012345</ram:IssuerAssignedID> <!-- BT-13 -->
</ram:BuyerOrderReferencedDocument>
<ram:ContractReferencedDocument>
<ram:IssuerAssignedID>RV-2026-017</ram:IssuerAssignedID> <!-- BT-12 -->
</ram:ContractReferencedDocument>
<ram:SpecifiedProcuringProject>
<ram:ID>PRJ-0815</ram:ID> <!-- BT-11 -->
<ram:Name>Project reference</ram:Name>
</ram:SpecifiedProcuringProject>
</ram:ApplicableHeaderTradeAgreement>
<ram:ApplicableHeaderTradeDelivery/>
<ram:ApplicableHeaderTradeSettlement>
...
<ram:ReceivableSpecifiedTradeAccountingAccount>
<ram:ID>1100-4711</ram:ID> <!-- BT-19 -->
</ram:ReceivableSpecifiedTradeAccountingAccount>
</ram:ApplicableHeaderTradeSettlement>
Peppol BIS: BT-10, BT-13 and a Peppol ID
A fictional Belgian seller invoices a fictional Belgian company that gave a department reference and a PO number. Both parties are addressed by scheme 0208 and their enterprise numbers.
The file was generated by the same code from Stripe data with buyer_reference in the invoice metadata, with the cac:OrderReference added by hand; the complete file passes the EN 16931 and Peppol BIS Billing 3.0.21 rules.
<cbc:BuyerReference>AP-DEPT-17</cbc:BuyerReference> <!-- BT-10 -->
<cac:InvoicePeriod>...</cac:InvoicePeriod>
<cac:OrderReference>
<cbc:ID>PO-2026-0815</cbc:ID> <!-- BT-13 -->
</cac:OrderReference>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="0208">1000000120</cbc:EndpointID> <!-- BT-34 -->
...
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="0208">1111111145</cbc:EndpointID> <!-- BT-49 -->
...
Remove both cbc:BuyerReference and cac:OrderReference and the Peppol rules report PEPPOL-EN16931-R003.
Checklist
- Ask business and public-sector buyers which references they need on the invoice: a Leitweg-ID, a PO number, a cost centre.
- Pick one metadata key per reference and use it everywhere: on the invoice for one-off values, on the subscription for a whole term, on the Customer for what belongs to the buyer.
- Add a custom field with the same value if it should show on Stripe's PDF.
- Set everything before the invoice is finalized; for renewals, from the
invoice.createdwebhook. - Validate the generated file. Our free validator runs the official EN 16931, XRechnung and Peppol rules, and shows the buyer reference it found.
Related guides
- What is a Leitweg-ID: the BT-10 value for German public buyers, its format and check digits.
- Mapping a Stripe invoice to EN 16931, field by field: every field Stripe does have.
- VAT IDs, reverse charge and Stripe tax IDs: the buyer's VAT ID (BT-48) comes from tax IDs, not metadata.
- What is EN 16931?: the data model behind BT and BR codes.
- Belgium's Peppol mandate for Stripe users: when you need the buyer's Peppol ID.
- Common XRechnung validation errors: BR-DE-15 and the other German rules.
Where evoicely fits
evoicely reads your Stripe invoices and credit notes, puts the buyer reference or Leitweg-ID from your metadata into BT-10, and produces ZUGFeRD and XRechnung, each checked with the official validators. Get started, free for 10 e-invoices a month.
This is general information, not legal or tax advice. Check what applies to your business with your tax advisor.