duanfoumi5620 2013-07-10 09:43
浏览 31

magento自定义支付网关通知

I am working on a custom payment solution and am stuck on how to notify magento that the payment was accepted or declined.

I have a PaymentController.php file and need to enter code to handle this.

The payment gateway provides a HTTP GET request below.

http://www.websitename.co.uk/mygateway/payment/response?SessionID=&Note=&Tariff=&Status=

  1. SessionID is a unique ID assigned by payment gateway

  2. Note is the orderID which was generated by magento

  3. Tariff is the price of the order in pence i.e. 100p

  4. Status is the status of payment, there are about 10 different types and Status=100 is a successful payment and Status=200 is a failed payment

So it might be http://www.websitename.co.uk/mygateway/payment/response?SessionID=123456&Note=1000051&Tariff=300&Status=100

I am not sure how to create the code to handle this get request and work out the status

I need to place the code between this area of the paymentcontroller

public function responseAction() {
    if($this->getRequest()->isPost()) {

        /*
        /* Your gateway's code to make sure the reponse you
        /* just got is from the gatway and not from some weirdo.
        /* This generally has some checksum or other checks,
        /* and is provided by the gateway.
        /* For now, we assume that the gateway's response is valid
        */

        $validated = true;
        $orderId = '';

        if($validated) {
  • 写回答

1条回答 默认 最新

  • douhui2307 2013-07-10 23:43
    关注

    Use the Zend_Http_Client class.

    You will find everything you need to know in this small tutorial from zend:

    http://framework.zend.com/manual/1.12/de/zend.http.client.html

    A quick and dirty way would be:

    $client = new Zend_Http_Client('http://www.websitename.co.uk/mygateway/payment/response?SessionID=123456&Note=1000051&Tariff=300&Status=100');
    $response = $client->request();
    

    Then check the response and your good to go. Good luck!

    评论

报告相同问题?

悬赏问题

  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算