Welcome, Guest. Please login or register.
Login with username, password and session length


Need help or want to talk to other developers? Join the VirtueMart Chat! Read more...

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1]   Go Down
Print
Author Topic: PayPal IPN - My Settings Work!  (Read 6719 times)
synaptyx
Newbie
*
Posts: 16


« on: December 23, 2009, 12:30:34 PM »

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:

Quote
# 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:
Quote
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:
Quote
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:
Code:
<?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_total2),
"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! Smiley
Logged
hotelathome
Full Member
***
Posts: 128


« Reply #1 on: December 23, 2009, 20:21:46 PM »

Could you show screen shots of your paypal?  Also, does your store prices include tax? Does your shipping include tax? Do you use discount coupons at all?
Logged
Technically Blonde
Newbie
*
Posts: 6


« Reply #2 on: December 30, 2009, 09:14:32 AM »

I had just set up Paypal IPN according to the user manual instructions which involve only the Instant Payment Preferences. Ran a test transaction and the IPN attempt from Paypal got an http 500 error

I've worked through your list and changed some of my settings as you suggested. When I saved the Website Payment Preferences, Paypal responded with the following

"You have successfully saved your preferences. Please use the following identity token when setting up Payment Data Transfer on your website. xxxxxxxxxxxxxxxxidentity token"

I can't see anywhere on the Paypal configuration in VirtueMart where I can enter the identity token.

Any ideas please
Logged
Technically Blonde
Newbie
*
Posts: 6


« Reply #3 on: December 30, 2009, 09:44:49 AM »

Okay, please ignore my message above. My IPN errors were due to a setting on my hosting provider. I contacted them just now (instant chat) and they changed the setting immediately and hey presto, all is okay now!
Logged
hhtmp88
Full Member
***
Posts: 101


WWW
« Reply #4 on: January 06, 2010, 06:39:46 AM »

Hi all!

As a newbie to paypal, I would like to know:
1. when to use IPN?
2. and what's the differences between the normal one and IPN?

Thanks for any kind of help!
Rgds,
Logged

JMY(晉明夷)
http://mfYoga.org -- Mindfulness Yoga Association |瑜伽班 |瑜伽課程 |瑜伽訓練班 |靜坐班
http://jm3ime.com -- JinMing 3-Key Chinese Input Method 晉明三鍵輸入法
synaptyx
Newbie
*
Posts: 16


« Reply #5 on: January 27, 2010, 06:15:14 AM »

Could you show screen shots of your paypal?
Sorry, I don't have the time to screen shot it all.
Quote
Also, does your store prices include tax?
Yes, I use the tax from VirtueMart and not in PayPal
Quote
Does your shipping include tax?
I'm not shipping product. Just downloads.
Quote
Do you use discount coupons at all?
Not as yet. Not much help there, sorry.
Logged
WebJIVE
Jr. Member
**
Posts: 56

The Web Made Easy


WWW
« Reply #6 on: March 12, 2010, 09:06:38 AM »

@synaptyx

# 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")


This URL looks malformed.  Is this URL correct with the ".$db-> ?
Logged

Web Site Design, Hosting, Flash Development, ECommerce, Graphics & Logo Design and more...
stinga
Development Team
Hero Member
*
Posts: 575



WWW
« Reply #7 on: March 16, 2010, 04:26:57 AM »

G'day ,

This does not correct to me.
You should not need to hard code the return url in PP since this is passed to PP from Joomla!/VM

if the following...
Code:
http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id")
is in PP then it is not going to work, PP will not know about '$db->f("order_id")'
Again this should not need to be hard coded since this is passed to PP by Joomla!/VM

There is a rather log post on this subject and in there I have posted my PP extra info to make the data going to PP a bit more informative to the User.
Logged

Stinga.

Jabber has replaced skype for IM! See http://forum.virtuemart.net/index.php?topic=69212.0

See http://www.recovery-cd-disk.com for our live joomla! virtuemart site. It's getting better!
Our outstanding issues are...
- Inc Ex Tax on all customer facing pages.
- General reporting issues. (sales vat etc)
- Currency conversion
- Multiple images being created an product creation
kylebonham
Newbie
*
Posts: 15


« Reply #8 on: April 04, 2010, 13:30:44 PM »

Stinga while you suggest that the codes are already passed by VM to Paypal, the customer is not auto returned to the cart after payment. I want my customers auto returned so I have always had to use http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result not including the orderid.

The problem I have always had (even before using the auto return URL) is never a successful payment confirmation. I just get the error 'An error occured while processing your transaction. The status of your order could not be updated.' and then I have to manually confirm the order. That I have long sought a solution but no one has an answer. Does anyone know why this happens?

I tried enabling the IPN at Paypal but still the same result.
Logged
stinga
Development Team
Hero Member
*
Posts: 575



WWW
« Reply #9 on: April 04, 2010, 15:46:20 PM »

G'day,

Do you know where the error 'I just get the error 'An error occured while processing your transaction' comes from? is it PP or VM?
I am going to suggest VM since you no longer have the order_id on the return url, so VM does not know what order you are talking about.
I think you need to check what you are sending to PP, it does not sound like you have it setup correctly.
Logged

Stinga.

Jabber has replaced skype for IM! See http://forum.virtuemart.net/index.php?topic=69212.0

See http://www.recovery-cd-disk.com for our live joomla! virtuemart site. It's getting better!
Our outstanding issues are...
- Inc Ex Tax on all customer facing pages.
- General reporting issues. (sales vat etc)
- Currency conversion
- Multiple images being created an product creation
kylebonham
Newbie
*
Posts: 15


« Reply #10 on: April 04, 2010, 19:43:59 PM »

I have checked many times and the settings are correct. VM does know and send the proper order ID because the email invoice has the correct order detail and in my VM administration the order is there with an ID and selecting confirmed completes it.

It just seems the payment notification isn't working and all the settings there are correct. I even tried enabling Paypal's IPN system but still get the same error.

Before I enabled Paypal's auto return function, I was getting the same error messages. I just thought it was a dysfunction of the module and someone would have a fix one day.

This is the page which is returned after successful payment at Paypal.
Code:
index.php?option=com_virtuemart&page=checkout.result&order_id=25&tx=7F330320B8369300P&st=Completed&amt=0.50&cc=USD&cm=&item_number=
I note that the item_number is missing


* pp1.gif (13.7 KB, 778x402 - viewed 273 times.)

* pp2.gif (6.8 KB, 574x286 - viewed 235 times.)

* complete.gif (4.49 KB, 700x86 - viewed 232 times.)
« Last Edit: April 04, 2010, 19:56:10 PM by kylebonham » Logged
kylebonham
Newbie
*
Posts: 15


« Reply #11 on: April 06, 2010, 11:53:45 AM »

Well I now have this working and the only thing I did was to remove a linespace within the configuration script between city and zip

"zip" => $dbbt->f('zip'),

"city" => $dbbt->f('city'),
Logged
psyspi
Newbie
*
Posts: 14


« Reply #12 on: September 22, 2010, 01:49:34 AM »

I realise this is a little late, but in regards to the error "An error occured while processing your transaction. The status of your order could not be updated", please see this thread: http://forum.virtuemart.net/index.php?topic=39584.0

Quote
PayPal seems to return "Pending" very often, although the payment will be no problem. A further investigation, why the payment is still pending is not made at this time (we'll have to improve the paypal notify script to check that).
That's why you see "An error occured while processing your transaction. The status of your order could not be updated": You obviously haven't set the Order Status for pending payments to "confirmed".
Logged
mus1402
Newbie
*
Posts: 21


« Reply #13 on: April 28, 2011, 03:10:22 AM »


Is the link format you show above, correct? Shouldn't it be as below?:
http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db->f("order_id")"

*take note of the close quotation mark at the end of the code
Logged

Learn how 18yr old make thousands dollar monthly - http://bit.ly/howtomakemoneyonfiverr
Pages: [1]   Go Up
Print
Jump to: