How to Redirect a User to a PayPal Payment Page After Filling in an RSForm Form

We have probably mentioned this before – RSForm is one of the few Joomla extensions that we love and that we trust, and we get really excited when a client gives us a task on this powerful extension.

Yesterday (Sunday), one of our clients contacted us and told us that she wanted those who fill a certain RS Form form on her website to be automatically redirected to a PayPal payment page, if they choose their payment as “PayPal” (she had 2 payment options, one was “Check”, the other was “PayPal”).

Here’s how we did it:

  • We logged in to the Joomla backend, and then we went to Components -> RSForm! Pro.
  • We clicked on the Properties tab and then clicked on the PHP Scripts tab (under Scripts on the left panel).

  • In the third box (just below Script called after form has been processed) we added the following code:

    $myform = $_POST['form'];
    if ($myform['Paying By'] == 'PayPal'){
        $arrPaypal= array();
        $arrPaypal['cmd'] = '_cart';
        $arrPaypal['upload'] = '1';
        $arrPaypal['business'] = 'Our Client's PayPal Email';
        $arrPaypal['item_name_1'] = 'Name of the Product Being Sold';
        $arrPaypal['amount_1'] = $myform['Price']; //The price was in the field Price in the submitted form. You can always hardcode the price here.
        $strPaypal = http_build_query($arrPaypal);
        header('Location:' . $strPaypal );

That was it! When a client submitted a form he was automatically redirected to the PayPal payment page with all the proper variables being transmitted (price, name of the product, and email of the merchant).

As you can see, doing this in RS Form is not that hard, but it does require a very basic knowledge of programming. So, if you have never been exposed to programming, then please contact us. We can help you implement the above in very little time and at a very affordable cost. What are you waiting for? Just give us a ring or shoot us an email and let us take care of your Joomla website!

No comments yet.

Leave a comment