dongren1011 2015-09-11 09:58
浏览 130
已采纳

如何在我的Joomla网站上打印eWAY PayNow按钮响应

I am using eWAY PayNow button on my Joomla site. I need capture response message after proceed payments and want to display that message on my Joomla site. Here is the eWAY PayNow button script. How do I capture and view response message ???

I have put this one within Joomla ChronoForms.

 <script src="https://secure.ewaypayments.com/scripts/eCrypt.js"
   class="eway-paynow-button" 
   data-publicapikey="epk-CCEEEFDB-13FC-4094-BA0B-1F0B96B9D13C"
   data-amount="0"
   data-currency="AUD"  data-resulturl="http://
www.mysite.com/responseMsg.php">
</script>

</div>
  • 写回答

1条回答 默认 最新

  • dthdlv9777 2015-09-15 11:48
    关注

    Since you are using the data-resulturl parameter, once a transaction is complete the user will be redirected to the page you specify (in your example it is http:// www.mysite.com/responseMsg.php). On this page, an AccessCode will be added to the query string - this can be used to fetch the result of the transaction.

    So you can use the AccessCode in your code as you would any query variable: $_GET['AccessCode'].

    You can fetch the result of the transaction using eWAY's Transaction Query API. An example of doing this would look like:

    <?php
    
    // eWAY API key & Password
    $api_key = '60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR';
    $api_password = 'API-P4ss';
    
    $ch = curl_init();
    
    // Note: using the Sandbox API endpoint
    curl_setopt($ch, CURLOPT_URL, 'https://api.sandbox.ewaypayments.com/Transaction/'.$_GET['AccessCode']);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERPWD, $api_key . ":" . $api_password);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
    
    $output = curl_exec($ch);
    curl_close($ch);
    
    $result = json_decode($output);
    
    if ($result->Transactions[0]->TransactionStatus) {
        echo "Transaction successful";
    } else {
        echo "Transaction declined";
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化