URL: http://www.uburst.com/cgi-bin/dcforum/dcboard.cgi
Forum: ushop_prog_tips
Thread Number: 123
[ Go back to previous page ]

Original Message
"Proposed Paypal Solution - Working!!!"

Posted by Brian Levine [blevine@cfl.rr.com] on at 10:34 AM
Okay, with a little effort, I managed to get this working, using the Custom Payment option. In order to get this working, I had to modify the following:

order_template.html
ushop.pl

(Note that for this example, I have to strip out brackets so that HTML tags show up.)

order_template.html changes:

For some reason, I cannot embed by paypal button inside the FORM block on the page (and I still don't understand why), so I had to create a new replacement string just above the FORM tag:

!-- The following tag will be replaced at runtime. --
PAYPAL BUTTON

FORM

(of course, remember those brackets in your code)

ushop.pl changes:

Just past the upshop instructions replacement section, I added the following:

# Replace the PAYPAL BUTTON.
if (($payment_method eq "custom_payment") && ($settings[52] =~ /yes/i))
{
$order_total = sprintf("%.2f", $totals_total);
$paypal_site = "https://www.paypal.com/cgi-bin/webscr";
$paypal_button = "FORM ACTION=\"" . $paypal_site . "\" METHOD=\"POST\"";
$paypal_button .= "INPUT TYPE=\"hidden\" NAME=\"cmd\" VALUE=\"_xclick\"";
$paypal_button .= "INPUT TYPE=\"hidden\" NAME=\"business\" VALUE=\"paypal\@mystore.com\"";
$paypal_button .= "INPUT TYPE=\"hidden\" NAME=\"item_name\" VALUE=\"My Store Order Total\"";
$paypal_button .= "INPUT TYPE=\"hidden\" NAME=\"item_number\" VALUE=\"$order_number\"";
$paypal_button .= "INPUT TYPE=\"hidden\" NAME=\"amount\" VALUE=\"$order_total\"";
$paypal_button .= "INPUT TYPE=\"image\" src=\"http://images.paypal.com/images/x-click-but01.gif\" border=\"0\" NAME=\"submit\" ALT=\"Click to Pay using Paypal\"";
$paypal_button .= "/FORM";
}
$order_form_html =~ s/PAYPAL BUTTON/$paypal_button/g;

Again, remember that I had to remove all of the brackets in order for this to display.

The end result of all of this is that this method displays a button at the top of the Receipts page that links to the Paypal payment login page, passing my paypal id, the order number and the order total. The customer need only log in and accept the sending of the payment.

I will make the actual code available (with brackets) to anyone that wants it.


Table of contents

Messages in this discussion
"RE: Proposed Paypal Solution - Working!!!"
Posted by Bill Weiner on at 01:01 PM
Great! Glad you go it working.

"paypal solution"
Posted by rich [rpoteat@onebox.com] on at 02:46 PM
would you please send me a copy of the actual code (with brackets)?

i'm working on a major update to my company's website, and this may be the key i need to convince him to purchase ushop.

thanks,
rich


"RE: paypal solution"
Posted by Bill Weiner on at 04:23 AM
We listed Brian's solution in our 3rd Party Developer's Corner:

http://www.uburst.com/uShop/developers.html

(See the 8/20/2002 Posting)