November 10, 201610 yr Hi all, I'm just wondering how I would go about adding Gift Voucher functionality to a website. What I want is for someone to pay an amount then receive an email that they can print off and bring to a store. I looked around for some plugins but didn't find anything that suited. Any ideas? Could a PayPal button be a good option? Thanks, Al.
November 10, 201610 yr Easy to do. After payment you just need a function that sends off the email with the voucher details. It all depends on how you are taking payments. PayPal has this great IPN feature that notifies you that payment is complete. You can add the ipn function to your functions.php and add use the wp_mail function to send the email. Or you can use a digital download plugin, there are lots to choose form. But building the code into your theme is a much better and lightweight way to do things. If you want to do it yourself I can point you towards the necessary code.
November 15, 201610 yr Author Hi fisicx, thanks for the reply. Would greatly appreciate if you could point me towards coding this myself or even links to those plugins? Thanks, Al. =)
November 15, 201610 yr This is the code: https://github.com/paypal/ipn-code-samples/tree/master/php Add a new function to your functions.php and paste in the example code. Don't use the include, Just add the class from paypalipn.php to the function. in the example code use wp_mail to send the email. You can get all the payees data from the $res variable. I use explode to convert this into an array and then just use the bits I need. Sorry if this all sounds a bit waffly but it all depends on your theme and how you are making the payment. for example if you are using in-context checkout then you don't need IPN This plugin works but is a large sledgehammer to crack a very small nut: https://en-gb.wordpress.org/plugins/easy-digital-downloads/
Create an account or sign in to comment