Note: Make sure your website meets PayPal security standards before use
PayPal has specific HTTPS and TLS security standards that your website must meet to be able to use their service to collect payments. If your website does not meet these security standards, you will not be able to communicate payment information to the PayPal service. Please see their documentation for details. If you have questions about your WordPress website meeting these standards, please contact your hosting provider.
Connect Ninja Forms to PayPal / Entering Your PayPal Express API Credentials
The first step to using PayPal with Ninja Forms is entering your API credentials for PayPal. This will allow your forms to communicate with PayPal and is a required first step before payments can be collected.
Please see the guides below for assistance.
Once you have obtained your API keys, input them in your WordPress dashboard under Ninja Forms -> Settings -> PayPal Express.
You can change between Live and Sandbox keys under the Advanced Settings of the Collect payment Action.
Setting Up a Form to Collect Payments
Before setting up your form, be certain that you have set up your live API credentials as described in the section above.
First, open your payment form and click on the Emails and Actions tab at the top of the form builder.
Next, click the blue circle/+ icon in the bottom right of the screen to open the list of available actions.
Choose either the Collect Payment or PayPal Express action from the list of available actions. They’re functionally identical, so selecting either is fine.
With the action added to your form, click to open it. If you selected the Collect Payment action, you’ll need to set the PAYMENT GATEWAYS setting to PayPal Express. If you selected the PayPal Express action, this is already set for you.
You now need to set the total that will be sent to PayPal in the GET TOTAL FROM setting. This can be one of three options:
- A Fixed Amount
- A Calculation
- A Field
Charging a Fixed Amount
If the total sent to PayPal is a static amount that will never be different from purchase to purchase, select the Fixed Amount Option. Simply enter the amount you wish to charge in the ENTER AMOUNT setting.
When the form is submitted, users will be prompted to pay this fixed amount via PayPal.
Using a Calculation to generate a total
If you are charging variable amounts per purchase via a Ninja Forms calculation, that total can be sent to PayPal directly as the amount the user will be charged.
Simply select Calculation from the GET TOTAL FROM setting, and then select the calculation itself in the SELECT CALCULATION dropdown.
When the form is submitted, users will be prompted to pay the calculation’s value via PayPal.
Using a form field as the total sent to PayPal
If you’re using the Total field, or if your purchase total is contained within another field such as a Number field, you can have the value of that field sent directly to PayPal.
Simply select the Field option from the GET TOTAL FROM setting, and then select the field that houses your total from the SELECT FIELD dropdown.
When the form is submitted, users will be prompted to pay the field’s value via PayPal.
Sending additional Transaction Data to PayPal, including notes for the buyer, and enabling sandbox testing mode
Under the Advanced settings of the Collect Payment/PayPal Express action, note the fields for Details and Note to Buyer.
Information entered into the Details section here will be saved as Transaction Data in PayPal. Use the merge tag icon to map in fields for shipping address, email, etc if desired.
Text entered into the Note to Buyer section will be displayed for the user in the PayPal checkout window when the form is submitted.
To enable testing for your form, toggle on the Sandbox Mode setting. With the appropriate sandbox API credentials entered as described in section one above, submitting the form in this mode will allow you to test the form with PayPal. This must be toggled off to accept live payments.