Payfast支付网关ITN响应在php


Payfast payment gateway ITN rersponse in php

我集成了payfast支付网关。在重定向成功页面和通知页面后,我没有得到payfast的任何响应。响应参数是什么,以及如何在数据库中存储事务细节?

PayFast将在成功付款后通过ITN回调将其返回变量返回给您的系统。

这些返回变量将只有返回到您的notify_url,如果它返回header 200响应按照他们的文档。

从PayFast接收支付信息,然后通过触发标头200告诉PayFast此页面可达,支付引擎将进行几次尝试,一次立即,然后一次在10分钟后再次,然后以指数级间隔更长,直到它从您的web服务器接收到OK 200。

您将能够通过$_POST变量访问返回值,并使用这些值来更新您的数据库。

// Notify PayFast that information has been received
header( 'HTTP/1.0 200 OK' );
flush();
// Posted variables from ITN
$pfData = $_POST;
//update db
switch( $pfData['payment_status'] )
{
 case 'COMPLETE':
    // If complete, update your application, email the buyer and process the transaction as paid                    
 break;
 case 'FAILED':                    
    // There was an error, update your application
 break;
 default:
    // If unknown status, do nothing (safest course of action)
 break;
}

您可以在这里查看PayFast示例PHP ITN代码