How to generate an invoice from Stripe after a successful payment

There are some situations when you may need to generate an invoice after payment in Stripe. For example, your customer may ask for an invoice after a successful checkout session because a lot of information is missing from the receipt. Also, you may need to send the invoice to your colleagues, storage, CRM system, or anywhere else.

In this article, we will show you how to automatically generate a Stripe invoice after a successful payment with the help of Plumsail Documents and Zapier.

Systems involved:

  1. Stripe

  2. Plumsail Documents

  3. Zapier

Below we propose to consider a step-by-step process:

Create a payment in Stripe

Let us say, in your Stripe account you have a payment from a customer for providing some services or selling products (an example below). You want to create and send by email an invoice when a customer makes a payment.

Stripe payments

To do this automatically, all the data from Stripe will be transferred to Plumsail Documents via Zapier. So the next step is to create a process in Plumsail Documents.

Set up the invoice generation in Plumsail Documents

In this step, we need to create the process in Plumsail Documents. Go to Processes in your Plumsail account and add a new process.

Start process in Plumsail Documents.

Then, select “Start from template” and give the process a name. You can use one of our invoice templates from the list if you don’t want to create your own invoice design. For instance, we will use our invoice template. Then click on the “Next” button.

Note: It’s a good idea to use the Stripe invoice template in Plumsail Documents to unify the design of invoices. So you can upload your own document and turn it into a template. To do this, select “Start from blank” when you create a process. Other steps will be the same.

Invoice template

As you can see in the screenshot above, our document has special {{placeholders}} marked with double curly brackets. Inserting placeholders, also known as tokens, into documents allows us to turn the document into a template. This way, we mark the areas where we want the Stripe payment data to be filled in. To demonstrate the point, we highlight {{tokens}} in our template document. In short, the templating engine considers everything between curly {{ }} brackets to be a placeholder for the data we specify. Read this article to get familiar with the templating syntax.

After we’ve set tokens in our document template, we go to configure the settings of the output file.

Document output settings

Here we set the settings for the output file. You can use {{tokens}} to make it dynamic; set the format - PDF, choose a locale, and additionally, you can protect PDF by watermark and other restrictions.

Output settings in Plumsail Documents

Next, go to delivery options.

Delivery options

In this step, we add deliveries—where the document will be stored and sent. You are free to include as many as you want. There you can see CRMs, chats, and other software from the list of available deliveries. For demonstration purposes, we added an email delivery to send the document to a customer and to a manager.

Delicery settings in Plumsail Documents

If you are using Gmail for delivery, be sure that you select all the checkboxes while connecting your Gmail account.

Delicery settings in Plumsail Documents

Next, press the button “Save & Next” and go to set up Zapier connection.

Set up Zapier connection

Go to Zapier and create an account if you don’t have one. Next, create a Zap.

Create a Zap

In the next step, you have to find the Stipe event. It means that an event will occur every time something happens in Stripe.

Find Stripe Trigger

After that, you have to find and select a certain type of Stripe event. In our case, we select the “New Payment” event.

Select "New Payment" event

As you can see, there are a lot of events you can choose from. If you need to make an invoice after, for example, a subscription renewal, we advise you to select “New Event” so that you can specify for subscription certain events.

In the next step, you have to sign into your Stripe account.

Sign in to Stripe account

Next, you will see a message about the need to allow Zapier access to your Stripe account. Don’t worry, it’s safe, no data will be stolen. Follow the link.

Follow to the link

You will go to your Stripe account to get the secret key. Press the button and copy the secret key.

Copy secret key in Stripe

Then, go back to the window that was open before and paste the secret key into the field. Click “Yes, Continue”.

Paste secret key in Zapier

After that, continue to set the trigger in Zapier. In the next step in Zapier, you will see the “Test trigger” button. Press it to see all the data you will get from Stripe payment.

In our case, we got this from a test.

Successful test Trigger in Zapier

We will use this data to automatically generate invoices in Plumsail Documents. Click on Continue to proceed to add an action that will be executed on the trigger event. Search for Plumsail Documents.

Find Plumsail Documents action

Choose ‘Start process’ as an action event.

Select "Start Process" event

Then choose your account in Plumsail Documents. Click to Continue.

The next step is the last step. Here we have to select our data from Stripe to fill our tokens in the Plumsail document template. Here is what we selected for our tokens:

  1. Process Name: Select created process in Plumsail Documents;

  2. {{date}}: Created Formatted;

  3. {{invoiceNumber}}: Customer Invoice Prefix;

  4. {{customerName}}: Customer Name;

  5. {{customerAddress}}: Included all customer address outputs. We did not list everything here;

  6. {{customerPhone}}: Customer Phone;

  7. {{customerEmail}}: Customer Email;

  8. {{amount}}: Amount;

  9. {{description}}: Invoice Lines Data Description;

Set up action for Plumsail Documents event

Let’s Continue. Don’t forget to take a test and turn your Zap on!

Set up action for Plumsail Documents event

To see the result, we ran the Zap, created a new test payment in Stripe, and checked our inbox in Email. Here is what we got:

Set up action for Plumsail Documents event

As you can see, our workflow is done! Every time we get an invoice after a successful payment in Stripe.