wildstock Posted February 1, 2009 Share Posted February 1, 2009 After moving the store to a different server, everything works, except when I go to place an order Paypal respond saying that the order had been paid already. My understanding this is happening because the orders# of new orders already exist on the database, so paypal does not process those orders as they appear to have been paid already. Any way to change the output order numbers so that they start with a different letter or something? Thanks. This is my third post to this forum regarding this issue, any help will be highly appreciated. Link to comment Share on other sites More sharing options...
germ Posted February 1, 2009 Share Posted February 1, 2009 This help file comes with Paypal IPN V2.2 "This invoice has already been paid" PayPal error message Background: The PayPal IPN sends a parameter "invoice" to PayPal. This parameter is equal to the order ID (1,2,3,4 etc). However, PayPal requires the invoice parameter to be unique so if you have already sent an order ID with the same number, then it will be refused. Sending the same order ID can e.g. happen if you have two osCom shops linked to one PayPal account - the PayPal account cannot distinguish between different shops / domains / databases, it just looks at the number and says "hey, that's already been paid!" There are two possible solutions: ****************************************** 1. Create a unique invoice ID for each shop this solution keeps the invoice ID check functionality but allows you to create unique IDs Description: If you have multiple shops linked to your PayPal account, then you get around this problem by adding a unique letter to your invoice parameter. As the invoice parameter can be any string (max length 127), it doesn't matter that it's not numeric. If you run several shops all with one PayPal account, then choose a different letter for each shop. Note: this solution is for coders who have a reasonable knowledge of PHP. To alter your invoice parameter: In /includes/modules/payment/paypal_ipn.php find this code: $parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1); and change to this: $parameters['invoice'] = 'K' . substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1); choose any letter but keep it to ONE letter only! In /ext/modules/payment/paypal/ipn.php just after curl_close($ch); } add $invoice_id = substr($_POST['invoice'],1); and then replace all occurrences of $_POST['invoice'] with $invoice_id (use a search / replace function if available) The above code will add the letter to the order ID when sending to PayPal and then strip it back out again with the substr command. It's vital that you replace all occurences of the variable in ipn.php as otherwise your database update won't happen or be wrong. I've tested it on my online shop and it's all working in Sandbox - I think it's a cleaner solution than just changing the order IDs to something higher as previously suggested. And it's also sustainable over time (think 10 years down the road when you have thousands of orders), plus even with just one letter you can run up to 26 different shops on one PayPal account. ****************************************** 2. Disable the inoice ID checking with this solution PayPal will not check for duplicate order IDs - a potential problem if customers e.g. hit a button twice. I'd recommend to try the first solution first, and only if that fails, try this second one: In your PayPal account, go to "Profile" - > "Payment Receiving Preferences". In there you will have the option: Block accidental payments: You may prevent accidental payments by blocking duplicate invoice IDs Yes, block multiple payments per invoice ID No, allow multiple payments per invoice ID Select "No". PayPal will now allow all orders to be paid, even if the order ID has already been paid previously. A potential problem is if customers pay an invoice twice by mistake (e.g. refreshing browser, hitting button twice etc.). I don't know if it is applicable in your situation or not. :blush: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
inefficiency Posted March 21, 2009 Share Posted March 21, 2009 I'm having a similiar prolblem with paypal. The fix above makes sense and would probably solve the problem, however the site uses Paypal Website Payments standard rather than IPN. I tried installing IPN just so that I could use that and circumvent the problem that way, but even after following the instructions to the letter, IPN gives me some nasty errors. I tried applying this fix to the website payments standard, but its totally inapplicable as the code is completely different and doesn't seem to share anything with IPN. Anyone know how to fix this problem with Paypal Website Payments Standard? Link to comment Share on other sites More sharing options...
satish Posted March 22, 2009 Share Posted March 22, 2009 Just increase Your default order id. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
inefficiency Posted March 22, 2009 Share Posted March 22, 2009 And how exactly do I do that? There are no options on the admin panel so I'm assuming its either on the paypal end or I have some php to change? You're going to need to be a bit more specific than that. Link to comment Share on other sites More sharing options...
♥geoffreywalton Posted March 22, 2009 Share Posted March 22, 2009 Search the knowledgebase, in documentation on this site, for Reset The Order ID Value Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>. Link to comment Share on other sites More sharing options...
inefficiency Posted March 22, 2009 Share Posted March 22, 2009 I thought that would have fixed it, but it didn't. I added the query to the database and got an error back saying that the table 'osc_orders' doesn't exist. Any ideas? Link to comment Share on other sites More sharing options...
inefficiency Posted March 22, 2009 Share Posted March 22, 2009 To add to that, it would appear the table I'm looking for is possibly "orders_id" rather than "osc_orders" like it says in the guide. However, I get the same error when trying to change it. I've tried finding an option in PHPMyAdmin to change the value, but I'm not getting anywhere. Link to comment Share on other sites More sharing options...
satish Posted March 23, 2009 Share Posted March 23, 2009 To add to that, it would appear the table I'm looking for is possibly "orders_id" rather than "osc_orders" like it says in the guide. However, I get the same error when trying to change it. I've tried finding an option in PHPMyAdmin to change the value, but I'm not getting anywhere. There is a contribution that can be used to set order id. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.