Invoice created with S2member not showing VAT, and invoice/receipt not sent to customers

Hello, I have 2 issues. To be clear, I am in test mode on S2member & Stripe.

The first issue is that, being in France, by law, I should indicate separately the price excluding VAT and the VAT amount, and the total amount, in the invoices. The problem is that I only see the total amount on the invoices created with S2member. I tried multiple things on Stripe, I contacted Stripe’s support and they say that it’s probably due to the plugin intergation. I have defined a flat tax rate on S2member Pro, since as I am a small business, I don’t have to manage taxes depending on my customer’s location, it’s a flat rate of 20%. When I use a test customer account and that I subscribe, I do see that S2member calculates the correct amounts for the VAT and total amounts, based on the prices (ex VAT) I have set up, so I don’t understand why it is such a mountain just to make something that simple.I have looked into the 2/3 topics I have seen on this forum but gosh, why having to pay a 3rd party (moreover expensive for a small business) for such a simple thing ? And I am not even sure that would do what I just described!
When I look at the Stripe webhook logs, on the “invoiceitem.created” record, I see those fields “tax_behavior”: “unspecified” (it should either be VAT inclusive or exclusive), and “tax_rates”: [ ] (which should be the one I defined on S2member? Or the one I’ve setup on Stripe for the Product one created for the first time by S2member?)

  • on “invoice.created” record, I see: account_tax_ids": null, “automatic_tax”: { “enabled”: false, “status”: null }, “customer_tax_exempt”: “none”, “customer_tax_ids”: [ ], “default_payment_method”: null, “default_source”: null, “default_tax_rates”: [ ], “amount”: 2500 (eg for 25.00 euros I presume, the total amount of 20.83+20% VAT = 25), “amount_excluding_tax”: 2500 (so same number as amount,why? that’s not what I have setup in the shortcode), “tax_behavior”: “unspecified”, “tax_amounts”: [ ], “tax_rates”: [ ], “unit_amount_excluding_tax”: “2500”, “tax_info”: “{“trial_tax”:“4.17”,“trial_tax_per”:“20%”,“tax”:“1.67”,“tax_per”:“20%”}” (I manage a trial amount and a regular amount), then later I see “tax_behavior”: “inclusive”, etc
    I don’t know how it is supposed to work but I guess that some of these fields should have other values. Does it need “manual tricks”?

The second problem is that, when I use a test customer who subscribes, I don’t see the invoice or receipt being sent automatically to that customer’s email address. I have setup Stripe so that normally, they should be sent an email. But nothing. I also talked about that to the Stripe’s support and they also told me to see the issue with the plugin editor. Ideally, I would like to send an email with the PDF of the invoice or the receipt, but I don’t see how it’s possible. Once again, here are the events logged on Stripe: even though the payment succeeded, the customer doesn’t receive any email.

invoice.payment_succeeded - 7:56:35 PM
invoiceitem.updated – 7:56:34 PM
payment_intent.succeeded – 7:56:34 PM
customer.subscription.created – 7:56:34 PM
invoice.paid - 7:56:34 PM
invoice.finalized - 7:56:34 PM
payment_intent.created - 7:56:34 PM
invoice.created - 7:56:34 PM
charge.succeeded - 7:56:33 PM
customer.updated - 7:56:31 PM
invoiceitem.created - 7:56:31 PM
customer.updated - 7:56:30 PM
payment_method.attached - 7:56:30 PM
customer.created - 7:56:29 PM

I have seen a topic saying there https://s2member.com/kb-article/does-s2member-send-a-payment-receipt-or-invoice/ but for me it’s Chinese :slight_smile:

These are the 2 issues left before going live, but after having looked at that for the whole weekend, I don’t have the beginning of an idea on how to fix these, so I start to be really worried. I understand that most of the sites can be in the US, so are there European websites using s2member for paid memberships? If someone is ready to help, I’d be ready to pay (not much unfortunately, but still! ), because it really becomes criticial for me.

Thanks in advance.

For invoicing a simple solution won’t do except you do not fall under OSS (global annual turnover below 30.000€).
So best use quaderno.io
No membership system has fully compliant invoicing.

It’s way more complicated than you assume. You need to store proof of location and need 3 pieces of proof, IP only does it if below 30.000€ annual global turnover. You need solutions to correct invoices and every country has different VAT rates, some regions inside a country may be different even. And you need to store all that for 10 Years…

Thanks Felix for the reply. Nope, in B2C, there is an exception for small businesses with less than 10k€ of annual turnover, you don’t need to adapt the tax rate to location of the customers, you can apply the rate in force in the country of your business (at least that’s how it works in France). So why getting a proof of the location of the customer if you don’t adapt the tax rate? No point. So in my case, I don’t think there is any need for a 3rd party solution like quaderno (the one I was referring to in my original post).

I figured out that for my 2nd issue, the recepts were not sent in test mode, so that might explain it. I will try the whole process in live mode in the next 2 weeks.

RECEIPTS IN TEST MODE

Receipts for payments created using your test API keys are not sent automatically. Instead, you can view or manually send a receipt using the Dashboard.

So it all comes down to how the tax info & prices are provided by S2member to Stripe, so that Stripe can generate those invoices and receipts with price ex-VAT, VAT only & global amount. If it’s doable with Stripe (manually send an invoice = it works), it should be doable with S2member.
In my first post I already point out some leads I think.
Also, on Stripe, you need to create “tax rates” (eg 20% exclusive in my case) under “Products” to then associate them with a product x qty listed in an invoice. Maybe that’s also a link that is missing in S2member integration. When you provide a Product name for a subscription plan with S2member, you provide a tax rate in the plugin but it seems that it only serves to calculate the total amount price+VAT, instead of providing these info separately in the appropriate field. Maybe the plugin should pass in argument a “tax rate” name defined under Product on Stripe (or maybe it can create one directly from Stripe?), to make the link. At least, that’s how I understand it.

Looking at the source code of the S2member-pro plugin (I don’t get it all, far from that), it seems to me that there are potentially some tweaks to be done in the /plugins/s2member-pro/src/includes/classes/gateways/stripe/stripe-utilities.inc.php file to have it to work as I (and other European guys) would like it to work. Thing is I don’t really understand how all the things are passed from S2member parameters to Stripe, and how it is translated into webhooks.

Keeping the pace with my monologue.

I have tried to add the ‘default_tax_rates’ argument (“string of hashes”),as well as ‘automatic_tax’ in the “subcription” object (line 49x) in stripe-utilities-inc.php but I have an issue with ‘default_tax_rates’: as soon as I populate the array with anything else than void, I get the error “Invalid parameters sent to Stripe; contact the site owner” when I validate the test subscription form.

I used the instructions from here:
https://stripe.com/docs/api/subscriptions/object#subscription_object-default_tax_rates
but nothing works. I tried to indicate the name of an existing ‘tax rate’, it doesn’t work. And I tried to fill the array with news values, without more success.
Maybe if one can create a tax_rate via S2member, then try to recall the parameters, it would work, but I am not sure I can do without breaking everything… Even adding an array, I wasn’t successful so…

Daily update: I don’t have the time to elaborate but I managed to do what I wanted. I needed to get a closer look at the error log messages on Stripe to guide me. So yes, it’s possible to be EU VAT compliant for invoices (& assumedly receipts), at least in my case (small business with flat tax). I don’t think it would need much to more to be fully compliant even with all the constraints to address all the country-dpdt tax rates. I have not validated everything yet, just the “proof-of-concept”, but it’s possible.

thesimarchitect, maybe that could help you as well, if still interested. I had seen your topic from late 2020. Stripe tax_info deprecated, did anybody fix it somehow?

Mini-update: my first achievement was to generate a correct invoice for a paid Trial period (previous message). Today I managed to get the invoice for the Subscription to work as well, showing amount excluding tax separetly (at least as I see it on Stripe on a test Customer account, not yet on the PDF that I haven’t generated - but should be consistent with the web version on the next invoice), as well as the tax amount & rate alone, with the correct total.
Now I need to check the behavior of a coupon, and I think I’m done.

Follow-on update: coupon behaves as expected, invoicing with or without coupon as well, subscription incoiving as well (in test mode).
As a reminder, my case is the case of a flat tax rate, but could probably expand it for a country-based tax rate. One needs to set up the tax manually on his/her Stripe account (tax rate consistent with what is provided on S2member Pro). Source codes needs to be adapted in 2 files: stripe-utilities.inc.php & stripe-checkout-in.inc.php.
Coming back later for more details, as I still have to work on my site.