model = AlipayTradePagePayModel() model.out_trade_no = "pay201805020000226" model.total_amount = 50 model.subject = "测试" model.body = "支付宝测试" model.product_code = "FAST_INSTANT_TRADE_PAY" settle_detail_info = SettleDetailInfo() settle_detail_info.amount = 50 settle_detail_info.trans_in_type = "userId" settle_detail_info.trans_in = "2088302300165604" settle_detail_infos = list() settle_detail_infos.append(settle_detail_info) settle_info = SettleInfo() settle_info.settle_detail_infos = settle_detail_infos model.settle_info = settle_info sub_merchant = SubMerchant() sub_merchant.merchant_id = "2088301300153242" model.sub_merchant = sub_merchant request = AlipayTradePagePayRequest(biz_model=model) # 得到构造的请求,如果http_method是GET,则是一个带完成请求参数的url,如果http_method是POST,则是一段HTML表单片段 response = client.page_execute(request, http_method="GET") print("alipay.trade.page.pay response:" + response) """ 构造唤起支付宝客户端支付时传递的请求串示例:alipay.trade.app.pay """ model = AlipayTradeAppPayModel() model.timeout_express = "90m" model.total_amount = "9.00" model.seller_id = "2088301194649043" model.product_code = "QUICK_MSECURITY_PAY" model.body = "Iphone6 16G"
def sub_merchant(self, value): if isinstance(value, SubMerchant): self._sub_merchant = value else: self._sub_merchant = SubMerchant.from_alipay_dict(value)
model.out_trade_no = "pay201805020000226" model.total_amount = 50 model.subject = "测试" model.body = "支付宝测试" model.product_code = "FAST_INSTANT_TRADE_PAY" settle_detail_info = SettleDetailInfo() settle_detail_info.amount = 50 settle_detail_info.trans_in_type = "userId" settle_detail_info.trans_in = "2088302300165604" settle_detail_infos = list() settle_detail_infos.append(settle_detail_info) settle_info = SettleInfo() settle_info.settle_detail_infos = settle_detail_infos model.settle_info = settle_info sub_merchant = SubMerchant() sub_merchant.merchant_id = "2088102176051162" model.sub_merchant = sub_merchant request = AlipayTradePagePayRequest(biz_model=model) request.return_url = "http://47.94.172.250:8804/page2/" request.notify_url = "http://47.94.172.250:8804/page2/" # 得到构造的请求,如果http_method是GET,则是一个带完成请求参数的url,如果http_method是POST,则是一段HTML表单片段 response = client.page_execute(request, http_method="GET") print("alipay.trade.page.pay response:" + response) import time time.sleep(1000) """ https://openapi.alipaydev.com/gateway.do? timestamp=2018-08-13+15%3A10%3A43& app_id=2016091700533057& method=alipay.trade.page.pay&