Home » How to automatically generate invoices

How to automatically generate invoices

No matter what you sell, if it’s an online course or other digital product, you need to spend some time on the entrepreneur’s favorite thing later. Invoicing.

I’m kidding (obviously!); no one likes invoicing. Fortunately, you don’t have to do it even if your payment processor doesn’t offer its invoicing system. And I’m going to show you how.

In the article, I’m going to use an example of Stripe and FacturaDirecta, but if you’re using another payment processor and invoicing system for your business, don’t worry. I’ll talk about that too.

Stripe

Stripe is a payment processor I’m using in this example. It’s also the one I use myself. I very much recommend it to anyone who asks for a recommendation. Verification lasts hours (in the worst case), and with Stripe, you can start selling in many currencies and countries. It has clear documentation, and you can easily integrate it with other applications using tools like Zapier or Make.

FacturaDirecta

“What on Earth is that?” you might ask. Well, if your business is not in Spain, you most likely don’t know it. It’s just one of many invoicing systems, and this one is dedicated to Spanish companies and solo businesses.

What do we need to connect these two? Zapier!

Zapier is a powerful automation tool that allows you to automate repetitive tasks. It connects applications such as WordPress, Mailchimp, Stripe, and many more. For instance, you can integrate Stripe with FacturaDirecta so that the invoice is generated automatically when a new purchase is made. This way, you don’t have to manually enter the order’s data into FacturaDirecta to create an invoice. Zapier does all the work for you.

Zapier is not the only tool doing that kind of magic. Another one I use is Make, but in this example, I’m using Zapier. I think it’s easier to use and understand for non-technical people.

Let’s start

Once logged in to Zapier, click the button to create a new Zap.

Create Zap button

Next, start typing “webhooks” and choose “Webhooks by Zapier.”

Webhook by Zapier trigger

Now under “Event,” choose “Catch Hook” and click “Continue.”

Next, let’s move to the “Test trigger” section. You will see a webhook URL there.

Now a bit of explanation for non-technical people. The URL you see above is our trigger. If something or someone accesses this URL, it will trigger our whole scenario. We’ll tell Stripe to send data to this URL every time a successful purchase is made. And we don’t need to code to achieve that.

So let’s log in to Stripe. I switched to test mode not to break something. I recommend you do the same at first. Once the scenario works as expected, you can switch to live mode and set up a webhook on live mode.

Test mode toggle

Now we move to webhooks settings. You can directly go there from this link: dashboard.stripe.com/test/webhooks. We’re going to add a new endpoint. To do that, click the “Add endpoint” button.

New endpoint button

Now, we have to copy-paste the URL from Zapier and choose events that will trigger the workflow. If you use Stripe’s payment links, the best, in my opinion, is “checkout.session.completed,” but you can also go with “payment_intent.succeeded”. The latter will also work if you use Stripe, for example, through the WooCommerce plugin. Once you’re finished, click the “Add endpoint” button.

Configuring webhook in Stripe

Now you can start testing (that’s why we’re in testing mode). Perform a test payment to see a new event in Stripe.

New event in Stripe.

Now we can go back to Stripe and test the trigger. Click the “Test trigger” button. You’ll see a success message and some data that Stripe sent to Zapier.

Now click “Continue.” The next workflow piece will be the invoicing system which, in my case, is FacturaDirecta. FacturaDirecta has integration with Zapier, so I can search for it in the search bar and click it.

Search for Factura Directa in Zapier

Now, what we need to do, is to use the data we received from Stripe to send it to FacturaDirecta to create an invoice automatically. This is simple in Zapier.

Let’s start with setting up an event in Factura Directa action in Zapier. We want to create an invoice, so the step should be “Create Sales Invoice.” Then click “Continue.”

Choose "Create Sales Invoice" as an event

Now you need to connect to your Factura Directa account. Just follow the instructions you’ll see on the screen. Once you’re done, click “Continue.”

Connect FacturaDirecta app in Zapier.

Now the fun begins. You’ll see available fields that you can use in FacturaDirecta to generate an invoice. We need to click every field we want to use, switch to the “Custom” tab (for some fields, you won’t see it), and choose a piece of information we need for the data we received from Stripe.

Map data from Stripe input.

Once you map everything you need, click the “Continue” button and test the action. Warning: testing this action will generate an invoice in your system. After that, you can rename your automation and publish it. That’s it! Since now, all the invoices will be created automatically.

What if I don’t use Stripe or FacturaDirecta?

No matter what payment processor and invoicing system you use, the mechanism is the same. You use Zapier as an intermediary and a connector. You must first get data from your payment processor and then, through Zapier, tell your invoicing system to create an invoice.

Regarding payment processors, I used Stripe, but in Zapier, I used Webhooks functionality. Zapier also has direct integration with Stripe, but I didn’t use it because it can’t be used in a test mode (only live mode). There are almost 100 payment processors that have direct integration with Stripe. Some of them are:

  • Square
  • PayPal
  • ChargeBee
  • MemberSpace
  • Razorpay
  • Recurly
  • MoonClerk
  • Instamojo
  • Zoho Subscriptions
  • Revolut Business
  • Braintree
  • Chargify

Even if you’re payment processor is not on the list, it’s highly possible that you can still make it work with webhooks (precisely what I did in this tutorial). For example, for one of my projects, I made it work with FastSpring.

There are also many invoices systems directly integrated with Zapier:

  • Quaderno
  • FreshBooks
  • Zoho Books
  • Wave
  • Moneybird
  • Fattura24
  • InvoiceExpress
  • InvoiceBerry
  • … and many more

Downsides

For this scenario, you need at least a Starter Plan which costs $19,99 per month (billed annually). It’s because I used webhooks which are not available with the free plan. If you’re not ready to pay for this tool, you should also check out Make instead of Zapier.

Leave a Comment