paytrail / api-documentation

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

Could a success endpoint receive a "fail" status, and vice versa? #27

Closed niklaswulff closed 2 years ago

niklaswulff commented 2 years ago

In the documentation for callbacks, there's a reference to the "checkout-status", which can contain any of the listed statuses

Payment status, either ok, pending, delayed, or fail

If so, why do we need separate endpoints for success calls and fail calls?

"redirectUrls": {
    "success": "https://ecom.example.org/success",
    "cancel": "https://ecom.example.org/cancel"
  },
  "callbackUrls": {
    "success": "https://ecom.example.org/success",
    "cancel": "https://ecom.example.org/cancel"
  }
mikkorantalainen commented 2 years ago

Maybe allow new alternative key event which will be called in all cases and if that key is defined, neither success nor cancel can be defined?

jfrojd-paytrail commented 2 years ago

Hi @niklaswulff

A success-url cannot receive the fail status, these will always be sent to the cancel-url. Both are required so we and implementing merchants can cleanly separate the different outcomes.

niklaswulff commented 2 years ago

@jfrojd-paytrail So why is there a need for status properties? Wouldn't it be sufficient to use the different endpoints?