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 4291 times Last modified on Thursday, 07 October 2010 17:44
Comments  
0 #7 Nate Covington 2010-10-06 11:26
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?
Quote
0 #6 mike 2010-10-06 11:18
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?
Quote
0 #5 ash 2010-09-30 01:36
hey

thank you for all the help, i figured it out finally.
Quote
0 #4 Nate Covington 2010-09-27 15:05
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.
Quote
0 #3 ash 2010-09-27 14:59
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
Quote
0 #2 Nate Covington 2010-09-27 13:43
@Ash -

Confirm that you are using a "Submit Button" in RSForm, and not a "Standard Button"?
Quote
0 #1 ash 2010-09-25 05:02
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
Quote
Add comment