Paypal Recurring Payments in VirtueMart
April 7, 2008 by OctavTo create a new Paypal Recurring Payment Method in VirtueMart, login to Joomla’s backend, go to Components -> VirtueMart.
Locate the “Store” menu and click the “List Payment Methods” submenu. Click the “New” button in the top right toolbar to create a new payment method.
In the “Payment Method Form” check the Active? checkbox, give “Payment Method Name:” a name (eg: PayPal Monthly (Recurring) Payments) and a code (eg: PPR).
The “Payment class name” should be ps_paypal and click the “PayPal (or related)” radiobox. Click the Save button in the top right toolbar. Click on the new payment method you just defined and go to the Configuration tab.
In the Configuration tab, setup this values:
- Test Mode ? -> No
- PayPal payment email: -> your email
- 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
$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-subscriptions”,
“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”),
“a3″ => round( $db->f(”order_subtotal”)+$tax_total-$discount_total, 2),
“shipping” => sprintf(”%.2f”, $db->f(”order_shipping”)),
“currency_code” => $_SESSION[’vendor_currency’],”first_name” => $dbbt->f(’first_name’),
“last_name” => $dbbt->f(’last_name’),
“address_street” => $dbbt->f(’address_1′),
“address_zip” => $dbbt->f(’zip’),
“address_city” => $dbbt->f(’city’),
“address_state” => $dbbt->f(’state’),
“address_country” => $dbbt->f(’country’),
“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″,
“bn” => “PP-SubscriptionsBF”,
“lc” => “US”,
“p3″ => “1″,
“t3″ => “M”,
“src” => “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” mce_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>’;
}
?>
Click Save.

You must be logged in to post a comment.