Perhaps you run a charity and want to offer your visitors a way to make a one-time donation to a particular campaign. Or maybe you operate a store and are looking for an easy way to sell a range of items online. Then a single payment form is what you need.
You have the option to enable account creation, which would make purchases easier for returning customers. The GoCardless customer reference is then stored in the user profile, saving the need to create a new Direct Debit mandate each time.
UK users: check out Instant Bank Pay as an alternative to Single Payment, and get paid faster. Instant Bank Pay does not require a new mandate for each payment, and the user does not even need an account.
Create a new form and save it. We’ll add some fields later. In the form settings, select GoCardless and add a new feed.
Then, from the list of actions, select Single Payment.
Enter a payment description. As this will appear on GoCardless emails, it should be meaningful to the customer, reminding them what the payment is for (maximum 255 characters).
If the transaction amount will always be the same for this form, enter this amount. (The currency applied will be the default currency selected in the Gravity Forms settings. You should not try and mix currencies on different forms.) There is no need to add a currency symbol. e.g. for £25.59 enter 25.59
If the transaction amount will depend on form entries, leave the amount field blank.
Adding fields to your form
A single payment form can be as simple as a button labelled “Pay”! Or it can contain as many fields as you like, spread over several pages. For the purposes of creating a payment form, we’re going to break down these fields into recommended and additional fields. Feel free to add any other fields to your form that you like.
Recommended fields
If all you need to do is set up a single payment of a fixed amount, you don’t need to add any fields to your form. You only actually need a Submit button, which you can tailor in the Form Settings.
Of course, you probably will want to add various fields. Here are our recommendations.
Product fields and a Total field
The Gravity Forms form editor provides a group of fields called Pricing Fields. Adding these to your form brings you tons of flexibility to describe your product, add quantities, the option of a user-defined price (great for donations), tiered prices, shipping and more.
If you also add a Total field (it’s recommended that you do), this will contain the sum of all amounts from the product fields.
Then on the form feed, leave the Amount blank and use the drop-down selector to map the Amount to the Total field. The amount in this Total field will be validated against the transaction minimum and transaction limit defined in the Gravity Forms GoCardless settings and when the form is submitted, this amount will be submitted to GoCardless for processing.
If you’d prefer to offer the customer a set of fixed choices, perhaps to accept donations with suggested amounts, you could change the field type of your product field to use selector buttons or a drop-menu menu instead, like this:
This will create a payment section field like this:
Charge date
You can let the user select a date in the future for their payment by entering a date on the form and mapping it here.
If the chosen date is too soon, or if the date falls on a day that is invalid for payments to be taken, the date that will be applied will be the earliest date possible for the payment to be taken.
Password
Password verification is for use where you allow customers to have their own user accounts on your website. It adds a double layer of security to your form. Firstly the customer will need to be logged in; secondly the customer will not be able to submit the form if the password entered does not match their account password. You can add a password field by looking in the Advanced fields group offered by Gravity Forms. This will ensure the entered value is only used for verification and is not saved with the form.
If you include a password field, it should be set to Required. Set Confirm Password to Off. Set Enable Password Visibility Toggle to Enable. Do not Enable Password Strength.
To use this password field, you should map it in the Validation section of the feed.
Metadata
GoCardless allows you to tag a transaction with up to 3 items of metadata, consisting of a key and value pair. WPdirectdebit uses one of these pairs to add an order number to the transaction. (The order number is derived from the form’s entry ID and can be customised.)
You can add another pair by entering the metadata key on the form feed and mapping it to a value entered on the form, or selecting from several available values in the drop-down, such as the IP address of the user, or time of day etc.
Additional fields
Pre-populating the GoCardless hosted payment pages
GoCardless needs a Direct Debit mandate in place before the payment can be taken. The first time that a customer makes a payment, they will need to complete a short mandate application on a form hosted by GoCardless. The exact details captured vary from scheme to scheme. For BACS, the customer must provide their name, address and email address, and their bank details.
The customer will be directed to this secure form on submission of the single payment form. Once the secure form has been submitted, GoCardless will redirect the customer back to your website. As the merchant, you do not have to worry about securely storing the customer’s bank details on your system. You never have access to them. On the other hand, you may wish to store their name, address and email and so you may wish to add fields to your form to request these details. So that the customer does not have to enter the same information twice, WPdirectdebit can pre-populate the mandate application. To achieve this, you just need to map those fields on your form to the fields in the mandate section of the form’s feed. Gravity Forms provides suitable name, address and email fields in the Advanced Fields section.
Scheme
You can restrict the scheme that customers can use to a single scheme, if you don’t wish to accept payments from all of the available banking schemes (BACS, ACH, SEPA, etc.) The default is to accept any scheme. See the Mandate section above. You cannot set the scheme via a field on the form.
Mandate Metadata
GoCardless allows you to tag a transaction with up to 3 items of metadata, consisting of a key and value pair. WPdirectdebit uses one of these pairs to add an order number to the transaction. You can associate a mandate with its own metadata. Add a metadata key/value pair by entering the metadata key in the mandate section of the form feed and mapping it to a value entered on the form, or selecting from several available values in the drop-down, such as the IP address of the user, or time of day etc.
Account Holder Username
If you choose to allow users to register an account on your site, then you can add suitable account holder fields to your form to capture the user’s data.
Add a single-line text field for the username. You have two alternatives to a username field. You can map any email field on the form to the Account Holder username in the registration settings, or you can use the customer ID generated by GoCardless.
Account Holder Email
If you choose to allow users to register an account on your site, then you will need to capture the user’s email address. Add an email field to your form for this purpose and map it to the Account Holder Email in the registrations settings.
Account Holder First Name and Last Name
If you choose to allow users to register an account on your site, then you will need to capture the user’s name. Add a Name field to your form for this purpose and map the First Name and Last Name to the Account Holder First Name and Last Name fields in the registrations settings.
Terms and conditions
It is always a good idea to get a record of the customer accepting your terms and conditions before you take their money. The Gravity Forms Consent field allows you to offer a “yes/no” consent checkbox and a detailed description of what is being consented to. It is available under the Advanced Fields section within the form editor.
Conditional logic
By default, the form will be passed to WPdirectdebit for processing, and from there, over to GoCardless, however you can disable this using conditional logic. For example, perhaps you also offer payment by credit card or by PayPal. By adding a payment method field to your form, the user can select their preferred payment method. With conditional logic you can test this field to find out which method they prefer and then disable all but the selected method. This avoids the possibility of them paying more than once.
Enabling and disabling registrations
The WordPress general settings include an option to disable registrations, and also an option to select the default role for new accounts as shown here:
These options are ignored by WPdirectdebit – you can still register accounts even without this Membership option being checked, and the role assigned to users created by WPdirectdebit will be governed by the WPdirectdebit account settings.
You can disable registrations from any WPdirectdebit form via the Gravity Forms Settings. In the Gravity Forms main menu, select Forms, then select GoCardless and scroll down to the New Accounts settings. Uncheck ‘Enable new account creation’ and save the settings.
If you only want some forms to be able to register accounts, first make sure you’ve not disabled registrations as just described. Then look under the form feed settings for each of these forms. Scroll down to ‘Registration’ and check ‘Enable registrations’.
Complete the remaining fields to suit your needs and save your settings.
An example single payment form
Our example form has a single product with a fixed price and a quantity field.
There are name, address and email fields which are used to pre-populate the GoCardless hosted payment pages if a direct debit mandate needs to be set up because no customer account can be found.
An account will be set up for the customer to simplify repeat purchases. The username will be the user’s email address.
Setting up the form feed
Gravity Forms passes the form entries over to each of the active feeds for the form.WPdirectdebit processes the data and passes it to GoCardless. This is the purpose of the feed. Read more about Gravity Forms feeds.
Confirmation settings
It’s important to define the confirmation settings, as GoCardless will need the URL of a page on your website to redirect the customer back to after completing the GoCardless hosted payment pages. You should set up a thank-you page landing page where you can tell the customer what to expect now that their payment has been submitted, and then select this page in the confirmation settings.
Notifications
Notifications are not essential but recommended. These are emails that are automatically sent when selected events occur related to form submissions.
The default notification is to send an email to the site admininstrator. You’ll probably want to add a notification for the customer to remind them what they ordered, and here you can add any other information that you’d like the customer to know at this stage: your returns policy, customer service contact details etc.
Adding the form to your site
Gravity forms are embedded using shortcodes like this:
[gravityform id="67" title="true" description="true"]
Refer to the Gravity Forms documentation for more information.
Here’s what our single payment form looks like when embedded into a page on this website. Note that the style is automatically picked up from your active theme’s style.