Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

rfwoolf

Pioneers
  • Posts

    64
  • Joined

  • Last visited

Profile Information

  • Real Name
    Richard

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

rfwoolf's Achievements

  1. Hi Frank, I use eParcel and currently I manually type each order into the eParcel website and create each consignment and article. I would be interested in this. Please can you provide some details on how I could get my hands on it / test it / help etc
  2. I'm glad you came right - sorry I have been really busy these past few days. I'm glad I was of some help. What I still want to do is make it so that it sends paypal the 'INVNUM' (or the PAYMENTREQUEST_0_INVNUM in my version) so that the order number appears on the PayPal receipt. But as you know the transaction goes to PayPal during before_process, but the order on OsCommerce is only inserted AFTER that. So it would need to be rewritten that the order is inserted BEFORE, but with status 'Pending'. Then after_process the order is set to status 'Processing' or whatever. Good luck.
  3. The finall call to PayPal is in the function before_process in paypal_express.php I've got it working with the item names BUT I am using a newer version of the API than you -- I'm on 76 which you can set on this line: $this->api_version = '76.0'; so some of the parameters have a slightly different name: So for example I use the parameter "PAYMENTREQUEST_0_AMT" but in your version it is probably "AMT" I use the parameter "PAYMENTREQUEST_0_CURRENCYCODE" but in your version it is probably "CURRENCYCODE" ... PAYMENTREQUEST_0_NOTETEXT ... your version is probably "NOTETEXT" Here's the API reference but be careful - this is for the latest version (76): https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment Don't forget to say thanks if this helps you!!! :D function before_process() { global $customer_id, $order, $sendto, $ppe_token, $ppe_payerid, $HTTP_POST_VARS, $comments, $response_array; if (empty($comments)) { if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) { $comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']); $order->info['comments'] = $comments; } } $params = array('TOKEN' => $ppe_token, 'PAYERID' => $ppe_payerid, 'PAYMENTREQUEST_0_AMT' => $this->format_raw($order->info['total']), 'PAYMENTREQUEST_0_CURRENCYCODE' => $order->info['currency'], 'PAYMENTREQUEST_0_NOTETEXT' => $order->info['comments'], 'SHIPPINGOPTIONNAME' => $order->info['shipping_method'], 'SHIPPINGOPTIONAMOUNT' => $this->format_raw($order->info['shipping_cost']) ); $line_item_no = 0; $items_total = 0; $tax_total = 0; foreach ($order->products as $product) { $params['L_PAYMENTREQUEST_0_NAME' . $line_item_no] = $product['name']; //DESC $params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no] = ''; for ($j=0, $o=sizeof($product['attributes']); $j<$o; $j++) { $params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no] .= $product['attributes'][$j]['option'] . ':' . $product['attributes'][$j]['value'] . ', '; } //take off comma at end $params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no] = substr($params['L_PAYMENTREQUEST_' . '0' . '_' . 'DESC' . $line_item_no],0,-2); $params['L_PAYMENTREQUEST_0_AMT' . $line_item_no] = $this->format_raw($product['final_price']); $params['L_PAYMENTREQUEST_0_NUMBER' . $line_item_no] = $product['id']; $params['L_PAYMENTREQUEST_0_QTY' . $line_item_no] = $product['qty']; $product_tax = tep_calculate_tax($product['final_price'], $product['tax']); $params['L_PAYMENTREQUEST_0_TAXAMT' . $line_item_no] = $this->format_raw($product_tax); $tax_total += $this->format_raw($product_tax) * $product['qty']; $items_total += $this->format_raw($product['final_price']) * $product['qty']; $line_item_no++; } $params['PAYMENTREQUEST_0_ITEMAMT'] = $this->format_raw($order->info['subtotal']);//$items_total; $params['PAYMENTREQUEST_0_SHIPPINGAMT'] = $this->format_raw($order->info['shipping_cost']);//$items_total; $params['PAYMENTREQUEST_0_TAXAMT'] = $this->format_raw($order->info['tax']); if (is_numeric($sendto) && ($sendto > 0)) { $params['PAYMENTREQUEST_0_SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname']; $params['PAYMENTREQUEST_0_SHIPTOSTREET'] = $order->delivery['street_address']; $params['PAYMENTREQUEST_0_SHIPTOCITY'] = $order->delivery['city']; $params['PAYMENTREQUEST_0_SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']); $params['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2']; $params['PAYMENTREQUEST_0_SHIPTOZIP'] = $order->delivery['postcode']; } //debug email tep_mail('Your name', '[email protected]', 'calling doExpressCheckoutPayment!', print_r($params, true) . '...' . print_r($order, true), 'from Name', '[email protected]'); $response_array = $this->doExpressCheckoutPayment($params); if (($response_array['ACK'] != 'Success') && ($response_array['ACK'] != 'SuccessWithWarning')) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, 'error_message=' . stripslashes($response_array['L_LONGMESSAGE0']), 'SSL')); } }
  4. Indeed it doesn't include the items in the final submission ("before_process" in includes/modules/payment/paypal_express.php) to PayPal. It includes the final amount and the final shipping address in case it's changed - but no line items. I think because the logic is you pass it the first time you talk to PayPal, and then when the user confirms on your site, it contacts PayPal again with just the token of the transaction and says "Do that transaction and this is the final amount and the shipping address". there is however, absolutely nothing wrong with providing the line items AGAIN and that's what I do. The line items will be provided in ext/modules/payment/paypal/express.php with these lines: foreach ($order->products as $product) { $params['L_NAME' . $line_item_no] = $product['name']; $params['L_AMT' . $line_item_no] = $paypal_express->format_raw($product['final_price']); $params['L_NUMBER' . $line_item_no] = $product['id']; $params['L_QTY' . $line_item_no] = $product['qty']; $product_tax = tep_calculate_tax($product['final_price'], $product['tax']); $params['L_TAXAMT' . $line_item_no] = $paypal_express->format_raw($product_tax); $tax_total += $paypal_express->format_raw($product_tax) * $product['qty']; $items_total += $paypal_express->format_raw($product['final_price']) * $product['qty']; $line_item_no++; } $params['ITEMAMT'] = $items_total; $params['TAXAMT'] = $tax_total; Put the above lines in includes/modules/payment/paypal_express.php in the before_process procedure, AFTER these lines: if (is_numeric($sendto) && ($sendto > 0)) { $params['SHIPTONAME'] = $order->delivery['firstname'] . ' ' . $order->delivery['lastname']; $params['SHIPTOSTREET'] = $order->delivery['street_address']; $params['SHIPTOCITY'] = $order->delivery['city']; $params['SHIPTOSTATE'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], $order->delivery['state']); $params['SHIPTOCOUNTRYCODE'] = $order->delivery['country']['iso_code_2']; $params['SHIPTOZIP'] = $order->delivery['postcode']; } but please note that this is untested and you should make backups and you may have to do some debugging.
  5. Please do me a favour and show me the link to version 1.2??????
  6. Holy Crap! I just disabled cookies in Firefox and now I see it forgets my cart! Damn - I wish I knew about this sooner - I was wondering why some people weren't checking out!!!!!!!!! Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!Aurghh!
  7. Thanks for the reply - but I don't believe you - just recently I hacked the crap out of paypal_express.php and as soon as PayPal sent back the customer's address I got OsCommerce to insert the order directly into the database, add a customer, generate a random 15-digit password, and add his default delivery address. If I enable IPN in my PayPal profile, in theory, after any eBay customer pays me, PayPal will send a POST transaction to my IPN url -- all I have to do is edit my IPN file in OscOmmerce and get it to do the same.. ..I'm just REALLY surprised that nobody has done this before me? But what if you're right? Can you tell me about this 'OscID' requirement?
  8. I can't seem to find any information on this. Basically when someone buys one of our products on eBay, I want it to appear as an OsCommerce order in my Admin. That way, we can find all our orders "in one place". Right now we have to check our emails for eBay orders AND our Oscommerce admin. I'm sure that the PayPal IPN is the way to do this - in theory it should get called every time you get a payment from eBay (as long as it is enabled in the PayPal profile) - so are there any contribs for the IPN file to do this? Thanks
  9. Okay here's some help. Edit your file /ext/modules/payment/paypal/express.php Find this code: default: if (MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_SERVER == 'Live') { $paypal_url = 'https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout'; } else { $paypal_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout'; } include(DIR_WS_CLASSES . 'order.php'); $order = new order; $params = array( Basically everything in the $params code needs to comply with this API reference: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout Unfortunately the one our version uses is an OLD deprecated version of the API... Thus you will probably have to do quite a bit of rewriting, but this should start: for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { $params['L_NAME' . $i] = $order->products[$i]['name']; $params['L_NUMBER' . $i] = $order->products[$i]['model']; //To put a description you use this param: // 'L_DESC' . $i' => 'Size: 8.8-oz', //But I like to put all my attributes in the description, like this: $params['L_DESC' . $i] = ''; for ($j=0, $o=sizeof($order->products[$i]['attributes']); $j<$o; $j++) { $params['L_DESC' . $i] .= $order->products[$i]['attributes'][$j]['option'] . ':' . $order->products[$i]['attributes'][$j]['value'] . ', '; } $params['L_AMT' . $i] = $paypal_express->format_raw($order->products[$i]['final_price']); $params['L_QTY' . $i] = $order->products[$i]['qty']; }; Of course you should properly look at that API reference I sent you and do it properly :) You can contact me for some help. If you do try and check against the API, note that SetExpressCheckout API is actually called in \includes\modules\payment\paypal_express.php which provides these paremeters for the SetExpressCheckout call: 'USER' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_USERNAME ,'PWD' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_PASSWORD ,'VERSION' => '74.0' ,'SIGNATURE' => MODULE_PAYMENT_PAYPAL_EXPRESS_API_SIGNATURE ,'METHOD' => 'SetExpressCheckout' ,'RETURNURL' => tep_href_link('ext/modules/payment/paypal/express.php', 'osC_Action=retrieve', 'SSL', true, false) ,'CANCELURL' => tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL', true, false) ,'PAYMENTACTION' => ((MODULE_PAYMENT_PAYPAL_EXPRESS_TRANSACTION_METHOD == 'Sale') ? 'Sale' : 'Authorization') In other words, don't put the above variables in /ext/modules/payment/paypal/express.php
  10. What is the actual PayPal payment module you are using? As you may know OsCommerce comes with 4 or 5 like PayPal Express, IPN, Payment Standard, then UK and US versions... Anyway, what I would do is find out which module is being called. Try and find the array that gets sent to PayPal and EMAIL it to yourself. Here's a command that will work on most pages: tep_mail('Your Name', '[email protected]', 'PayPal submission', print_r($params, true), 'Your website name', '[email protected]'); Just replace $params with whatever variable it is using -- in my case it was $params but it might be $parameters or something else. If you get this right, it will email you the stuff it's sending PayPal. You might see an obvious error, but if not you'll need to check the API requirements for that particular API call - it may require a particular format. For example, in PayPal Express Checkout, it calls SetExpressCheckout and that API is documented here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout Good luck
  11. I was also very confused about this and spent hours researching and testing different modules. Part of the trouble is that I'm using OsCommerce 2.2a rc -- so in my mind, just because my 'express' addon isn't working properly doesn't mean that future versions aren't. But I did a lot of investigation and here's what I discovered... The PayPal Express module that's installed was based on the PayPal API version 3.x (we are now on version 76!!!) -- that was long ago, probably around 2008 when the PayPal API was pretty basic and useless -- there was probably no way to pass a customer to PayPal with shipping options - so the osCommerce developers probably just didn't make it do it. Instead merchants like ourselves were probably expected to set Shipping Settings inside their PayPal profiles. The version of PayPal express I was using was so bad, it didn't even list the shopping cart contents to PayPal -- PayPal only received the total amount!!! The good news is that we are now on version 76 and there's a lot more options: 1. You can provide shipping options at the time of checkout -- the customer clicks "[Checkout with PayPal Express]" button and it will forward the cart items and the shipping option(s) to PayPal. If you provide more than 1 shipping option, the customer will get to choose! 2. There is now a 'callback' / 'instant update' function which does this: After the customer is forwarded to PayPal, after they log in, it will forward their shipping address to YOUR 'callback server', which takes the address, calculates shipping options, SENDS the shipping options BACK to PayPal, which will then show the user the shipping options - that's a lot of work and I haven't written that yet... Unfortunately there's quite a bit of work to get that old version of PayPal express to do what we want. I have made it do option 1. You can email / pm me if you want some help. I'm on rfwoolf at g mail dot com. You can refer to some references files here: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout and https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_DoExpressCheckoutPayment 1. Basically, when the user clicks on the "PayPal Express Checkout" button on your website, the website submits a 'SetExpressCheckout' command to PayPal which (in my standard version) just submitted the total amount to PayPal, but in my rewritten version, using the API link above, I have gotten it to submit all the shopping cart items and shipping options. 2. The user signs in to PayPal and if I provided more than 1 shipping option they will get to choose it, 3. they then return to the OsCommerce website to the 'Confirmation' page. If they confirm the payment, that's when... 4. the website submits a 'DoExpressCheckoutPayment' command to PayPal for the 'final' amount. So, if you read this very carefully, you could hypothetically just provide shipping options when the user returns to your website (step 3). In other words in step 1 you pass the total amount EXCLUDING shipping - exactly like it is now!!! the customer will 'approve' this amount and return to your website for confirmation (step 3) -- that's when you're allowed to INCREASE the amount to include shipping. That can work perfectly for many people. OR In Step 1 you can pass through some shipping option(s). But this can be a problem if the customer has a special address in PayPal. What if you thought they were going to ship to say, London, but they log in and their PayPal address is China (for example)? That's why the first option is better -- or a 'callback' option. I hope some of this helps
  12. I have some experience with the PayPal API, I might have been able to answer your question but sorry your question isn't very clear. Please rephrase.
  13. correction: stubbsy you have added two }'s which prevents any compile errors, but this doesn't solve the problem. I wonder if it's a version thing - I am using 2.2rc2a e
  14. 1. For sandbox I think your callback server doesn't have to be HTTPS URL, But on the live it has to be HTTPS URL. I think to do HTTPS URL, your host may have shared SSL, or you may have to buy an SSL certificate.
  15. I'm a developer... Here's what I'm trying to do... 1. The user has added $50 products to their cart. 2. In the shopping cart I will have my PayPal Express Checkout button. User clicks... 3. User logs into PayPal and confirms their Shipping Address 4. User returns to my website (it currently takes them to the confirmation page). Could I then, in theory get them to choose their shipping method, EXAMPLE: Regular Shipping: $5 Express Shipping: $10 Now the order amount is $60!! Will PayPal process the transaction for $60, but the first time it was $50? Thanks :)
×
×
  • Create New...