Delphi版AlipaySDK的Demo程序,简单实用代码片段usesAlipay.Client,Alipay.Trade.Pay.Request,Alipay.Trade.Pay.Response;varAlipayClient:TAlipayClient;Request:IAlipayTradePayRequest;Response:IAlipayTradePayResponse;beginAlipayClient:=TAlipayClientBuilder.New..AppId(‘1234567890’)//APPID即创建应用后生成.Sandbox(True)//能否沙箱环境.SignType(RSA2)//商户生成签名字符串所使用的签名算法类型,目前支持RSA2和RSA,推荐商家使用RSA2.Charset(UTF-8)//请求和签名使用的字符编码格式,支持GBK和UTF-8.PrivateKey(‘dfsagsg’)//开发者应用私钥,由开发者自己生成.AlipayPublicKey(‘4646465’)//支付宝公钥,由支付宝提供.Build;Request:=TAlipayTradePayRequest.Create;Request.BizModel.OutTradeNo:=‘1313131121;Request.BizModel.Scene:=Tscene.BAR_CODE;Request.BizModel.AuthCode:=‘111111’;Request.BizModel.Subject:=‘商品’;Request.BizModel.TotalAmount:=0.01;Response:=AlipayClient.Execute(Request);end;
1