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.

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

Last modified on Wednesday, 20 April 2022 18:36
Comments (7)
This comment was minimized by the moderator on the site

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

ash
This comment was minimized by the moderator on the site

@Ash -

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

Nate Covington
This comment was minimized by the moderator on the site

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

ash
This comment was minimized by the moderator on the site

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...

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.

More
Nate Covington
This comment was minimized by the moderator on the site

hey

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

ash
This comment was minimized by the moderator on the site

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...

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?

More
mike
This comment was minimized by the moderator on the site

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?

Nate Covington
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Suggested Locations

Latest Comments

Got a similar email that seemed suspicious. Ignored it and they even followed up today.
My organization received one of these emails from "Linda," but uses https://www.bestprosintown.com/p...
Hi Nate, I got the same email template from the same email address today and found you through a ...
Just received one today (16 Aug 2022) from "Mailchimp". Thanks for sharing!
Thanks for posting this. I just got one today. I was 99% sure it was a scam, and your post confirmed...


Design & Development

Wordpress, Drupal, Joomla
New custom websites
Bespoke themes and extensions
Redesigns, upgrades, migrations

Web Design & Development


Optimization & SEO

Let us optimize and manage your overall online presence. We offer full service monthly SEO as well as one-time projects.  

Optimization Plans & Pricing


Maintenance, Patching

White glove monthly backups, security updates, maintenance and testing for your Wordpress, Drupal, or Joomla site.

Maintenance Plans & Pricing


Email Newsletter

Bring your web & marketing performance to the next level: monthly blog post roundup via email.  

Stay in Touch!