News:

Looking for documentation? Take a look on our wiki

Main Menu

New PayPal Module Configuration For Express Check Out!

Started by ElAbuelo, February 18, 2006, 00:43:17 AM

Previous topic - Next topic

ElAbuelo

Integration of VirtueMart with Website Payments Standard of PayPal (Old Pay Flow Link)

Hi Pay Flow Link is now a PayPal Business!

Since Verisign got merged with PayPal  now if you go to PayPal open a Free business account (or if you already have one) then go to "Frofile" then under "Selling Preferences" you will find lot of customizable things for the old payflow link. The great thing is that before for your customers to pay with paypal they were required to have an account with Paypal but since now NO MORE! if you set up the Express Check Out they will show first the Option to Process credit cards without having a PayPal account or choose to enter your user and pass if you have one.

    Now Pay with credit card first, without the need of a paypal account!
    Plus customize your paypal secure page transaction with your logo and IPN integration with
    VirtueMart. (notify.php)


Now The Problem is that we need to change the configuration on the Paypal Module listed in the builded payment modules of the latest virtuemart 1.0.2.

https://www.paypal.com/us/cgi-bin/webscr?cmd=_merchant&login_access=1140217384

Go to list payment modules in virtuemart
go to PayPal moudule click on Configuration and you will see this script: (by default)

<?php
$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" => "_xclick",
"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'],
"image_url" => $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) ."&";
}
mosRedirect( $url . $query_string );
} else {

echo '<form action="'.$url.'" method="post" target="_blank">';
echo '<input type="image" name="submit" src="http://images.paypal.com/images/x-click-but6.gif" border="0" alt="Make payments with PayPal, it is fast, free, and secure!">';

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

echo '</form>';

}
?>

-----------------------------------------------------------------------

And the modifications are listede here:

https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/howto_checkout

but the only modifications that activate the settings that you changed in your paypal account as preferences as your logo on the top color on the background and more variables that you can add is the proccess that add multiple items to the paypal check out This option goes over the old one where you only see the checkout price passed by virtuemart as the total ammount.

https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/howto_checkout#methodtwo


Once you change those variables below it works and start showing you another check out look :


# Set the "cmd" variable to "_cart"
Replace this required HTML line

<input type="hidden" name="cmd" value="_xclick">

with

<input type="hidden" name="cmd" value="_cart">

# Add a new variable called "upload"

Add the following line between the <form> and </form> tags:

<input type="hidden" name="upload" value="1">


But the big problem to solve is that the chopping cart from paypal shows like empty!

Please We need someone to understand more about virtuemart and make a little touch on the paypal configuration code to be able to pass those variables of every item and every ammount to the cart in the customized page of paypal.(old pay flow link)



Take a look below for some intructions:

Method 2. Passing Individual Items to PayPal


If your 3rd party shopping cart can be configured to pass individual items to PayPal, information about the items will be included in the buyers' and sellers' History logs and notifications. To include information about the items, you will post HTML form elements to a new version of PayPal's Shopping Cart flow. This process is much like the one described in Section #1 "Passing Aggregate Cart Amount to PayPal" with the following exceptions:

   1. Set the "cmd" variable to "_cart"
      Replace this required HTML line

      <input type="hidden" name="cmd" value="_xclick">

      with

      <input type="hidden" name="cmd" value="_cart">

   2. Add a new variable called "upload"

      Add the following line between the <form> and </form> tags:

      <input type="hidden" name="upload" value="1">

   3. Define item details
      For each of the following item-specific parameters, define a new set of values that correspond to each item that was purchased via your 3rd party cart. Append "_x" to the variable name, where x is the item number, starting with 1 and increasing by one for each item that is added.

      Name    Value
      item_name_x    (Required for item #x) Name of item #x in the cart. Must be alpha-numeric, with a 127 character limit
      item_number_x    Optional pass-through variable associated with item #x in the cart. Must be alpha-numeric, with a 127 character limit
      amount_x    (Required for item #x) Price of the item #x
      shipping_x    The cost of shipping the first piece (quantity of 1) of item #x
      shipping2_x    The cost of shipping each additional piece (quantity of 2 or above) of item #x
      handling_x    The cost of handling for item #x
      on0_x    First option field name for item #x. 64 character limit
      os0_x    First set of option value(s) for item #x. 200 character limit. "on0_x" must be defined in order for "os0_x" to be recognized.
      on1_x    Second option field name for item #x. 64 character limit
      os1_x    Second set of option value(s) for item #x. 200 character limit. "on1_x" must be defined in order for "os1_x" to be recognized.

   4. Repeat for each item included in cart
      Include a set of required variables and any optional variables from the table above for each item included in your buyers' cart. The first item included in the cart should be defined with parameters ending in "_1", such as "item_name_1", "amount_1", etc. Similarly the second item should be denoted with variables like "item_name_2", "amount_2", etc. Note: the "_x" values must increment by one continuously in order to be recognized. If you skip from item #1 to item #3 without defining an item #2, the third item will be ignored.

      To specify currency: All monetary variables (amount, shipping, shipping2, handling, tax) will be interpreted in the currency designated by the "currency_code" variable that is posted with the payment. Since it is not item-specific, there is no need to append a "_x" to the variable name. If no "currency_code" variable is posted, we will assume that all monetary values are in U.S. Dollars.

jdaustin

I see many confusing hack this, hack that sort of directions.
Has anyone got this worked this out as an installable module?

kyletaz

Quote from: jdaustin on July 31, 2006, 21:55:35 PM
I see many confusing hack this, hack that sort of directions.
Has anyone got this worked this out as an installable module?


I'm wondering about this myself.

Anthony G

my paypal module will not pass the total. it ask the user to fill in the "Unit Price"

how do i fix that?