Hi guys.
I've battered my head against a brick wall for the last couple of days with this and have managed to get it working.
I'd found little mention of what settings you need to make in the PayPal account you have attached to the VirtueMart installation, but have found that the following worked for me with the default PayPal setup in VM 1.1.4:
# Log into the PayPal account.
# Click Profile on the My Account tab.
# Click Instant Payment Notification Preferences in the Selling Preferences column.
# Click Edit IPN Settings to specify your listener’s URL and activate the listener.
# Specify the URL for your listener in the Notification URL field.
http://www.domain.com/administrator/components/com_virtuemart/notify.php# Click Receive IPN messages (Enabled) to enable your listener.
# Click Save.
# Click on My Account.
--
# Click Profile on the My Account tab.
# Click Value Added Tax.
# Delete any VAT/tax settings - the shopping cart handles tax.
# Click on My Account.
--
# Click on Profile on the My Account tab.
# Click on Website Payment Preferences.
# Click Auto Return On.
# Enter the following into the Return URL box:
http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id")
# Click Payment Data Transfer On.
# Encrypted Website Payments Off.
# PayPal Account Optional On.
# Contact Telephone Number Off.
# PayPal Express Checkout Settings No.
# Scroll down and click Save.
Back to the PayPal Payment Method Form in VirtueMart:
These are my Payment Method Settings - all default:
Payment Method Form tab:
Active?: [checked]
Payment Method Name: PayPal
Code: PP
Payment class name ps_paypal
Payment method type: HTML-Form based (e.g. PayPal)
Shopper Group: -default-
Discount: 0.00
Discount Type: Total
Maximum discount amount: 0.00
Minimum discount amount: 0.00
List Order: 0
Configuration tab:
Test mode? No
PayPal payment email:
email.address@domain.com (the one attached to your PayPal account)
Order Status for successful transactions Confirmed
Order Status for Pending Payments Pending
Accept only verified buyers? No
Order Status for failed transactions Cancelled
Payment Extra Info:
<?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" 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>';
}
?>
I hope this helps some of you guys with your IPN issues.
Cheers!
