paytrail / api-documentation

Paytrail Payment API documentation
MIT License
6 stars 11 forks source link

Handling pending and delayed status when immediate confirmation is required #24

Closed ap4135543 closed 2 years ago

ap4135543 commented 2 years ago

According to Checkout documentation, once payment is completed the "checkout-status" sent to redirectUrls.success and callbackUrls.success can also be "pending" and "delayed" (instead of "ok"). What if immediate payment confirmation is required and such a "maybe ok" answer is not good enough? E.g. we cannot deliver goods until payment is confirmed, but due to time constrains, delivering goods later on (after payment has truly been confirmed) is not possible. So if the status is anything else than "ok", the payment process has effectively failed. What to do in such a situation? Refund immediately? Refund after receiving "ok" sometime (possibly much) later to the callbackUrls.success? It would be great if the "Payment create" API call could have a new feature: a flag that if enabled, then "pending" and "delayed" are not possible statuses and Checkout backend would handle all that is necessary to cancel the payment and then just call redirectUrls.cancel and callbackUrls.cancel.

niklaswulff commented 2 years ago

This relates closely to my newly created issue #27

jfrojd-paytrail commented 2 years ago

Hi @ap4135543

When pending or delayed is received and the desired outcome is to cancel the payment if it ever is confirmed, the correct way to handle this is to then make a refund call if an ok-status is later received.

While I understand the need for your suggestion, this is not technically feasible for us at the moment so the implementation you suggest here will probably not happen in the forseeable future.