This technigue uses CformsII to create a membership form, and then uses a feature within cforms to move directly to Paypal, letting you set up club membership and renewal without too much coding.
Firstly, suggest you read this all though, so that you know where you are headed, as it may at first seem long and complicated, but like most things, once achieved it is easy in retrospect!
Obviously I don’t know your level of expertise, so if some of this is laboured excuse me, and if some is too vague, come back with questions on comments, and I’ll try and help further.
I will presume you you/your website has a paypal account.
I will also presume you have an FTP product such as filezilla, and are able to upload and download files. I’ll also presume you know how to use notepad or equivalent to edit a file. If you don’t know these, google “how to use filezilla video” or similar – there are lots of videos that’ll take you through this.
From users points of view:
- They access a form within a page (or post) which asks whatever q’s you need (each of which you can set up as mandatory or optional)
- They select membership type within this – or the Q’s make the selection for them (up to you how you set this up)
- They click a payment button
- They are taken to paypal’s payment page with the appropriate words (eg single membership, joint membership) and the correct amount for that type.
- They pay, and go to a thankyou page
From your point of view:
- You receive an email with answers to the Q’s
- You receive a paypal payment confirmation
- You can then send welcome pack, set up user, do nothing etc.
OK so if this is what you’re after carry on…
CformsII is not the easiest forms package to get into setting up, but it does have the neat trick of being able to do things conditional on what answers are given, hence why I used it.
In terms of getting it working, the following steps are needed :
1. Download plugin to your PC
2. Upload to your website
4. Set up form
5. Choose styling
6. Set up entry page
7. Set up exit page
8. Edit my-functions plugin
9. Go live
Steps 1 through 4 are best covered by watching the following video on cforms, this shows you installing and takes you through how to set up a form.
When you have watched this go ahead and install and set up your form.
When you have done so, go back to the video and take note of the following ;
- Setting up the email bit, as this is how you get the data ! (around 6:30 on the video)
- Setting up messages – I changed “submit” to “Payment” and the success message to “Thank you for your application, proceeding to payment…” to make it clear that you are progressing to the money bit.
- Finally, when they have completed the form, you’ll need a “success page” – you’ll need this for two reasons. Firstly to thank them for filling in the form, but secondly because paypal terms insist you have a confirmation page following payment.
You need to put this url into “redirect” part in “core admin” section of the form – this will then come into play after they have made payment.
Having created your form, you can try it by adding it to test page and see what it looks like. At the moment it’ll just go from the form to the post payment page when you click “submit” or “payment” or whatever you call the button – don’t worry we’ll add the hook to payment in between these stages later.
You may not like how the form is styled – however in the dashboard>cformsII>styling you’ll find different styles you can use, I liked wide_form.css, so chose this.
If you’re clever you can change the styles via an editor at the bottom of this screen.
Ok, so now that you have created your form, got it looking how you like and all working, finally you can add the payment part. I say finally, because the hook it uses depends on knowing the order of the questions, so you need to have finalised this otherwise you’ll need to keep doing changes to the php file we are about to change.
This is where we need Filezilla or equivalent – your host provider might have this capability built in – in essence you’re looking for package that lets you do FTP – file transfer protocol.
As state above if you don’t have one, then filezilla is a popular choice – simply download the Client version, google for videos on how to do this, but make sure it’s the CLIENT one you download.
Once connected you’ll need to find the current my-functions file in the cforms plugin.
Navigate the following : wp-content/plugins/cforms/my-functions.php
Save this away to your local PC as a backup.
Then download the following file and save it somewheer else (so that you have the original file if you need it)
Two stages to this process
1. Change the email@example.com to your email address twice in line 8.
Then save it and upload it to replace the existing file ie at wp-content/plugins/cforms
Then run your membership form, click the submit/payment button. This will now access the new my-functions and send you an email with what fields have what ID no.s.
Look at the email and what you are looking for are the $$$ no.s say for instance no.family members is $$$14
2. Now go back to your my-functions.php in notepad.
Comment out the @mail line, and uncomment the bits between the /* and */ lines 22 and 38.
In this version I am looking at two parameters and setting the return dependant on this combination
Now in your email from 1. above you’ll be able to see the numbers of the parameter(s) you are interested in. These will be used in lines 25 and 26.
If you have only one parameter then change accordingly.
You’ll see that the if statement then sends the user to the paypal website with lots of parameters in, including your paypal account, item-name, amount, shipping, and return url.
Now on the return line you need to replace the XXXXXX and YYYYYY
The XXXXX is you email address that you use for paypal. But this needs to be phrased so that the URL doesn’t contain any punctuation which is used for coding.
So we need to replace the @ symbol with %40 and the full stops/periods with %2e
So firstname.lastname@example.org becomes fred%40mail%2ecom
You’ll also need to change the item name, and amounts etc. Again we need to use %20 as a space, and %2e as a . within the amount.
So in the file you’ll see “Family%20Membership%20Email%20Newsletter” that will give “Family Membership Email Newsletter” and “20%2e00” that gives “20.00”
Then we need to change the return url at the end (this is where paypal will send the user back to after payment) again taking out slashes and fullstops/periods. Slashes are %2f, and colons %3a
You should then have a working couple of lines.
Then just repeat these two lines (the one starting IF, and the one saying return) for all your other conditions, changing item_name and amount as needed.
Upload and test.
Anything not clear – come back and I’ll try and help further !