News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

What is the best way for signing up and config Paypal?

Started by Dog_Guy, June 03, 2011, 06:29:03 AM

Previous topic - Next topic

Dog_Guy

Hi,

yes another newbie Q, I see that there are a lot of issues people are having with paypal here, but since it is the most universal method of payment - and I am in Australia, I am wondering if anyone has any advice on how to set up a paypal account and any pitfalls to avoid?

Cheers,   bruce
You can buy healthy dog treats from either of my sites: http://www.dogwalkersmelbourne.com.au/ or http://www.healthydogtreats.com.au/

Acceleral

Hi Bruce,

Sorry for the late reply, but having just set up PayPal for a site I can confirm that it's not that at all difficult though I'll admit to some assistance for the final tweaking of the interface.

So, is this your shop or are you building it for a merchant?  Either way...

Step 1) is to create a PayPal merchant account.  This is basically where all the money goes from a PayPal purchase.  PayPal requires a LOT of detail regarding bank accounts and corporate details so it is not something you can do on behalf of a merchant.

Step 2) is to enable PayPal as a/the payment option.  You've not noted your VM skill level so I'll assume moderate in which case you'll already know about the VM Store "List Payment Methods" configuration that gets you to the PayPal interface.  For my VM install there are two PayPal options - you want the 'PayPal' one, not the 'PayPal (old Version)' one (refer to the attached screen grab for this).

Step 3) is to click into PayPal and confirm that the 'Payment Method Form' details are correct.  I'm not using discounts so it's pretty easy:

Active?:    <tick>
Payment Method Name:    PayPal
Code:    PP
Payment class name     ps_paypal
Payment method type:    HTML-Form based (e.g. PayPal)


And there's a screen capture for this as well.

Step 4) is the slightly tricky part.  First up, you'll need the merchant's PayPal email address as that ties the payments to their account (you'll note in my screen grab that it's blank) which you enter into the "PayPal payment email:" field.  I use these values for the other options:

Test mode ?       No
PayPal payment email:       xx@yy.zz
Order Status for successful transactions       Confirmed
Order Status for Pending Payments       Pending
Accept only verified buyers?       No
Order Status for failed transactions       Cancelled


Now for the only tricky bit.  For some reason the 'Payment Extra Info:' in my shop was missing (and that was probably self-inflicted) but big thanks to Steve at SP Connected who provided this code and it works a treat:

<?php
$db1 = new ps_DB();
$q = "SELECT country_2_code FROM #__vm_country WHERE country_3_code='".$user->country."' ORDER BY country_2_code ASC";
$db1->query($q);

$url = "https://www.paypal.com/cgi-bin/webscr";
$tax_total = $db->f("order_tax") + $db->f("order_shipping_tax");
$discount_total = $db->f("coupon_discount") + $db->f("order_discount");
$post_variables = Array(
"cmd" => "_ext-enter",
"redirect_cmd" => "_xclick",
"upload" => "1",
"business" => PAYPAL_EMAIL,
"receiver_email" => PAYPAL_EMAIL,
"item_name" => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER').": ". $db->f("order_id"),
"order_id" => $db->f("order_id"),
"invoice" => $db->f("order_number"),
"amount" => round( $db->f("order_subtotal")+$tax_total-$discount_total, 2),
"shipping" => sprintf("%.2f", $db->f("order_shipping")),
"currency_code" => $_SESSION['vendor_currency'],

"address_override" => "1",
"first_name" => $dbbt->f('first_name'),
"last_name" => $dbbt->f('last_name'),
"address1" => $dbbt->f('address_1'),
"address2" => $dbbt->f('address_2'),
"zip" => $dbbt->f('zip'),
"city" => $dbbt->f('city'),
"state" => $dbbt->f('state'),
"country" => $db1->f('country_2_code'),
"email" => $dbbt->f('user_email'),
"night_phone_b" => $dbbt->f('phone_1'),
"cpp_header_image" => $vendor_image_url,

"return" => SECUREURL ."index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id"),
"notify_url" => SECUREURL ."administrator/components/com_virtuemart/notify.php",
"cancel_return" => SECUREURL ."index.php",
"undefined_quantity" => "0",

"test_ipn" => PAYPAL_DEBUG,
"pal" => "NRUBJXESJTY24",
"no_shipping" => "1",
"no_note" => "1"
);
if( $page == "checkout.thankyou" ) {
$query_string = "?";
foreach( $post_variables as $name => $value ) {
$query_string .= $name. "=" . urlencode($value) ."&";
}
vmRedirect( $url . $query_string );
} else {
echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/x-click-but6.gif" border="0" alt="Click to pay with PayPal - it is fast, free and secure!" />';

foreach( $post_variables as $name => $value ) {
echo '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'" />';
}
echo '</form>';

}
?>


Save such a configuration and using PayPal at the checkout is straightforward.

Regards, Michael

[attachment cleanup by admin]

quiggles

Michael

Thanks for this!  I wasnt the OP, but you have just saved me a whole bunch of time trying to work this out!

Where did you find that HTML as that was what I was missing to make this work!

Cheers!

Gary  ;D

sr.lavecchia

Well this was very helpful for the paypal issue, but now I am trying to get shipping and handling to be added to the prices before they make a purchase.. Any suggestions? :o

Acceleral

Quote from: quiggles on July 21, 2011, 12:04:42 PM
Michael

Thanks for this!  I wasnt the OP, but you have just saved me a whole bunch of time trying to work this out!

Where did you find that HTML as that was what I was missing to make this work!

Cheers!

Gary  ;D

Sorry for the delay replying Gary, I've been travelling but we can thank Steve Pullen (http://spconnected.com.au/) for that PayPal HTML.  Steve's not just a whiz who is now surfing the next wave, using Magneto for online stores, but all around nice guy who does great work!