php中的Payfast支付网关ITN响应 [英] Payfast payment gateway ITN rersponse in php

查看:57
本文介绍了php中的Payfast支付网关ITN响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经集成了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.

Receive the payment information from PayFast and then tell PayFast that this page is reachable by triggering a header 200, the payment engine will make a few attempts, one immediately and then one after 10 minutes again, then exponentially at longer intervals, until it receives an OK 200 from your web server.

您将能够通过 $_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响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆