Stripe is a payment platform service provided by Stripe Inc. Stripe processes various payment methods on your behalf and deposits them into your account. In addition, various operations can be performed using APIs, and the Questetra automatic process introduced in this article also uses those APIs.

In this article, I will explain the automated process of creating an invoice on Stripe and sending it to the customer by email.

1. Questetra’s Auto-Steps

As automated Steps linked with Stripe, there are many built-in automated Steps that can be used as standard in Advanced Edition and above, and Add-on automated Steps that can be installed in Professional. In this article, we will focus on three of them: [Create Draft Invoice], [Finalize Draft Invoice] and [Send Invoice].

Create Draft Invoice

This item creates a draft invoice on Stripe. Sends the value entered in the billing details of the Table-type Data Item to Stripe. You can also specify the currency. Draft invoices must be finalized separately before you can invoice or charge the customer.

Finalize Draft Invoice

This item finalizes a draft invoice on Stripe, which allows you to send the invoice or charge the customer.

Send Invoice

This item sends a finalized invoice on Stripe to the customer by email. The customer can pay the invoice via the payment link included in the email.

2. Stripe and Questetra Integration Settings

Configure authentication settings for integration with Stripe.

Get the secret key from [Developer] > [API Keys] on the Stripe dashboard beforehand. (When performing operation verification in Stripe’s test environment, make sure that [Test mode] is enabled.)

Click [Set up Settings] on the Auto-Step setting screen placed in Questetra’s Workflow App to open the HTTP Authorization Setting screen.

Then [Add] a new setting and select [Token Fixed Value] from the drop-down list. Enter an appropriate name in [Name] and the API secret key obtained from the Stripe dashboard earlier in [Token], then click [Save].

3. Sample App

In the Enter Invoice info step, enter the necessary information such as the customer and billing details. The Create Draft Invoice step creates a draft invoice on Stripe, and the Finalize Draft Invoice step finalizes the draft. In the final automated step, Stripe emails the customer a finalized invoice.

  • Assuming you have an account with Stripe and your customer is registered
  • If your Stripe account is in a test mode, emailing invoices via the Stripe API using the [Stripe: Send Invoice] will not actually be executed (as of Jan. 2023)

Workflow App Settings

Data Items

Data Item NameData TypeField NameRequired[Enter Invoice info] stepDescription
TitleEditableProcess Title.
Customer IDString-type (single line)q_customer_idEditableEnter the Stripe ID of the customer registered on Stripe.
Payment Due DateDate-type (YMD)q_payment_dateEditableEnter the payment due date.
Invoice DetailsTable-typeq_billing_statementEditableSet the table items (column settings) to String (“Item name”), Numeric (“Unit price”), and Numeric (“Quantity”) from the left.
(An error will occur if the settings to the third column from the left are other than the above.)
Invoice MemoString-type (multiple lines)q_invoice_noteEditableEnter notes, etc., to be included on the invoice.
Invoice IDString-type (single line)q_invoice_idOnly displayGets and saves the ID of the invoice draft created in Stripe.
Invoice URLString-type (single line)q_invoice_urlOnly displayGets and saves the Stripe page URL where invoice drafts created in Stripe can be viewed.
Data Item Settings

First, enter the required items in the “Enter Invoice info” step. Data Item values are passed to Stripe in the subsequent “Create Invoice Draft” step, and a draft invoice is created on Stripe based on them.

Create Invoice Draft step

Item NameRequiredDescription
C1: Authorization Setting in which API Secret Key is set * Specifies the HTTP Authorization Setting used to connect to Stripe by its name.
(See “2. Stripe and Questetra Integration Settings”)
C2: Customer ID *Specify the Data item [Customer ID].
C3: Description (Displayed in the invoice as “memo”)Specify the Data Item “Invoice memo”. Select [Invoice Memo] from “Insert Reference…” so that #{#q_invoice_note} is set by insertion.
C4: Currency (If not selected, defaults to that of the customer)Select appropriate currency from the drop-down list.
C5: List of item names, unit amounts, and quantitiesSpecify the Data Item [Invoice details].
C6: Data item to save ID of the invoiceSpecify the Data Item [Invoice ID].
C7: Data item to save URL of the invoice detail pageSpecify the Data Item [Invoice URL].
Stripe: Create Draft Invoice settings

Finalize Draft Invoice step

The [Finalize Invoice Draft] step changes the created invoice from a draft state to a finalized state.

Item NameRequiredDescription
C1: Authorization Setting in which API Secret Key is set * Specifies the HTTP Authorization Setting used to connect to Stripe by its name.
(See “2. Stripe and Questetra Integration Settings”)
C2: Draft Invoice ID *Specify the Data Item [Invoice ID].
C3: Due date for payment *Specify the Data Item [Payment Due Date].
Stripe: Finalize Draft Invoice settings

Send Invoice step

The [Send Invoice] step instructs Stripe to send the invoice to the customer’s registered address. (Email sending is not performed in Stripe’s test environment.)

Item NameRequiredDescription
C1: Authorization Setting in which API Secret Key is set * Specifies the HTTP Authorization Setting used to connect to Stripe by its name.
(See “2. Stripe and Questetra Integration Settings”)
C2: Finalized Invoice ID *Specify the Data Item [Invoice ID].
C3: Not reuse the customer’s card details for future invoicesSet it to On
C4: Email the receipt to the customer when the payment completedSet it to On
Stripe: Send Invoice settings

Operation Check

Once the app is complete, [Release] it to check it works.

  • Please check the operation in Stripe’s test environment.
    • “Finalized” invoices can no longer be deleted
    • Running in Activated will incur Stripe fees and also affect aggregation etc.
    • Due to Stripe API specifications, invoices are not sent by email in the test environment.
      • The [Send invoice] step does not result in an error and ends normally.

Register a [customer] in advance from the Stripe dashboard. You can check the [Customer ID] on the details screen of the registered customer.

Launch the workflow App and start the process. Enter the details to be billed at the [Enter Invoice info] step.

  • [Title]: A string that indicates that it is a test process
  • [Customer ID]: Obtain the ID of the target customer from [Customers] on the Stripe dashboard and enter it.
  • [Payment Due Date]: Specify a suitable future date
  • [Invoice Details]: Enter the product name, unit price, and quantity in the table. Row by row values are passed to Stripe to calculate subtotals and totals
  • [Invoice memo]: Enter the content to be displayed in the [memo] field of the invoice (product details, thank you for purchasing, etc.)

When you have finished entering the information, click [Finish “Enter Invoice info”] and wait for a while. Click [Back to Details] to return to the process details and check the details. If you have not reached the [Confirm] step, wait for a while and reload the screen.

Open the Stripe Invoice Details page from the URL shown in Invoice URL to see the invoice that was created. If you open the edit screen with the [Edit invoice] button, you can check the preview of the email that will be sent. (Please refer to the capture image below for an example of the form input screen and invoice email)

Appendix. Billing with the Products and the Prices Registered on Stripe

When creating an invoice using product and price information registered in Stripe, run [Stripe: Create invoice draft] without setting the config item [C5: List of product name, unit price, quantity] (leaving blank). Once the blank invoice draft is created in Stripe, add the required information to the draft invoice using [Stripe: Add Item to Draft Invoice].

%d bloggers like this: