lokielse/omnipay-alipay 即时到账退款
Posted 迷失之路
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了lokielse/omnipay-alipay 即时到账退款相关的知识,希望对你有一定的参考价值。
1 使用有密退款 2 $gateway = Omnipay::create(‘Alipay_LegacyExpress‘); 3 $gateway->setSignType($sign_type); 4 $gateway->setReturnUrl($return_url); 5 $gateway->setNotifyUrl($notify_url); 6 $gateway->setSellerEmail($seller_email); 7 $gateway->setPartner($partner); 8 $gateway->setKey($key); 9 $data = [ 10 ‘refund_date‘ => date(‘Y-m-d H:i:s‘), 11 "seller_user_id" => trim($seller_id), 12 ‘batch_no‘=> date(‘Ymd‘) . substr($r_order[‘third_part_order_id‘], 8), 13 ‘batch_num‘ => 1,//退款笔数与refund_items数组中保持一致 14 ‘_input_charset‘ => ‘UTF-8‘, 15 ‘refund_items‘=> [ 16 [ 17 ‘out_trade_no‘ => $r_order[‘third_part_order_id‘], 18 ‘amount‘ => $r_order[‘amount‘]/100.0, 19 ‘reason‘ => ‘Userrefund‘ 20 ] 21 ], 22 ]; 23 $request = $gateway->refund($data); 24 $response = $request->send(); 25 $url = $response->getRedirectUrl();#在浏览器中打开此url就可以看到有密退款界面
此库中并没有提供即时到账无密退款服务 手动添加一把 1在LegacyAppGateway.php文件中加一个方法 public function refundNoPwd(array $parameters = []) { return $this->createRequest(LegacyRefundNoPwdRequest::class, $parameters); } 2复制一份LegacyRefundRequest.php文件在当前目录下重命名为 LegacyRefundNoPwdRequest.php 3.把LegacyRefundNoPwdRequest.php文件中的 protect $server = ‘refund_fastpay_by_platform_pwd‘; 改为 protect $server=‘refund_fastpay_by_platform_nopwd‘; ok其他后续操作同有密退款 只需把生成的url用curl发出即可收到支付宝的返回值
以上是关于lokielse/omnipay-alipay 即时到账退款的主要内容,如果未能解决你的问题,请参考以下文章