首先请到支付宝那边申请一个及时到账的接口账户,需要提交相关材料申请。然后根据即时到账的API文档进行接入。API文档提供了各种语言版本的demo,我这里是下的php版demo,然后再进行相关修改操作。你也可以将demo版本的代码重新整合,我这里暂时为了走通充值及时到账流程,就不进行代码重构了。
API文档:https://doc.open.alipay.com/docs/doc.htm?spm=a219a.7386797.0.0.eZb8FX&treeId=108&articleId=103950&docType=1
前台表单提交
<form action="/pay/alipayapi.php" class="tm-panel-small uk-form uk-form-stacked" method="post" target="_blank"> <div class="element" style="margin-top:60px;"> </div> <div class="uk-form-row"> <div class="uk-form-controls"> <label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:-20px;">订单序号:</label> <input class="uk-form-width-large" type="text" name="WIDout_trade_no" id="out_trade_no" value="<?php echo trim($_GET['orderid']);?>" > <br> </div> </div> <div class="uk-form-row"> <div class="uk-form-controls"> <label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:-20px;">商品名称:</label> <input class="uk-form-width-large" type="text" name="WIDsubject" value="<?php echo trim($_GET['orderid']);?>" > <br> </div> </div> <div class="uk-form-row"> <div class="uk-form-controls"> <label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:-20px;">付款金额:</label> <input class="uk-form-width-large" type="text" name="WIDtotal_fee" value="<?php echo trim($_GET['amt']);?>"> <br> </div> </div> <div class="uk-form-row"> <div class="uk-form-controls"> <label for="form-username" class="uk-form-label" style="display:inline-block;padding: 0 10px;vertical-align: middle;margin-left:-20px;">商品描述:</label> <input class="uk-form-width-large" type="text" name="WIDbody" value="订单测试支付"> <br> </div> </div> <input type="hidden" name="uid" value="<?php echo $_GET['uid'];?>"> <input type="hidden" name="codes" value="<?php echo $_GET['code'];?>"> <input type="hidden" name="tags" value="<?php echo $_GET['tag'] ?>"> <div class="uk-form-row"> <input class="uk-button uk-button-primary uk-button-large uk-width-1-1" type="submit" class="alisubmit" value ="确认支付"> </div> </div> </form>
新闻热点
疑难解答