|
25 | 25 | 4. [Executed Status](#status-executed) |
26 | 26 | 5. [Settled Status](#status-settled) |
27 | 27 | 6. [Failed Status](#status-failed) |
28 | | - 7. [Authorization flow config](#auth-flow-config) |
29 | | - 8. [Source of funds](#source-of-funds) |
| 28 | + 7. [Attempt Failed Status](#status-attempt-failed) |
| 29 | + 8. [Authorization flow config](#auth-flow-config) |
| 30 | + 9. [Source of funds](#source-of-funds) |
30 | 31 | 7. [Authorizing a payment](#authorizing-payment) |
31 | 32 | 8. [Refunds](#refunds) |
32 | 33 | 9. [Payouts](#payouts) |
@@ -418,7 +419,8 @@ $payment->isAuthorizing(); |
418 | 419 | $payment->isAuthorized(); // Will also return false when the payment has progressed to executed, failed or settled states. |
419 | 420 | $payment->isExecuted(); // Will also return false when the payment has progressed to failed or settled states. |
420 | 421 | $payment->isSettled(); |
421 | | -$payment->isFailed(); |
| 422 | +$payment->isFailed(); // Payment has failed |
| 423 | +$payment->isAttemptFailed(); // Payment attempt has failed, only available if payment retries are enabled. |
422 | 424 | ``` |
423 | 425 |
|
424 | 426 | Or you can get the status as a string and compare it to the provided constants in `PaymentStatus`: |
@@ -587,6 +589,23 @@ if ($payment instanceof PaymentFailedInterface) { |
587 | 589 | } |
588 | 590 | ``` |
589 | 591 |
|
| 592 | +<a name="status-attempt-failed"></a> |
| 593 | + |
| 594 | +### Attempt Failed Status |
| 595 | + |
| 596 | +> Status only available when you enable payment retries. |
| 597 | +
|
| 598 | +```php |
| 599 | +use TrueLayer\Interfaces\Payment\PaymentAttemptFailedInterface; |
| 600 | + |
| 601 | +if ($payment instanceof PaymentAttemptFailedInterface) { |
| 602 | + $payment->getFailedAt(); // The date and time the payment failed at |
| 603 | + $payment->getFailureStage(); // The status the payment was when it failed, one of `authorization_required`, `authorizing` or `authorized` |
| 604 | + $payment->getFailureReason(); // The reason the payment failed. Handle unexpected values gracefully as an unknown failure. |
| 605 | + $payment->getAuthorizationFlowConfig(); // see authorization flow config |
| 606 | +} |
| 607 | +``` |
| 608 | + |
590 | 609 | <a name="auth-flow-config"></a> |
591 | 610 |
|
592 | 611 | ### Authorization flow config |
|
0 commit comments