omnipay
omnipay copied to clipboard
Pending Success
What is the recommendation for gateway which wants to return a type of 'pending success'. These types of responses are usually returned and relate with the acceptNotification() method, where the real success to sent to the commerce application at a later time outside of the customer checkout flow.
What should the response object's isSuccessful()return when the request worked and the customer should be able to get a success response, but the payment is not actually made yet?
Based on how all other gateway drivers work at the moment, the isSuccessful() method is being used across all gateways as a flag to whether the transaction/payment as a whole was completed and paid.
Welcome thoughts please.
May be related to https://github.com/thephpleague/omnipay/issues/339
When it's pending, it's not succesfull. Perhaps isPending() should be added to the interface?
Something like isPending() would be great.
Actually I see that there is already a isPending() in AbstractResponse
/**
* Is the response successful?
*
* @return boolean
*/
public function isPending()
{
return false;
}
The issue is most of the time the isSuccessful() is really only looking for an absence of an error.
The question is, can isPending and isSuccessful both be true?
No
If they can't both be true then I am thinking we need a new pendingSuccessful() right? all others would be false.
Pending is undefined, so it can still fail, we just don't know.
The are more transaction status values that can be returned by the payment gateways. This is also related to https://github.com/thephpleague/omnipay-common/issues/153
@aimeos correct, but I am not talking about the notification, I am talking about the response for the initial purchase request.
@lukeholder Yes, but the problem is in principle the same for accepNotification() and completePuchase()
It is not uncommon for a gateway to return no result (empty data) for a pending success. Be aware of that. It's also not uncommon for a gateway to time out, which is also normally treated as "pending" because of PCI implications about maximum wait times between financial institutions.
I have seen cases of a notify being sent on a notifyUrl which arrives after the pending success, indicating the true success or failure status. I have also seen cases of the notify arriving before the pending success result -- in those cases the notify data is considered canonical, not the pending result. PaymentWall is a case in point that does this.
I have also seen one gateway that always returns pending for failed transactions, followed up by one or more notifys being sent to the notifyUrl which gives the failure message as well as detailed data about the failure reasons, fraud scores, etc.