沙箱地址
https://sandbox.alipaydev.com/user/accountDetails.htm?currentBar=1
当面付demo
https://docs.open.alipay.com/54/104506/
将demo导入idea
下载签名工具 https://docs.open.alipay.com/291/105971/
运行:
修改配置文件 zfbinfo.properties
# 支付宝网关名、partnerId和appId open_api_domain = https://openapi.alipaydev.com/gateway.do mcloud_api_domain = http://mcloudmonitor.com/gateway.do # 商户id pid = 2088102178133370 # APPID appid = 2016100100640966 # RSA私钥、公钥和支付宝公钥 private_key = MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCbyKmKzr1EacFjP1DL3cTb1AIobLtHOJTExynFtkDkrHlBjdMPVYKjSW5MnyC9A2NjzMcyLLOZSacOm8zA76aE8fT0X4C7vKCKKSIk+JOCsDX7nntpn1kG33Z9jYP5UlibffdzG4aUiZsWsuiRXi7CetvU0RdC9w27ec8+wkJnwOXCMscHL7hnHhg9YrhbH7Gr9VZWHb9DZ2/XEM96Oglu5UQJ1H4rCAzTIeYS1plgn0wOsJCeb7cN6OwORRVJC7EaCLQEp0l0z/iPYjl5bh93GQulHfi2H9JvTgTeXPkXXJE4Vjd2viovwO3XyCKIeiDNEijdsOYAGMXwu9TvpK7RAgMBAAECggEBAIaS05MrgOimiv7XZU6XZ0WXYb3WH/oocKuEeRtok6p3K9BrWdY3QkEYYAYkuL1PPf6qmbFIWGWk8IF4KWrKG4lhEwA/uA91pSF04yAY9CTDX/7bKzVVCC0dwVg4dbddYVoBeU+giaOrM6RqLOnW+IHcbCbt8TBSBzTaxyMp4P+KjxmvAn2Bg9dWPTKN71TW3jYT7qd9Xo8T7gu8YiLiAa54ZKFzfAfOOm2FA82iyqIJQiy8NWV/cNqSFt42R6Lu4tqCAuBLVP3v4p5s8uKwZKWB+e6G/aUPDbHWT8iAv5mFMYWwicNoXyP8ARo4oTj3KpeM3iKp0zMgX9nctxzoD6ECgYEA7fFiCvcBJr7R1T1pES9NyxXUz2UKo+M9vLR/iH6m3sxzhPb7iY9wZQhKtr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1xDPejoJbuVECdR+KwgM0yHmEtaZYJ9MDrCQnm+3DejsDkUVSQuxGgi0BKdJdM/4j2I5eW4fdxkLpR34th/Sb04E3lz5F1yROFY3dr4qL8Dt18giiHogzRIo3bDmABjF8LvU76Su0QIDAQAB #SHA1withRsa对应支付宝公钥 #alipay_public_key = MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDDI6d306Q8fIfCOaTXyiUeJHkrIvYISRcc73s3vF1ZT7XN8RNPwJxo8pWaJMmvyTn9N4HQ632qJBVHf8sxHi/fEsraprwCtzvzQETrNRwVxLO5jVmRGi60j8Ue1efIlzPXV9je9mkjzOmdssymZkh2QhUrCmZYI/FCEa3/cNMW0QIDAQAB #SHA256withRsa对应支付宝公钥 alipay_public_key = MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjhMIaGnffJmhcofkX/q+COD30gJgfA7p/ZG+q+NFOOMs1UfpUZWtkaRYFkluQCtTPR+Cuh7oySaTyanLEqxRTOHk+d8PJJi3fdK/8bUhcVlQ6yh08aFXFmMFrqY4CByqc9buBIyMgbT077E4cmZ5MV/Do9cRnmGm0bnroBJe65fBskWMAGG6qC1E1RjtTZoPuci71ffp+P9uNCm8IZPSFKxAiGdGEM85kzPlCFnyf4kZyjj8BROAe2otG2om0Jnv/N/zl+Y5DpekEkn6OOYQLTCSv2kfJSlhMCkCz86TTRLyabDkt2HlBIohma7wQIiPSjrJwXjIVXg50BMwHG1hrwIDAQAB/q+COD30gJgfA7p/ZG+q+NFOOMs1UfpUZWtkaRYFkluQCtTPR+Cuh7oySaTyanLEqxRTOHk+d8PJJi3fdK/8bUhcVlQ6yh08aFXFmMFrqY4CByqc9buBIyMgbT077E4cmZ5MV/Do9cRnmGm0bnroBJe65fBskWMAGG6qC1E1RjtTZoPuci71ffp+P9uNCm8IZPSFKxAiGdGEM85kzPlCFnyf4kZyjj8BROAe2otG2om0Jnv/N/zl+Y5DpekEkn6OOYQLTCSv2kfJSlhMCkCz86TTRLyabDkt2HlBIohma7wQIiPSjrJwXjIVXg50BMwHG1hrwIDAQAB+V9JilLqSa7N7sVqwpvv8zWChgXhX/A96hEg97Oxe6GKUmzaZRNh0cZZ88vpkn5tlgL4mH/dhSr3Ip00kvM4rHq9PwuT4k7z1DpZAf1eghK8Q5BgxL88d0X07m9X96Ijd0yMkXArzD7jg+noqfbztEKoH3kPMRJC2w4ByVdweWUT2PwrlATpZZtYLmtDvUKG/sOkNAIKEMg3Rut1oKWpjyYanzDgS7Cg3awr1KPTl9rHCazk15aNYowmYtVabKwbGVToCAGK+qQ1gT3ELhkGnf3+h53fukNqRH+wIDAQAB # 签名类型: RSA->SHA1withRsa,RSA2->SHA256withRsa sign_type = RSA2 # 当面付最大查询次数和查询间隔(毫秒) max_query_retry = 5 query_duration = 5000 # 当面付最大撤销次数和撤销间隔(毫秒) max_cancel_retry = 3 cancel_duration = 2000 # 交易保障线程第一次调度延迟和调度间隔(秒) heartbeat_delay = 5 heartbeat_duration = 900
运行main函数
参数说明:
交易入参:
{
"out_trade_no":"tradeprecreate15656255804137150704",
"seller_id":"",
"total_amount":"0.01",
"undiscountable_amount":"0",
"subject":"xxx品牌xxx门店当面付扫码消费",
"body":"购买商品3件共20.00元",
"goods_detail":[
{
"goods_id":"goods_id001",
"goods_name":"xxx小面包",
"quantity":1,
"price":"10"
},
{
"goods_id":"goods_id002",
"goods_name":"xxx牙刷",
"quantity":2,
"price":"5"
}
],
"operator_id":"test_operator_id",
"store_id":"test_store_id",
"extend_params":{
"sys_service_provider_id":"2088100200300400500"
},
"timeout_express":"120m"
}
出参:
{
"alipay_trade_precreate_response":{
"code":"10000",
"msg":"Success",
"out_trade_no":"tradeprecreate15656255804137150704",
"qr_code":"https://qr.alipay.com/bax05047djdb0ok8rprs007d"
},
"sign":"GrbaJvO8iIZDYVWgY8LigceodI0TKE+DYrcKgVrJEcWr0/a6aCcF6ILF3ui6To6DbMiMTaaCUL7mp7gjyWDZddma2C6FcJ6cyCOWm+fhtIIapVtfDEBjCgnhUGyGgfyqKZcxOEnxs5dA/dqAZcbIAg67I7FUNykWp2IOMgSEXV4VEDvvIPFwdeHZa2kvL8qK+V/I1pzrC2/nuhw7uCWVWxwq7gavFZbvaPA9HoqVtWS2CcGITQokfg1yja8WynIY01THOEa/5LkPl6xOK8eiybs/gEqBp03Ebop+wlcsFixUrjlUPu4cl+MUDfdkVJ+sf5ik6phdQ6Db2xCKTBGNlw=="
}
付款二维码:
"qr_code":"https://qr.alipay.com/bax05047djdb0ok8rprs007d"
运行支付宝TradePayDemo
打开idea配置
配置本地tomcat
运行main
来源:oschina
链接:https://my.oschina.net/u/3915790/blog/3089371