Generate PayPal Invoices for new Google Form Responses
Document Studio enables you to generate PayPal invoices for new Google Form responses. You can build an order form inside Google Forms and, when someone submits the form, a PayPal invoice is automatically sent to the customer. The invoice is hosted on PayPal and the customer can securely pay with credit cards, debit cards, or their own PayPal account.
For this example, we have a Google Form that allows customers to order their favorite coffee online. The customer can choose the beverage name, the cup size (tall, grande or venti) and the final price is automatically calculated in Google Sheets using the Vlookup function.
When the form is submitted, the customer is sent an invoice through PayPal with the total amount due.
Create PayPal API credentials
Go to your PayPal developer dashboard and create a new app in the live mode. Give your App a name and click the Create App
button.
PayPal will create a Client ID
and Client Secret
key that you will need in a later step. Under the Live App settings section, check the Invoicing
option and turn off all other options since we only want the API keys to generate invoices and have no other functionality. Click Save
to continue.
Connect PayPal to Google Forms
Install Document Studio and open your Google Form to launch the add-on. Inside the Document Studio app, provide a descriptive name for your workflow like Send PayPal Invoices with Google Forms
and click on Continue to move to the Conditions page.
Click on Continue and choose Accept Payments
from the list of available tasks.
Configure PayPal Customer
Inside the Payments task, choose PayPal
from the list of available payment providers. Choose Live
for environment and paste the Client ID and Secret key that were created in the previous step.
For the PayPal Email Address
field, enter the exact email address that is linked to your PayPal account.
Next fill in the fields for the Customer Information section and data in these fields can be pulled in from the form response using question title placeholders. For instance, if you are asking for the name of the respondent in your Google Form, you can add that name in the Customer's Name field with variables like {{ Name }}
.
The Country Code field in the customer section is mandatory.
The customer memo and other text fields also support Scriptlets to add conditional or calculated text.
Configure PayPal Invoice
For the invoice section, specify the items name, the price of each item and the {{ quantity }}
of each item as selected by the customer in the Google Form. You also need to provide the 3-letter currency code for the invoice and the tax rate (optional).
The invoice due date is the number of days from when the invoice is created until it is due. It is, by default, set to the day after the form response is submitted but you can change this date to any date you want.
Calculate Unit Price
Our Google Form doesn't have the price field but we can use the VLOOKUP function in Google Sheets to calculate the price of the beverage based on the cup size and the beverage name.
Add a new column in your response Google Sheet and apply the following formula in the header row. The coffee prices are stored in the Prices
sheet in the same response spreadsheet.
=ARRAYFORMULA(IF(ROW(B:B)=1, "Unit Price",
IFNA(VLOOKUP(B:B, Prices!$A$1:$D$10, MATCH(C:C, Prices!$B$1:$D$1, 0), FALSE))))
As new responses are submitted, the unit price will be automatically calculated and added to the response sheet.
Business Information
For the business information section, you can provide your (invoicer) business name, tax ID and postal address. All fields are optional except for the Country Code.
Preview and Save
Click the Preview
button and a test invoice is generated. Document Studio will take the data from the second row of the response Google Sheet and create a PayPal invoice. You can view the invoice in the Invoice section of your primary PayPal account. Click Done
to locally apply your changes.
On the trigger screen, turn on the option that says Run workflow on Form Submit
and then click on the Save
button. The workflow will now appear in the workflow dashboard where you can edit, delete or manually run the workflow.
Here's a copy of the sample PayPal invoice generated from the Google Form response: