使用PayPal IPN将payment_status从“待处理”更新为“已完成”。 它重新发送txn_id吗?

使用PayPal IPN将payment_status从“待处理”更新为“已完成”。 它重新发送txn_id吗?

问题描述:

On the PayPal site in their PHP code for dealing with the IPN they do some minor checks and then put in some comments as to what to do next.

One of the comments is

// check that txn_id has not been previously processed

Indicating that if it has been processed there is something wrong.

What happens when a payment_status goes from "Pending" to "Completed", it would surely send the same txn_id wouldn't it? How else would you identify the transaction and update the record in the database and what "txn_type" is posted for that specific IPN message?

The IPN has been around for years but still the documentation can be so vague and badly explained in most places. They leave you guessing as to what happens in lots of scenarios instead of explaining in detail.

Any help would be great thanks.

在用于处理IPN的PHP代码中的PayPal网站上,他们会做一些小的检查,然后放入一些评论 关于下一步该做什么。 p>

其中一条评论是 p>

  //检查txn_id以前是否曾被处理过
   pre> 
 
 

表示如果已经处理了错误。 p>

当payment_status从“待定”变为“已完成”时会发生什么 “,它肯定会发送相同的txn_id不会吗? 您如何识别交易并更新数据库中的记录以及针对该特定IPN消息发布了什么“txn_type”? p>

IPN已存在多年,但文档仍然可以 在大多数地方都是如此模糊和严厉解释。 他们让你猜测在很多场景中会发生什么,而不是详细解释。 p>

任何帮助都会非常感谢。 p> div>

Transaction ID should be the unique id of the transaction that occurred, the logic that you noted is to make sure that the transaction is not duplicated (eg. not inserted more than once in the system), transaction updates should have the same transaction id. So you should check if the transaction id exists, if so update according fields if you see fit.