Managing Payments
New for version 2.2 is the ability to cancel or retry payments and the ability to amend subscriptions. You can now retry a failed payment, or cancel it before it is taken, provided that the payment was previously set up via WPdirectdebit.
To manage a payment, you’ll need a payment management form. Once created, this will be embedded automatically into the new ‘Manage Payments’ tab of your WPdirectdebit settings page.
Follow this guide to create and embed your payment management form like the one shown above: Time to complete, around 10 minutes.
- Either: download and import this ready-made form, then go to step 6.
Or: follow steps 2…7 below to make your own form, then continue from step 6. - Create a new Gravity Form and call it Payment Management (or similar). Under the Restrictions, we recommend you check the box marked ‘require user to be logged in’.
- Add a single line text field, and call it Payment ID. In the general settings for this field, check ‘Required’. In the advanced settings, set the Parameter Name to gocardless-payment-id exactly as written here.
- Add a drop-down field, and call it Action. Under the general settings for this field, click Edit Choices. Add two choices labelled Cancel and Retry, and set their values to cancel and retry respectively (all lower-case).
- Save your form.
- Go to the GoCardless settings for your new form, and add a new feed.
Complete the feed settings as follows:
Set the Feed type to Manage Payments.
A unique feed name will have been auto-generated.
Map Payment ID to your payment ID field.
Click Save settings.
If you wish to, you can tailor the confirmation message, or choose to redirect to a URL. A good choice of URL would be the payments tab. It will be something like this, but with your own website at the start:
https://example.com/wp-admin/options-general.php?page=wpdirectdebit_options_page&tab=tab_payments
Now click on Forms in the dashboard to bring up a list of your Gravity Forms. Note the ID of your newly created payment management form.
Go to the GoCardless settings within the Gravity Forms settings page. Scroll down to Payment Management Form ID and enter the ID you just took a note of.
Save the settings.
How to manage a payment.
Once you’ve followed the steps to create a payment management form, you’ll find that when you visit the WPdirectdebit settings, there will be a new tab labelled ‘Manage Payments’. Click this to display your new form. Now you can enter the ID of any GoCardless payment created by WPdirectdebit, and cancel or retry the payment.
Payment IDs are shown on the payments tab. Tip: You don’t have to memorise a payment ID. From the Payments tab, you’ll see the status of each payment on the right hand end of the row. Just click the status to be taken to the Manage Payments tab, with the payment ID pre-populated on the form.
Keeping track
Gravity Forms helps you to keep track of changes you have made. Each time you make a change, you are creating a new entry for your payment management form. You can view and edit these as you would with any form entry. In addition, the result of the amendment request is added to the entry as a note.
GoCardless will send an email to the customer automatically whenever a payment is amended. You can also send your own notifications via Gravity Forms using the event ‘GoCardless single payment amended’. This could be useful if you want to send an email to your accounts department.
Security considerations.
All you need to manage a payment is access to the form and the payment ID. It’s obviously not a good idea to give everyone the ability to amend payments. To prevent misuse, we’ve added checks to the code to ensure that you must be an Admin to use the form. However for additional security, we don’t recommend you add the payment management form to any area visible on the front-end of your website.