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

PayPal IPN - My Settings Work!

Started by synaptyx, December 23, 2009, 19:30:34 PM

Previous topic - Next topic

synaptyx

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:

[url="http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db-"]http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db-[/url]>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:
QuoteActive?:     [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:
QuoteTest 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_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! :)

hotelathome

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?

Technically Blonde

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

Technically Blonde

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!

hhtmp88

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,
JMY(晉明夷)
http://mfyoga.org -- Mindfulness Yoga Association 靜觀瑜伽協會
http://yogajm.com -- YogaJM 晉明瑜伽
http://jinmy.me -- JMY 晉明日誌
http://jm3ime.com -- JinMing 3-Key Chinese Input Method 晉明三鍵輸入法

synaptyx

Quote from: hotelathome on December 24, 2009, 03:21:46 AM
Could you show screen shots of your paypal?
Sorry, I don't have the time to screen shot it all.
QuoteAlso, does your store prices include tax?
Yes, I use the tax from VirtueMart and not in PayPal
QuoteDoes your shipping include tax?
I'm not shipping product. Just downloads.
QuoteDo you use discount coupons at all?
Not as yet. Not much help there, sorry.

WebJIVE

@synaptyx
Quote from: synaptyx on December 23, 2009, 19:30:34 PM

# Enter the following into the Return URL box:

[url="http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db-"]http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db-[/url]>f("order_id")


This URL looks malformed.  Is this URL correct with the ".$db-> ?
Web Site Design, Hosting, Flash Development, ECommerce, Graphics & Logo Design and more...

stinga

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...

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.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

kylebonham

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.

stinga

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.
Stinga.
614869 products in 747 categories with 15749 products in 1 category.
                                             Document Complete   Fully Loaded
                Load Time First Byte Start Render   Time      Requests      Time      Requests
First View     2.470s     0.635s     1.276s          2.470s       31            2.470s      31
Repeat View  1.064s     0.561s     1.100s          1.064s       4             1.221s       4

kylebonham

#10
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.
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

[attachment cleanup by admin]

kylebonham

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'),

psyspi

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

QuotePayPal 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".

mus1402

Quote from: synaptyx on December 23, 2009, 19:30:34 PM
[url="http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db-"]http://www.domain.com/index.php?option=com_virtuemart&page=checkout.result&order_id=".$db-[/url]>f("order_id")

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

*take note of the close quotation mark at the end of the code
***><>*<>*<>*< DISCOVER the HIDDEN SECRET how 18yr old make thousands dollar monthly - http://tinyurl.com/HowToMakeMoneyOnFiverr >*<>*<>*<><***

mieren

I can't thank you enough for posting this Synaptyx!
This was me before I found your post (after dozens of hours of trying to figure this out and searching through all kinds of other posts): :'(
I knew nothing about the IPN, and several other things your post goes over, and everything I did was making no difference in getting my client's store to work with PayPal. You are a godsend! Now I am like this  :D
Thanks!!
Mieren