私は codeigniter を初めて使用し、codeigniter を使用してフリップカートのような e コマース アプリケーションを開発しています。現在、ccavenue 支払いゲートウェイを当社の Web サイトに統合したいと考えています。これに関して多くのサイトを参照しましたが、適切な解決策を得ることができませんでした。誰かが私を助けて、ccavenue api のドキュメントを提供してください。そして、私は ccavenue を統合するための codeigniter コードを取得しておらず、以下の URL http://integrate-payment-gateway.blogspot.in/2012/01/ccavenue-payment-integration-php.html を使用して ccavenue の統合を続行しました。 .しかし、phpスクリプトをcodeigniterに解析する方法がわかりません。
2 に答える
ここでドキュメントを入手できます。
http://world.ccavenue.com/downloads/CCAVenueWorldIntegrationManual.pdf
そして、コードは ccavenue アカウントから取得できます。ccavenue アカウント所有者に 3 つの言語コードを含むコード zip フォルダーを送信するように依頼するだけで、php フォルダーを使用する必要があります。
以下を求める
統合キット:
ccavenue アカウントにログインし、リンクをクリックしてキットをダウンロードします。これは、「ccavenue アカウントの設定方法」の中にあります。作業キー: トップ メニューの設定とオプションのリンクに移動し、[作業キーの生成] リンクをクリックします。そして、アクティブ化オプションを選択します。
Merchant Id: ワーキングキーが作成されるのと同じページに表示されます。
コードを取得したら、そのコードを codeigniter の方法で使用するだけです。
このコードを参照することもできます。
http://technoread.net/webdesign/payment-gateways/item/238-ccavenue-payment-integration-php
**Here is your view file subscription.php**
<html>
<head>
<script>
window.onload = function() {
var d = new Date().getTime();
document.getElementById("tid").value = d;
};
</script>
</head>
<body>
<form method="POST" name="customerData" action="<?php echo base_url('ws_user/ccavRequestHandler'); ?>">
<input type="hidden" name="tid" id="tid" />
<input type="hidden" name="merchant_id" value="your merchent id"/>
<input type="hidden" name="payment_option" value="OPTNBK">
<input type="hidden" name="order_id" value="123654789"/>
<input type="hidden" name="merchant_param1" value="your custom value"/>
<input type="hidden" name="merchant_param2" value="<?php echo $userId; ?>"/>
<input type="hidden" name="amount" value="<?php echo $amount; ?>"/>
<input type="hidden" name="currency" value="INR"/>
<input type="hidden" name="redirect_url" value="<?php echo base_url('webservice/payDone');?>"/>
<input type="hidden" name="cancel_url" value="<?php echo base_url('webservice/cancelPayment');?>"/>
<input type="hidden" name="billing_name" value="<?php echo $addressData[0]->name;?>"/>
<input type="hidden" name="billing_address" value="<?php echo $addressData[0]->AddressLine1 . ' '. $addressData[0]->Addressline2;?>"/>
<input type="hidden" name="billing_city" value="<?php echo $addressData[0]->city_name;?>"/>
<input type="hidden" name="billing_state" value="<?php echo $addressData[0]->state_name;?>"/>
<input type="hidden" name="billing_zip" value="<?php echo $addressData[0]->Zipcode;?>"/>
<input type="hidden" name="billing_country" value="<?php echo $addressData[0]->country_name;?>"/>
<input type="hidden" name="billing_tel" value="<?php echo $addressData[0]->contact;?>"/>
</form>
<script language='javascript'>document.customerData.submit();</script>
</body>
</html>
ここにあなたのCI関数があります
public function ccavRequestHandler()
{
$this->load->view('ccavRequestHandler');
}
ここにあなたのファイル ccavRequestHandler.php があります
<html>
<body>
<?php include('Crypto.php')?>
<?php
$merchant_data='';
$working_key='your working key';//Shared by CCAVENUES
$access_code='your access code';//Shared by CCAVENUES
foreach ($_POST as $key => $value)
{
$merchant_data.=$key.'='.urlencode($value).'&';
}
$encrypted_data=encrypt($merchant_data,$working_key); ?>
<form method="post" name="redirect" action="https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction">
<?php
echo "<input type=hidden name=encRequest value=$encrypted_data>";
echo "<input type=hidden name=access_code value=$access_code>";?>
</form>
<script language='javascript'>document.redirect.submit()</script>
</body>
</html>
成功の URL は次のとおりです。
public function payDone()
{
$encResp=$_REQUEST['encResp'];
$working_key='YOURKEY';
$decryptValues=explode('&',$this->common->decrypt($encResp,$working_key));
$dataSize=sizeof($decryptValues);
/*CODE FOR GET YOUR VERIABLE WHEN REDIRECT ON YOUR URL */
for($i = 0; $i < $dataSize; $i++)
{
$information=explode('=',$decryptValues[$i]);
if($information[0] == 'merchant_param1')
{
$address = $information[1];
}
if($information[0] == 'merchant_param2')
{
$userid = $information[1];
}
if($information[0] == 'order_status')
{
$order_status = $information[1];
}
}
/*CHECK PAYMENT IS SUCCESS OR FAIL */
if($order_status == 'Success')
{
/* DO what ever you want after successful payment */ Redirect('webservice/paymentSuccess');
}
else
{
/* do whatever you want after failure */
redirect('webservice/paymentFail');
}
}