Monday, 10 May 2010 13:03

How to connect RSForm Pro to PayPal using a custom amount field

Written by 

I recently built a "Make a Payment" form for my clients using the RSForm Joomla extension and a little custom scripting.  You can preview this form and see it in action here.

I used the following fields:

  • Name
  • Email
  • Invoice number (This is not required)
  • Amount
  • Submit

Here is the script which is called on form process:

 


if (isset($_POST['form']['Amount']))
{
$business = This email address is being protected from spambots. You need JavaScript enabled to view it. ';
$item_name = 'Payment on Invoice Number'.$_POST['form']['InvoiceNumber'];
$currency_code = 'USD';
$amount = $_POST['form']['Amount'];
header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business='.$business.'&item_name='.$item_name.'&currency_code='.$currency_code.'&amount='.$amount);
exit();
}


EDIT: I realized that the email notifications were not sending using this method.  If you also want the email notifications to go out, move this PHP code to the "call AFTER form process" box in RSForm.

BONUS READING: Connecting RSForm and Paypal using recurring payments

Read 3603 times Last modified on Thursday, 07 October 2010 17:44

7 comments

  • Comment Link Nate Covington Wednesday, 06 October 2010 11:26 posted by Nate Covington

    Mike - I just tested the "Payments" form on this site to use an amount with a decimal. It worked fine. What is the exact error message you are seeing? Is your form online somewhere that I can test it?

  • Comment Link mike Wednesday, 06 October 2010 11:18 posted by mike

    Hi,
    Many thanks for the custom PayPal instructions! Very helpful.

    But how do i set up "Amount' to accept payments including 2 decimal points? At the moment the 'Amount' only works throught to PayPal if it is integer whole number without inavalid error?

  • Comment Link ash Thursday, 30 September 2010 01:36 posted by ash

    hey

    thank you for all the help, i figured it out finally.

  • Comment Link Nate Covington Monday, 27 September 2010 15:05 posted by Nate Covington

    Did you add the PHP code to this box in the RSForm "Script" tab?

    "Script called after form has been processed"

    It sounds like your form is set up just to send an email. You might also want to clear the "Return URL" option, if you have anything set there.

  • Comment Link ash Monday, 27 September 2010 14:59 posted by ash

    hi thank you for your response, now it does not take me to paypal, just shows that your form has been submitted. please let me know ash_kumar@yahoo.com

  • Comment Link Nate Covington Monday, 27 September 2010 13:43 posted by Nate Covington

    @Ash -

    Confirm that you are using a "Submit Button" in RSForm, and not a "Standard Button"?

  • Comment Link ash Saturday, 25 September 2010 05:02 posted by ash

    Hi

    I did exactly as you have done, but my submit button doesnt take me anywhere. could you please guide me, my e-mail is ash_kumar@yahoo.com

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.