问题描述
我已经集成了payfast支付网关.重定向成功页面和通知页面后,我没有得到 payfast 的任何响应.什么是响应参数以及如何在数据库中存储事务详细信息?
I have integrated payfast payment gateway. I did not get any response from payfast after redirecting success page and notify page. What are the response parameters and how to store transaction details in the database?
推荐答案
PayFast 将返回他们的 在成功付款后通过 ITN 回调返回变量到您的系统.
PayFast will return their return variables to your system via the ITN callback after a successful payment has been made.
这些返回变量仅返回到您的notify_url
,如果它根据它们的.
These return variables will only be returned to your notify_url
if it returns a header 200
response as per their documentation.
从PayFast接收支付信息,然后通过触发header 200告诉PayFast这个页面可以访问,支付引擎会进行几次尝试,一次立即一次,然后10分钟后一次,然后以更长的时间间隔呈指数增长,直到它从您的网络服务器收到 OK 200.
您将能够通过 $_POST
变量访问返回值并使用这些值更新您的数据库.
You will be able to access the returned values via the $_POST
variable and use these to update your database.
// 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 代码.
You can view the PayFast sample PHP ITN code here.
这篇关于php中的Payfast支付网关ITN响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!