klinki Posted October 23, 2017 Share Posted October 23, 2017 Hi All, I want to use the AliPay Module which comes out of the Box with Prestashop Alipay v1.0.4 I entered the correct PartnerID and correct SecretKey into the AliPay Prestashop Module and actived the payment option. Now it is shown in the shop, but once a customer clicks on payment via AliPay in the shopsite, the forwarding site from AliPay shows the following message: 订单信息有错误,建议联系卖家。 错误码:ACCESS_FORBIDDEN ________________________Error code: ACCESS_FORBIDDEN ____________________________ I reached out to the Global AliPay Team and they replied the following: Since your have signed with Aliay on product called 'New Cross-Border Payment for PC and Mobile(B)', you need to add this parameter called 'product_code', please upload the value on this parameter as 'NEW_WAP_OVERSEAS_SELLER'product_code=NEW_WAP_OVERSEAS_SELLER __________________ Does anyone of you have an idea or is familiar with hit. I really appreciate your help. Many Thanks Markus Link to comment Share on other sites More sharing options...
bellini13 Posted October 24, 2017 Share Posted October 24, 2017 I'm not familiar with the Alipay API at all, so this is a bit of guess work, but looking at the code I suspect you will need to change a few things 1) /api/PaymentRequest.php: You will need to add a class variable and function for the product_code parameter. It does not currently exist. 2) /alipay.php: Then in the hookpayment function, you need to set the value of product_code to NEW_WAP_OVERSEAS_SELLER Link to comment Share on other sites More sharing options...
klinki Posted October 29, 2017 Author Share Posted October 29, 2017 many thanks. i made the following changes (in red) in the paymentRequest.php and alipay.php. but I get an http 500 error once a customer changes from step 4. SHIPPING to step 5. PAYMENT. I set the variable in PaymentRequest.php class PaymentRequest extends Request { /** * @var */ private $product_code; /** * @var */ and added a function: public function getProductCode() { return $this->product_code; } /** * @setProductCode */ public function setProductCode($product_code) { $this->product_code = $product_code; $this->param_list['product_code'] = $product_code; } in the alipay.php i made the following changes: public function hookPayment($params) { include_once(_PS_MODULE_DIR_.'alipay/api/loader.php'); $currency_id = $params['cart']->id_currency; $currency = new Currency((int)$currency_id); $cart = new Cart($params['cart']->id); if (!ValidateCore::isLoadedObject($cart)) { return false; } if (in_array($currency->iso_code, $this->limited_currencies) == false) { return false; } $service = Configuration::get('ALIPAY_SERVICE_PAYMENT'); $credentials = AlipayTools::getCredentials($service, false); $alipayapi = new AlipayApi($credentials); $alipayapi->setReturnUrl($this->getReturnUrl($cart->secure_key, $cart->id)); $alipayapi->setNotifyUrl($this->getNotifyUrl($cart->secure_key, $cart->id)); $alipayapi->setCharset('UTF-8'); date_default_timezone_set('Asia/Hong_Kong'); $payment_request = new PaymentRequest(); $payment_request->setCurrency($currency->iso_code); $payment_request->setPartnerTransactionId(date('YmdHis').$cart->id); $payment_request->setGoodsDescription($this->getGoodsDescription()); $payment_request->setGoodsName($this->getGoodsName($cart->id)); $payment_request->setOrderGmtCreate(date('Y-m-d H:i:s')); $payment_request->setOrderValidTime(21600); $payment_request->setTotalFee($cart->getOrderTotal()); $payment_request->setProduct_Code ('NEW_WAP_OVERSEAS_SELLER'); $alipayapi->prepareRequest($payment_request); $url = $alipayapi->createUrl(); $this->smarty->assign( array( 'module_dir' => $this->_path, 'alipay_payment_url' => $url ) ); return $this->display(__FILE__, 'views/templates/hook/payment.tpl'); } I am not really familiar with PHP and the developer of the module does not respond at all, even it is an official prestashop module. Is anyone of you familiar with PHP and can please tell me what I did wrong? I attached the two files. Many thanks Markus alipay.php PaymentRequest.php Link to comment Share on other sites More sharing options...
klinki Posted October 29, 2017 Author Share Posted October 29, 2017 (edited) update: in the alipay.php, i changed $payment_request->setProduct_Code ('NEW_WAP_OVERSEAS_SELLER'); to $payment_request->setProductCode ('NEW_WAP_OVERSEAS_SELLER'); now I do not get the HTTP 500 Error anymore and the payment options are shown. However, once I choose AliPay I get this message now. Are there any errors in declaring the variable, getter or setter function or the way i set the value to the variable? I have no PHP experience so far. However the parameter is shown in the URL (s. below) The error message says: Order information can not be identified, it is recommended to contact the seller. Error code: INVALID_PARAMETER btw: the translation means: Order information can not be identified, it is recommended to contact the seller. Error code: INVALID_PARAMETER The URL is the following: https://unitradeprod.alipay.com/exterfaceAssign.htm?alipay_exterface_invoke_assign_client_ip=46.127.152.23&body=My+shop&subject=Swiss+Air+Deluxe+XL+-+9+Liter&sign_type=MD5¬ify_url=https%3A%2F%2Fswiss-air-deluxe.shop%2Fmodules%2Falipay%2Fnotify_url.php%3Fsecure_key%3D8ccbebd90544386bf2757492de825941%26id_cart%3D268&order_valid_time=21600&out_trade_no=20171029181554268¤cy=CHF&return_url=https%3A%2F%2Fswiss-air-deluxe.shop%2Findex.php%3Ffc%3Dmodule%26module%3Dalipay%26controller%3Dconfirmation%26secure_key%3D8ccbebd90544386bf2757492de825941%26id_cart%3D268&sign=11ea6cf34711cd7eff6d55a9906e90f3&_input_charset=UTF-8&alipay_exterface_invoke_assign_target=forexWelcome.vm&alipay_exterface_invoke_assign_model=trade&total_fee=27&product_code=NEW_WAP_OVERSEAS_SELLER&service=create_forex_trade&order_gmt_create=2017-10-29+18%3A15%3A54&partner=2088721300160561&alipay_exterface_invoke_assign_sign=_q9_w_n_p_m_e_u_g_z%2B5zks_l_dq_s85_n6%2F_e2k3_d_g_w_s_y_kh_u%2B_hs_dd_y_sm7_c1ib_a_pg_r_q%3D%3D Edited October 29, 2017 by klinki (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted October 29, 2017 Share Posted October 29, 2017 Quote I reached out to the Global AliPay Team and they replied the following: Since your have signed with Aliay on product called 'New Cross-Border Payment for PC and Mobile(B)', you need to add this parameter called 'product_code', please upload the value on this parameter as 'NEW_WAP_OVERSEAS_SELLER'product_code=NEW_WAP_OVERSEAS_SELLER Now you need to go back to Alipay with this error. They are the ones to instruct you to add the new parameter. Link to comment Share on other sites More sharing options...
klinki Posted November 1, 2017 Author Share Posted November 1, 2017 (edited) thank you so much bellini13 !!! I would not have made it without your help as the developer team of the module did not reply at all. So basically everthing was as you said. AliPay doublechecked and the parameter is supposed to be: product_code=NEW_OVERSEAS_SELLER Now the information is correctly forwarded to AliPay Best Edited November 1, 2017 by klinki (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted November 2, 2017 Share Posted November 2, 2017 very good, glad to hear you are up and running now Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now