true );$result = curl_exec($ch);curl_close($ch);} else { th
近期接了一个国外的项目,客户指定要这种付出,就搞搞呗,其实流程和思路都是差不久不多的,往下看
他的流程其实非常简单 下面的流程仔细看看,看懂了就会了
1 首先我们需要先获取下单所需要的参数(这个需要去ipay88官网去申请),
就是下面main.php里面的一些参数merchantCode,merchantKey
2 参数完整之后我们要做的就是验证签名了(下面有我的验证签名的方法,付出类文件,拿着用就好)
3 当我们在页面实际付款的时候,我们需要使用一个form表单 post方法执行我们的操纵,
我们需要将签名所需要的参数都以form表单的形式提交到ipay88给我们供给的地点,会自动跳转到付出页(告成唤醒就代表对接告成了)
4 注意form表单提交的时候,参数必然要完整
5 测试的时候,ipay88只撑持信用卡付出(visa,master),,并且付出金额只能为1元
yii-iPay88 API将辅佐您为应用措施实现iPay88付款网关。此API中包罗以下操纵
正常付款
按期付款
按期付款终止
后端通知
认证方法yii-iPay88 API使用十六进制和base64编码技术来创建独一签名。然后,此签名将用于客户真个每个请求以及iPay88处事器发送的每个响应。
根基上,此签名基于商户代码,商户密钥,付款金额,货币代码,refno。等。所有API请求都必需通过HTTPS进行。
用法main.php
‘components‘ => array( .... ‘ipay‘ => array( ‘class‘=>‘Ipay‘, ‘merchantCode‘=>‘<<merchantCode>>‘, ‘merchantKey‘=>‘<<merchantKey>>‘, ‘currencyCode‘=>‘MYR‘, // length 5 ‘responseUrl‘=>‘<<hostname>>/ipay/response‘, ‘backendUrl‘=>‘<<hostname>>/ipaybackend/response‘, ‘requeryUrl‘=>‘https://www.mobile88.com/epayment/enquiry.asp‘, ‘paymentUrl‘=>‘https://www.mobile88.com/epayment/entry.asp‘, ‘recurringUrlSubscription‘=>‘https://www.ipay88.com/recurringpayment/webservice/RecurringPayment.asmx/Subscription‘, ‘recurringUrlTermination‘=>‘https://www.ipay88.com/recurringpayment/webservice/RecurringPayment.asmx/Termination‘ ), .... )
一个虚拟控制器,演示此组件用于iPay88正常付款的用法并获得该响应,这个也就是你传给付出类文件的参数要领
IpayController.php
class IpayController extends Controller { const TRANSACTION_TYPE_PAYMENT = ‘payment‘; const TRANSACTION_TYPE_RECURRING_SUBSCRIPTION = ‘recurring_subscription‘; const TRANSACTION_TYPE_RECURRING_TERMINATION = ‘recurring_termination‘; /* * iPay88 normal payment Method */ public function actionPayment() { // Unique merchant transaction number / Order ID (Retry for same RefNo only valid for 30 mins). (length 20) $paymentParams[‘RefNo‘] = ‘TEST123‘; // (Optional) (int) $paymentParams[‘PaymentId‘] = ‘2‘; // Payment amount with two decimals. $paymentParams[‘Amount‘] = ‘1.00‘; // Product description. (length 100) $paymentParams[‘ProdDesc‘] = ‘This is a test product‘; // Customer name. (length 100) $paymentParams[‘UserName‘] = ‘Abc‘; // Customer email. (length 100) $paymentParams[‘UserEmail‘] = ‘[email protected]‘; // Customer contact. (length 20) $paymentParams[‘UserContact‘] = ‘*************‘; // (Optional) Merchant remarks. (length 100) $paymentParams[‘Remark‘] = ‘Here is the description‘; $paymentFields = Yii::app()->ipay->getPaymentFields($paymentParams, self::TRANSACTION_TYPE_PAYMENT); $transactionUrl = Yii::app()->ipay->getTransactionUrl(self::TRANSACTION_TYPE_PAYMENT); $this->render(‘Payment‘, array( ‘paymentFields‘ => $paymentFields, ‘transactionUrl‘ => $transactionUrl )); } }
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31344.html