Christopher Short Posted April 2, 2020 Share Posted April 2, 2020 Paypal is not updating orders to processing when payment is taken. I have the following errors in teh request log: Request Sent (cURL) - https://api.paypal.com/v1/notifications/verify-webhook-signature{ "transmission_id": "", "transmission_time": "", "cert_url": "", "auth_algo": "", "transmission_sig": "", "webhook_id": "5C1*********5061K", "webhook_event": } Error:cURL Error (22): The requested URL returned error: 400 Bad Request Response received (400 - Bad Request) AND Request Sent (cURL) - https://api.paypal.com/v1/notifications/verify-webhook-signature{ "transmission_id": "", "transmission_time": "", "cert_url": "", "auth_algo": "", "transmission_sig": "", "webhook_id": "5C1*********5061K", "webhook_event": {"id":"WH-47758388RA227191U-9MN331091M545191N","event_version":"1.0","create_time":"2020-04-02T16:33:29.133Z","resource_type":"checkout-order","resource_version":"2.0","event_type":"CHECKOUT.ORDER.APPROVED","summary":"An order has been approved by buyer","resource":{"create_time":"2020-04-02T16:32:04Z","purchase_units":[{"reference_id":"5e86125615b82","amount":{"currency_code":"USD","value":"26.70","breakdown":{"item_total":{"currency_code":"USD","value":"16.80"},"shipping":{"currency_code":"USD","value":"9.90"},"tax_total":{"currency_code":"USD","value":"0.00"}}},"payee":{"email_address":"[email protected]","merchant_id":"Removed","display_data":{"brand_name":"Chris' Rocket Supplies, LLC"}},"description":"Payment for order 200402-123150-1708","invoice_id":"200402-123150-1708","items":[{"name":"3.9" Stiffener Loc Coupler","unit_amount":{"currency_code":"USD","value":"8.40"},"quantity":"2","description":"Stiffy heavy duty tube coupler stiffiners feature a deep spirsl groove for maximum epoxy adhesion. These super heavy duty wall ","sku":"2677","category":"PHYSICAL_GOODS"}],"shipping":{"name":{"full_name":"Removed"},"address":{"address_line_1":"Removed.","admin_area_2":"Burlington","admin_area_1":"NC","postal_code":"27217","country_code":"US"}}}],"links":[{"href":"https://api.paypal.com/v2/checkout/orders/5FM09051FM814090D","rel":"self","method":"GET"},{"href":"https://api.paypal.com/v2/checkout/orders/5FM09051FM814090D/authorize","rel":"authorize","method":"POST"}],"id":"5FM09051FM814090D","intent":"AUTHORIZE","payer":{"name":{"given_name":"Removed","surname":"Removed"},"email_address":"Removed","payer_id":"ZJY3KXEUXX2EN","phone":{"phone_type":"HOME","phone_number":{"national_number":"Removed"}},"address":{"country_code":"US"}},"status":"APPROVED"},"links":[{"href":"https://api.paypal.com/v1/notifications/webhooks-events/WH-47758388RA227191U-9MN331091M545191N","rel":"self","method":"GET"},{"href":"https://api.paypal.com/v1/notifications/webhooks-events/WH-47758388RA227191U-9MN331091M545191N/resend","rel":"resend","method":"POST"}]} } Error:cURL Error (22): The requested URL returned error: 400 Bad Request Response received (400 - Bad Request) Link to comment Share on other sites More sharing options...
Christopher Short Posted April 2, 2020 Author Share Posted April 2, 2020 When I processed the payment from authorization to complete the capture, this shows up: Request Sent (cURL) - https://api.paypal.com/v1/notifications/verify-webhook-signature{ "transmission_id": "", "transmission_time": "", "cert_url": "", "auth_algo": "", "transmission_sig": "", "webhook_id": "5C1*********5061K", "webhook_event": {"id":"WH-0AN50389EV9292537-7F3625689V4044721","event_version":"1.0","create_time":"2020-04-02T23:40:57.481Z","resource_type":"capture","resource_version":"2.0","event_type":"PAYMENT.CAPTURE.COMPLETED","summary":"Payment completed for $ 26.7 USD","resource":{"id":"1VX918509F1171349","amount":{"currency_code":"USD","value":"26.70"},"final_capture":true,"seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"seller_receivable_breakdown":{"gross_amount":{"currency_code":"USD","value":"26.70"},"paypal_fee":{"currency_code":"USD","value":"1.05"},"net_amount":{"currency_code":"USD","value":"25.65"}},"invoice_id":"200402-123150-1708","status":"COMPLETED","create_time":"2020-04-02T23:40:52Z","update_time":"2020-04-02T23:40:52Z","links":[{"href":"https://api.paypal.com/v2/payments/captures/1VX918509F1171349","rel":"self","method":"GET"},{"href":"https://api.paypal.com/v2/payments/captures/1VX918509F1171349/refund","rel":"refund","method":"POST"},{"href":"https://api.paypal.com/v2/payments/authorizations/71T756883N7421258","rel":"up","method":"GET"}]},"links":[{"href":"https://api.paypal.com/v1/notifications/webhooks-events/WH-0AN50389EV9292537-7F3625689V4044721","rel":"self","method":"GET"},{"href":"https://api.paypal.com/v1/notifications/webhooks-events/WH-0AN50389EV9292537-7F3625689V4044721/resend","rel":"resend","method":"POST"}]} } Error:cURL Error (22): The requested URL returned error: 400 Bad Request Response received (400 - Bad Request) Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 3, 2020 Share Posted April 3, 2020 Are you using the latest version of the extension. This issue was common on some hosting environments where the response headers couldn't be detected. It should work on the most recent version. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 3, 2020 Author Share Posted April 3, 2020 4 hours ago, Al Brookbanks said: Are you using the latest version of the extension. This issue was common on some hosting environments where the response headers couldn't be detected. It should work on the most recent version. Yes, just updated a week or so ago and this started right after. I never had the issue prior to the update. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 3, 2020 Author Share Posted April 3, 2020 11 hours ago, Al Brookbanks said: Are you using the latest version of the extension. This issue was common on some hosting environments where the response headers couldn't be detected. It should work on the most recent version. I should clarify, i updated to the newest paypal module as well, from the standard to this new method. I have the .13 release and it os doing this on 100% of my orders Link to comment Share on other sites More sharing options...
Christopher Short Posted April 4, 2020 Author Share Posted April 4, 2020 This is what shows under transaction logs but I still do not get processing once payment has been made. Transaction ID Status Amount Gateway Date/Time Notes Remved CREATED $xxx.xx PayPal Commerce Today, 00:36 Seller Protection: NOT_ELIGIBLE Settlement Mode: Authorize Payment Method: Card liabilityShifted: true authenticationStatus: YES authenticationReason: SUCCESSFUL Buyer successfully authenticated using 3D secure. Request Log info: Today, 00:36 Request Sent (cURL) - https://api.paypal.com/v2/checkout/orders/9X388721MV5115530/authorize Response received (201 - Created){"id":"Removed","payment_source":{"card":{"last_digits":"XXXX","brand":"VISA","type":"CREDIT"}},"purchase_units":[{"reference_id":"5e880a339ffe7","shipping":{"name":{"full_name":"Removed"},"address":{"address_line_1":"Removed","admin_area_2":"Removed","admin_area_1":"Removed","postal_code":"Removed","country_code":"US"}},"payments":{"authorizations":[{"status":"CREATED","id":"27137503ML747171R","amount":{"currency_code":"USD","value":"XXX.XX"},"invoice_id":"200404-002535-4262","seller_protection":{"status":"NOT_ELIGIBLE"},"processor_response":{"avs_code":"Y","cvv_code":"M","response_code":"0000"},"expiration_time":"2020-05-03T04:36:12Z","links":[{"href":"https://api.paypal.com/v2/payments/authorizations/27137503ML747171R","rel":"self","method":"GET"},{"href":"https://api.paypal.com/v2/payments/authorizations/27137503ML747171R/capture","rel":"capture","method":"POST"},{"href":"https://api.paypal.com/v2/payments/authorizations/27137503ML747171R/void","rel":"void","method":"POST"},{"href":"https://api.paypal.com/v2/payments/authorizations/27137503ML747171R/reauthorize","rel":"reauthorize","method":"POST"},{"href":"https://api.paypal.com/v2/checkout/orders/9X388721MV5115530","rel":"up","method":"GET"}],"create_time":"2020-04-04T04:36:12Z","update_time":"2020-04-04T04:36:12Z"}]}}],"links":[{"href":"https://api.paypal.com/v2/checkout/orders/9X388721MV5115530","rel":"self","method":"GET"}],"status":"COMPLETED"} Link to comment Share on other sites More sharing options...
bsmither Posted April 4, 2020 Share Posted April 4, 2020 If the module offers "Authorization and Capture" (or maybe just Capture), choose that. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 6, 2020 Author Share Posted April 6, 2020 On 4/4/2020 at 11:46 AM, bsmither said: If the module offers "Authorization and Capture" (or maybe just Capture), choose that. Due to the nature of my shipping, I have to use authorizations. Paypal doesn't like refunds on every order and shipping for my products range from $5 to $75 due to hazmat fees and surcharges. The current shipping modules do not correctly account for dimensions which changes my cost widely based on number of boxes to ship the order. (I have a fix for that in testing) Link to comment Share on other sites More sharing options...
Christopher Short Posted April 7, 2020 Author Share Posted April 7, 2020 So I voided a transaction today and it did not cancel the order from cubecart as it has in the past. The module appears to be only partially functional to me. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 7, 2020 Share Posted April 7, 2020 10 minutes ago, Christopher Short said: So I voided a transaction today and it did not cancel the order from cubecart as it has in the past. The module appears to be only partially functional to me. Any errors in the request log? Link to comment Share on other sites More sharing options...
Christopher Short Posted April 7, 2020 Author Share Posted April 7, 2020 15 minutes ago, Al Brookbanks said: Any errors in the request log? A bunch now...I'll send you access. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 7, 2020 Share Posted April 7, 2020 The webhooks are missing data. { "transmission_id": "", "transmission_time": "", "cert_url": "", "auth_algo": "", "transmission_sig": "", "webhook_id": "1A6993978B070454N", "webhook_event": {"id":" ... transmission_id etc are expected to have a value. On some server environments the PHP function getallheaders doesn't work. I believe it's how PHP is installed but I can't remember the spec. It concerns this block of code: if (!function_exists('getallheaders')) { function getallheaders() { $headers = []; foreach ($_SERVER as $name => $value) { if(substr($name, 0, 7) == 'HTTP_PAYPAL_') { // e.g. convert HTTP_PAYPAL_AUTH_ALGO to PAYPAL-AUTH-ALGO $headers[str_replace('_','-', substr($name, 5))] = $value; } else if (substr($name, 0, 5) == 'HTTP_') { $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } } return $headers; } } $headers = getallheaders(); // Array $body = file_get_contents('php://input'); // JSON String $this->_paypal = new paypalCheckout($this->_module); $verify = $this->_paypal->verifySignature($headers, $body); To verify the web hook CubeCart has to send back some request headers from PayPal. If the function "getallheaders" doesn't exists it tried to get these value from the $_SERVER variables. It's clearly not working. Are you using an Apache web server? I found a bug. Try 1.2.14. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 7, 2020 Author Share Posted April 7, 2020 12 minutes ago, Al Brookbanks said: The webhooks are missing data. { "transmission_id": "", "transmission_time": "", "cert_url": "", "auth_algo": "", "transmission_sig": "", "webhook_id": "1A6993978B070454N", "webhook_event": {"id":" ... transmission_id etc are expected to have a value. On some server environments the PHP function getallheaders doesn't work. I believe it's how PHP is installed but I can't remember the spec. It concerns this block of code: if (!function_exists('getallheaders')) { function getallheaders() { $headers = []; foreach ($_SERVER as $name => $value) { if(substr($name, 0, 7) == 'HTTP_PAYPAL_') { // e.g. convert HTTP_PAYPAL_AUTH_ALGO to PAYPAL-AUTH-ALGO $headers[str_replace('_','-', substr($name, 5))] = $value; } else if (substr($name, 0, 5) == 'HTTP_') { $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } } return $headers; } } $headers = getallheaders(); // Array $body = file_get_contents('php://input'); // JSON String $this->_paypal = new paypalCheckout($this->_module); $verify = $this->_paypal->verifySignature($headers, $body); To verify the web hook CubeCart has to send back some request headers from PayPal. If the function "getallheaders" doesn't exists it tried to get these value from the $_SERVER variables. It's clearly not working. Are you using an Apache web server? I found a bug. Try 1.2.14. Updated and I will report back next time I get an order. thanks Link to comment Share on other sites More sharing options...
Christopher Short Posted April 7, 2020 Author Share Posted April 7, 2020 Request Sent (cURL) - https://api.paypal.com/v1/notifications/verify-webhook-signature{ "transmission_id": "", "transmission_time": "", "cert_url": "", "auth_algo": "", "transmission_sig": "", "webhook_id": "1A6993978B070454N", "webhook_event": mc_gross=XXX.XX&invoice=200406-170704-2947&auth_exp=14%3A08%3A06+May+05%2C+2020+PDT&protection_eligibility=Ineligible&address_status=unconfirmed&payer_id=MLYNVTVDBM6KQ&tax=0.00&address_street=XXXXX+532&payment_date=07%3A38%3A36+Apr+07%2C+2020+PDT&payment_status=Completed&charset=windows-1XXX&address_zip=XXXXX&first_name=XXX&transaction_entity=payment&mc_fee=3.46&address_country_code=US&address_name=XXXX¬ify_version=3.9&custom=&payer_status=unverified&business=sales%40csrocketry.com&address_country=United+States&address_city=XXXX&quantity=1&verify_sign=Ad6BYjHt7KIn87svaP7OHBpq9tWaAvfaPTLYjKb2z7wM6LVc6gI6qgQM&payer_email=9N6536473S9709125%40dcc2.paypal.com&parent_txn_id=4PK92590V4185851G&txn_id=6YL37070CR215701K&payment_type=instant&remaining_settle=0&auth_id=4PK92590V4185851G&last_name=XXXX&address_state=XX&receiver_email=sales%40csrocketry.com&auth_amount=118.56&payment_fee=3.46&shipping_discount=0.00&insurance_amount=0.00&receiver_id=BECJBFSX3YF2Q&txn_type=cart&item_name=Payment+for+order+200406-170704-2947&discount=0.00&mc_currency=USD&item_number=1100%2C1246%2C2167%2C2503&residence_country=US&receipt_id=0185-1865-8739-0753&shipping_method=Default&handling_amount=0.00&transaction_subject=&payment_gross=xxx.xx&auth_status=Completed&shipping=17.60&ipn_track_id=1b503e4b8b475 } Error:cURL Error (22): The requested URL returned error: 400 Bad Request Response received (400 - Bad Request) Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 7, 2020 Share Posted April 7, 2020 And you are sure that request log entry made was after the new code? Link to comment Share on other sites More sharing options...
Christopher Short Posted April 7, 2020 Author Share Posted April 7, 2020 55 minutes ago, Al Brookbanks said: And you are sure that request log entry made was after the new code? Yes I am sure. I pm you some credentials to log in with. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 8, 2020 Author Share Posted April 8, 2020 New order, same issue. No notification to the store of payment completion. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 8, 2020 Author Share Posted April 8, 2020 I think I figured out the problem. When you use authorization, it does not send an IPN to update to processing. When you capture the authorization, cubecart updates to processing. Processing should be selected once and authorization is complete, and the status should not change when the payment is captured. Is there any way you can fix this? Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 8, 2020 Share Posted April 8, 2020 5 minutes ago, Christopher Short said: I think I figured out the problem. When you use authorization, it does not send an IPN to update to processing. When you capture the authorization, cubecart updates to processing. Processing should be selected once and authorization is complete, and the status should not change when the payment is captured. Is there any way you can fix this? It should send a webhook once the order is captured and you should see it in the request log fairly soon after the money is captured. IPN is depreciated. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 8, 2020 Author Share Posted April 8, 2020 4 minutes ago, Al Brookbanks said: It should send a webhook once the order is captured and you should see it in the request log fairly soon after the money is captured. IPN is depreciated. Here's what happening: Customer places an order, authorization of payment is completed. Cubecart order goes to pending. When I process the authorization and capture the funds, cubecart updates to processing. Therefore I don't receive order notifications until I process the payment out. What should happen is customer places order, PayPal doesn't authorization, cubecart updates to processing. When the funds are captured status of the order should not change unless it goes to complete. I would prefer the status to stay the same once funds are captured from an authorization. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 8, 2020 Share Posted April 8, 2020 Why don't you change the order status notification to come out when the status is pending? See features tab of store settings. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 8, 2020 Author Share Posted April 8, 2020 Just now, Al Brookbanks said: Why don't you change the order status notification to come out when the status is pending? See features tab of store settings. Because I get people that have payment failures yet the system still generate the order. Happens regularly. Link to comment Share on other sites More sharing options...
Al Brookbanks Posted April 8, 2020 Share Posted April 8, 2020 OK it will need customization for your specific business needs. Link to comment Share on other sites More sharing options...
Christopher Short Posted April 8, 2020 Author Share Posted April 8, 2020 I guess I dont see why. Authorization is a guarantee of payment, and should be treated the same as payment for order status selection. Link to comment Share on other sites More sharing options...
Noodleman Posted April 9, 2020 Share Posted April 9, 2020 @Al Brookbanks. Good morning.. adding my opinion to this topic. I actually think that there may be a requirement to improve the eCommerce module on this occasion. Quite a lot of customers will use Authorise methods (I can think of 4 off the top of my head). However, the way each business works with Authorise methods will be different and especially so depending on where in the world people are. Some want the order as Pending, some want the order as Processing. I think there needs to be an additional setting within this module itself to define if an Auth payment goes to pending or processing. I am aware this can be achieved via the configuration at the store setting level, but this would be counter productive in cases where multiple payment gateways are installed and could cause a conflict of desired behaviour. Thus a setting in the module is more targeted. It should be a pretty simple modification and not take very long at all to add. Is this something that can be considered for a newer version of the PayPal eCommerce module? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.