laravel - 我如何在我的 Laravel api 中为移动应用程序集成 ccavenue 支付网关
问题描述
我如何在我的 Laravel 应用程序中集成 ccavenue 支付网关。我想在 android 的 web 服务 api 中实现这个。实际上我想知道如何在我的 android 应用程序的移动结帐页面上集成 cc-avenue 支付网关与 laravel
解决方案
安装
composer require kishanio/ccavenue
利用
use Kishnio\CCAvenue\Payment as CCAvenueClient;
$ccavenue = new CCAvenueClient( '<merchant_id>', '<working_key>', '<redirect_url>' );
// set details
$ccavenue->setAmount( '<Amount>' );
$ccavenue->setOrderId( '<order_id>' );
$ccavenue->setBillingName( '<billing_cust_name>' );
$ccavenue->setBillingAddress( '<billing_cust_address>' );
$ccavenue->setBillingCity( '<billing_cust_city>' );
$ccavenue->setBillingZip( '<billing_cust_zip>' );
$ccavenue->setBillingState( '<billing_cust_state>' );
$ccavenue->setBillingCountry( '<billing_cust_country>' );
$ccavenue->setBillingEmail( '<billing_cust_email>' );
$ccavenue->setBillingTel( '<billing_cust_tel>' );
$ccavenue->setBillingNotes( '<billing_cust_notes>' );
// copy all the billing details to chipping details
$ccavenue->billingSameAsShipping();
// get encrpyted data to be passed
$data = $ccavenue->getEncryptedData();
// merchant id to be passed along the param
$merchant = $ccavenue->getMerchantId();
<!-- Request -->
<form method="post" name="redirect" action="http://www.ccavenue.com/shopzone/cc_details.jsp">
<?php
echo '<input type=hidden name=encRequest value="'.$data.'"">';
echo '<input type=hidden name=Merchant_Id value="'.$merchant.'">';
?>
</form>
<script language='javascript'>document.redirect.submit();</script>
</body>
</html>
use Kishnio\CCAvenue\Payment as CCAvenueClient;
// Get Response
$response=$_POST["encResponse"];
$ccavenue = new CCAvenueClient( '<merchant_id>', '<working_key>', '<redirect_url>' );
// Check if the transaction was successfull.
echo $ccavenue->response( $response );
或者你也可以使用这个包
推荐阅读
- sql - 没有收到任何错误但没有以下查询的数据?
- c# - 使用php和c#同步本地数据库和远程数据库?
- java - Android - 领英
- java - JPA 保存错误的实体
- c++ - 将 const 限定符添加到数组引用 typedef
- c++ - std::ANYTHING 未声明
- ruby-on-rails - 尝试在 Ruby Rails 中通过 PeopleV1 API 检索 Google 联系人时,为什么会出现“ArgumentError:未知关键字:person_fields”?
- angular - 保存按钮单击时的 FormArray 不显示 mat 错误
- java - 可选和同时铸造
- android - '1' 与属性 textSize (attr) 维度不兼容