python from alipay import AliPay alipay = AliPay(appid='your_appid', app_notify_url='your_notify_url') result = alipay.api_alipay_trade_create( out_trade_no='your_trade_no', total_amount=10.00, timeout_express='30m' ) if result['code'] == '10000' and result['msg'] == 'Success': qrcode_url = result['qr_code'] redirect_url = result['trade_no'] save_qrcode(qrcode_url) else: error_msg = result['sub_msg'] handle_error(error_msg) python from alipay import AliPay alipay = AliPay(appid='your_appid', app_notify_url='your_notify_url') result = alipay.api_alipay_trade_query( out_trade_no='your_trade_no' ) if result['code'] == '10000' and result['msg'] == 'Success': trade_status = result['trade_status'] if trade_status == 'TRADE_SUCCESS': handle_success(result) elif trade_status in ['WAIT_BUYER_PAY', 'TRADE_CLOSED', 'TRADE_FINISHED']: handle_other_status(result) else: error_msg = result['sub_msg'] handle_error(error_msg) python from alipay import AliPay alipay = AliPay(appid='your_appid', app_notify_url='your_notify_url') result = alipay.api_alipay_trade_refund( out_trade_no='your_trade_no', refund_amount=10.00, ) if result['code'] == '10000' and result['msg'] == 'Success': handle_success(result) else: error_msg = result['sub_msg'] handle_error(error_msg)


上一篇:
下一篇:
切换中文