Invoice MemberPress payments
Invoice with Factuarea the Stripe payments of a MemberPress site: connect Stripe, make an exempt tax the default, add a rule for the products with VAT, ask the student for the tax ID with the free plugin and avoid a second invoice for the same payment.
If you sell courses or memberships with MemberPress and collect them with Stripe, Factuarea can issue an invoice for every payment without you doing anything. The invoice is created already paid, it is registered for VeriFactu and, if you turn the option on, it is emailed to the student. This guide is written for the owner of the site: it explains what to set up in Factuarea, what the free Factuarea for MemberPress plugin adds, and what to check before you go live.
Three things have to be right for an academy:
- Exempt training invoiced as exempt. The default tax for the invoices of your company decides it. An exempt tax such as «IVA exento art. 20» now puts its exemption cause on every automatic invoice, not only a rate of 0 %.
- The tax ID of the student. MemberPress does not send it to Stripe. The plugin asks for it and sends it, so the invoice can be a complete one with the student as recipient.
- The email and the name of the student. A one-off payment of MemberPress has a Stripe customer but no receipt email. When the payment does not carry them, Factuarea now reads the email and the name from that customer.
Only the payments that MemberPress collects with Stripe are covered. The orders of WooCommerce and Shopify stores are not changed by anything on this page.
What you need
- A Factuarea account with the Stripe integration module and your Stripe account connected. Connect a Stripe account you already have explains how.
- MemberPress, with Stripe as the payment gateway. The plugin is written against the hooks of MemberPress 1.12.15, the only version whose code has been read. Other versions have not been checked.
- To ask the student for the tax ID, the Factuarea for MemberPress plugin. It needs WordPress 6.5 or newer and PHP 8.1 or newer. Download the v0.1.0 release; this guide does not depend on a WordPress directory listing. The plugin is optional: without it every payment is still invoiced, but MemberPress sends no tax ID to Stripe, so a payment usually becomes a simplified invoice or, above the threshold, waits in manual review.
Set it up
Connect your Stripe account. Follow Connect a Stripe account you already have. A new connected account starts with auto-invoicing off, so nothing is invoiced yet.
Make an exempt tax the default tax for invoices. In the tax settings of your company, choose as the default tax for invoices the exempt tax that fits your courses, for example «IVA exento art. 20». See The default tax.
Add a rule for the products with VAT. If some courses are charged with VAT, one rule per rate is enough. See Products with VAT.
Install the plugin and choose when the tax ID is required. See The plugin.
Optional: email each invoice to the student. Turn on email_invoice_to_payer
on the connected account, as described in
Email each invoice to the payer.
Switch auto-invoicing on, and switch off any other invoicing plugin connected to your MemberPress payments the same day. Choose the day, do both on it, and check the first payments afterwards, as explained in Check it works.
One invoice per payment. If another invoicing plugin or service is still connected to the same MemberPress payments when Factuarea starts invoicing them, each payment gets two invoices. Switch the other one off on the same day you switch auto-invoicing on. An invoice that has been issued is never deleted: the only way to undo it is a corrective invoice.
The default tax: exempt courses and memberships
An automatic invoice line that carries no tax of its own takes the default tax for
invoices of your company. When that tax is exempt or not subject, the line now
carries the identity of that tax, and with it the exemption cause (for example
E1, article 20 of the VAT law), the legal mention of the invoice and the right
classification in VeriFactu. It is the same result as an invoice made by hand with
that tax. Before, a default tax of 0 % only produced a line at 0 % with no tax and no
cause.
- It covers one-off payments, Stripe Checkout and every cycle of a subscription, so an exempt monthly membership is invoiced as exempt with no rule at all.
- With a rate of 0 %, the base of the line is the amount charged.
- A refund issues its corrective invoice with the same exemption cause on every line, whether it is total or partial.
- A default tax above 0 % is resolved as always, and a company with no default tax still invoices at 0 % with no cause.
Check each treatment with your tax advisor. Factuarea does not decide whether a course is exempt: it applies the treatment you configure, and reviewing it is the responsibility of the taxpayer. Line tax classification and exemptions lists the causes.
Products with VAT: a charge rule
If the default tax is exempt, a course that MemberPress charges with VAT needs a
charge rule. A rule says: when the
payment carries this metadata, invoice it with this VAT. Rules are evaluated in
order of position and the first one that matches decides. A payment can be matched
by two pieces of metadata:
factuarea_vat_rate, added by the plugin: the rate MemberPress applied, as a number without symbol (21,10,0).memberpress_product_id, added by MemberPress itself: the ID of the membership.
This rule invoices with 21 % every payment on which MemberPress applied 21 %:
{
"condition": { "type": "metadata_equals", "key": "factuarea_vat_rate", "value": "21" },
"outcome": "invoice",
"vat_rate": 21
}This one does it for a single course, the membership with ID 15, and gives its
line a concept:
{
"condition": { "type": "metadata_equals", "key": "memberpress_product_id", "value": "15" },
"outcome": "invoice",
"concept": "Course B",
"vat_rate": 21
}Both are created with the same call, once per rule. Put the rule of a single course before the rule of its rate, because the first one that matches wins:
curl -X POST https://api.factuarea.com/v1/companies/{company}/connected-accounts/{account}/charge-rules \
-H "Authorization: Bearer fact_test_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 0192f3a4-…" \
-d '{
"condition": { "type": "metadata_equals", "key": "factuarea_vat_rate", "value": "21" },
"outcome": "invoice",
"vat_rate": 21
}'The amount that MemberPress charges is the total with VAT included, and Factuarea splits it: a payment of 1.21 EUR with a rule at 21 % is an invoice with a base of 1.00 EUR, VAT of 0.21 EUR and a total of 1.21 EUR. Create one rule per rate you use. The rules can also be managed in the app, in the charge rules of the connected account, and through the operations of the API.
Rules apply to one-off payments and Stripe Checkout. They are not applied to the cycles of a subscription: those take the default tax.
The other way round: exempt products with a general default tax
If most of your courses are charged with VAT and only a few are exempt, make the
general tax the default and give each exempt product a rule at 0 % with its
exemption cause in exemption_reason:
{
"condition": { "type": "metadata_equals", "key": "memberpress_product_id", "value": "27" },
"outcome": "invoice",
"concept": "Course A",
"vat_rate": 0,
"exemption_reason": "E1"
}exemption_reasonis one ofE1toE6(exempt) orN1andN2(not subject). It is accepted only with the outcomeinvoiceand avat_rateof exactly 0. Any other combination, or a value outside that list, answers422charge_rule_invalidwithparamexemption_reason, and nothing is saved.- Without
exemption_reason, a rule at 0 % invoices at 0 % with no cause, as before. - Updating a rule is a full
PUT: if you omitexemption_reason, the stored cause is cleared. - The rule applies to the lines that Stripe Tax has not broken down. A line that already carries a Stripe Tax breakdown keeps it.
The plugin and the tax ID
Factuarea for MemberPress is a thin layer: it makes no request of its own and it does not talk to Factuarea. It only adds data to what MemberPress already sends to Stripe.
- It adds a Tax ID field to the MemberPress signup form and to the account page of the student, in the classic and in the ReadyLaunch templates of MemberPress.
- It accepts a Spanish NIF, NIE or CIF with a correct control character, and saves it
in capitals, without spaces or hyphens:
12345678 zis saved as12345678Z, andB12345674is a valid CIF. A value such as12345678Ais rejected with an error in the field. - It sends the tax ID and the VAT rate that MemberPress applied to Stripe, as metadata.
- It connects the saved tax ID to the personal data export and erasure tools of WordPress, and uninstalling it deletes its settings and the tax IDs it saved.
What it does not do: it does not register the tax ID as a Stripe tax identifier (Stripe checks the format and could refuse to create the customer, which would break the payment), it does not set the receipt email of the payment (Stripe would send its own receipt), and it never blocks a payment. If something fails inside the plugin, MemberPress sends to Stripe exactly what it would send without it. Every function works without a Factuarea account and none depends on a payment or a plan.
Settings are under MemberPress > Factuarea. The texts of the plugin are in
English and only the Spanish translation (es_ES) is included, so a site in any other
language shows them in English:
| Setting | Meaning |
|---|---|
| When a tax ID is required | Never: the field is shown and can be left empty. Always: every signup needs a tax ID. Only for memberships priced above the amount below: the default. |
| Amount | 400 by default. It is compared with the price of the membership before coupons and before tax. If MemberPress is set to show prices with tax included, the price compared is that one. |
| Other countries | Accept tax IDs that are not Spanish. Off by default. When on, any identifier of 4 to 20 letters and digits is accepted, including one that looks Spanish with a wrong control character. They travel to Stripe, but Factuarea only uses a valid Spanish NIF, NIE or CIF as the tax ID of the invoice. |
Mind the threshold of Factuarea. A membership of 380 plus 21 % VAT charges 459.80. With the default amount of 400 the plugin does not ask for a tax ID, but the default limit of Factuarea for a simplified invoice is 400 including VAT, so a payment of 459.80 without a tax ID waits in manual review. If you add the VAT on top of the price, lower the amount: about 330 matches 400 with 21 % VAT.
Metadata the plugin sends
| Key | What it holds |
|---|---|
factuarea_tax_id | The tax ID of the student. Left out when the student has none. |
factuarea_vat_rate | The rate MemberPress applied, as a number without symbol. A payment without tax carries 0, and so does a reverse-charged one. Left out when MemberPress does not pass the rate, so a payment of unknown rate is never reported as exempt. |
Each object of Stripe that carries them:
| Where the student pays | Stripe customer | Payment | Subscription | Checkout session |
|---|---|---|---|---|
| One-off payment, embedded form | Tax ID | Tax ID and rate | — | — |
| Subscription, embedded form | Tax ID | The payment of the first invoice carries neither | Tax ID and rate | — |
| One-off payment, Stripe Checkout | Tax ID, only if MemberPress creates the customer at that moment | Tax ID and rate | — | Tax ID and rate |
| Subscription, Stripe Checkout | Tax ID, only if MemberPress creates the customer at that moment | — | Tax ID and rate | Tax ID and rate |
The customer never carries the rate.
Where Factuarea reads the tax ID. It takes the first valid Spanish NIF, NIE or CIF from this ordered list, and skips any value that is not valid:
- The tax ID captured in Stripe Checkout, or frozen on a Stripe invoice.
- The
factuarea_tax_idmetadata of the payment. For a one-off payment, the Checkout session comes before the payment. For a subscription cycle, the Stripe invoice comes before the subscription. - The tax identifiers registered on the Stripe customer.
- The
factuarea_tax_idmetadata of the Stripe customer.
Where Factuarea reads the rate. Only the charge rules read factuarea_vat_rate,
from the metadata of the payment: that of the payment merged with that of the Checkout
session, and the session wins when a key repeats.
Email and name. Factuarea reads the Stripe customer, once, only when the payment lacks the email, the name or a valid tax ID. The data that the payment already carries is never replaced.
Which invoice you get
| Situation | Invoice issued |
|---|---|
| A valid tax ID in any of the sources above | Complete invoice to a contact with that tax ID, even above the threshold |
| No valid tax ID, total at or below the threshold (400 EUR by default) and "require NIF" off | Simplified invoice, with no recipient. The email is used to send it and is not stored |
| No valid tax ID and total above the threshold | Manual review: no invoice is issued and the payment waits in the inbox |
Ordinary or simplified invoice explains the decision and the threshold.
Limits
- The amount rule uses the price of the membership, before coupons and before tax.
- Foreign identifiers travel to Stripe, but Factuarea only uses a valid Spanish NIF, NIE or CIF as the tax ID of the invoice.
- A subscription keeps the tax ID it was created with. If the student changes the tax ID in the account page, the one-off payments from then on carry the new one, but the renewals of a subscription that already exists keep the old one. The plugin makes no request of its own, so it never updates a subscription that already exists in Stripe, and MemberPress does not update its metadata either. Stripe Checkout does not update a Stripe customer that already exists, and a tax ID removed from the profile is not removed from Stripe.
- Reverse charge. MemberPress keeps the nominal rate on the transaction and moves
the tax to a reversal amount. The plugin sends
0asfactuarea_vat_rate, the tax that was actually charged. When that reversal amount is also 0 (a subtotal below the minimum amount, or a subtotal of 0) it sends the nominal rate, so check the value if you use the reverse charge. - Charge rules do not apply to subscription cycles. An exempt subscription is covered by an exempt default tax. With a taxed default tax, a cycle is taxed.
- Only Stripe is covered, and only the payments collected through MemberPress.
- Test mode produces no invoices. Factuarea discards the events of Stripe in test mode, so a test payment never reaches an invoice.
Check it works
Create a one-off membership with a small price, for example 1 EUR, that you remove afterwards. Pay it with a real card, with the Stripe account in live mode.
Look at the payment in Stripe. Its Metadata card must show factuarea_vat_rate
and, if you typed a tax ID, factuarea_tax_id.
Look for the invoice in Factuarea. It appears in the list of auto-invoiced charges within a few minutes. Check the type, the tax, the exemption cause and the recipient. If it does not appear, open the integration event inbox.
Refund the payment from MemberPress. The refund issues the corrective invoice automatically, with the same exemption cause.
Every payment issues a real invoice, so use a small amount and do not try to correct a wrong invoice by hand: refund the payment, let the corrective invoice compensate it and fix the setup before you repeat the check.
Related
the whole flow: the decision between a complete and a simplified invoice, the charge rules and the refunds.
why a payment you expected did not produce an invoice.
the exemption and non-subjection causes.