- 登录支付宝,并找到沙箱应用沙箱应用
-
选择生成公钥 并保留当前窗口
-
使用开发助手 生成秘钥 点击进入
-
因为我们是php 所以选择 其他 公钥 选项,并点击生成,生了了应用私钥和应用公钥
-
窗口保留,我们复制应用公钥到第一次保留的窗口,并粘贴进去,并选择保存设置,会生成支付宝公钥
- 我们保存一下上面的信息,然后下载demo,并保存在我们的服务器下
在这里插入图片描述
root@569c5a896edd:/home/wwwroot/pay# ls
AopSdk.php aop config.php index.php log.txt lotusphp_runtime notify_url.php pagepay readme.txt return_url.php
root@569c5a896edd:/home/wwwroot/pay# pwd
/home/wwwroot/pay
# 查看服务器配置
root@569c5a896edd:/home/wwwroot/pay# cat /usr/local/nginx/conf/vhost/pay.acurd1.com.conf
server
{
listen 80;
#listen [::]:80;
server_name pay.acurd1.com ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/pay;
include rewrite/none.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log off;
}
-
接下来我们访问一下(注意:此处需要退出登录支付,或者新开无痕窗口访问),我这里新开无痕窗口访问
-
输入沙盒的账号密码完成付款吧
-
- 确认付款之后,将跳转到config文件里面的return_url,并且会异步通知给notify_url,并携带 交易号,和验签等参数
https://www.xxxxx.com/alipay.trade.page.pay-PHP-UTF-8/return_url.php?charset=UTF-8&out_trade_no=202110281712287&method=alipay.trade.page.pay.return&total_amount=0.01&sign=mOnn%2BiETPdOGgmCMElcn1rcYbqW5VoMkmg98ezBUUJLuClyO3Z%2FRZbuscaV3%2BHJ9Qzi92C9rNuMt7xr3%2F9NKIdpbC%2F5ESMjZY6nXJKNN7FSZRmL%2BfvPLDlxMfth33CWt4Xzu2UAEaCjLbcypTJ0EKk%2FQZoIr9XO4pLE2uW7Q9w8bHV5RwB7y5qaM6N4SYgjAKS0cS7gcoAqFWW%2B8S8wHg3F3T6D%2BJegZf1Nl4QJC2tZhy32pgea5TK76McW%2ByhQEACxsQDUGtY%2F5gUAMO2wXZRNqyJ4NfR1%2BgBW7pj%2Fp8PrtHxyzBks3Ke9shVMRWEPThJz%2FAXbMQFvw24zZJ3o9Ug%3D%3D&trade_no=2021102822001406740505305565&auth_app_id=2016080600182305&version=1.0&app_id=2016080600182305&sign_type=RSA2&seller_id=2088102170238510×tamp=2021-10-28+17%3A17%3A15