# Payment Scenarios
source: https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/payments/payment-scenarios/index.md

This section outlines some of the most common scenarios for initiating payments.

When referring to "you", we refer to you as a developer and/or your application.

#### Scenario 1: A successfully initiated instant payment {#scenario-1-a-successfully-initiated-instant-payment}

1. You send a request to initiate a payment, with the execution type set to`Instant`, and including a `redirectUrl` for the user to be redirected to your application after the flow completes. The API responds with a payment ID like `f5a23a16-4d8b-4434-87fb-b25bcecba940` and a URL for starting the flow.
2. The user completes the flow and authorizes the payment. The bank receives the payment initiation request.
3. Our API redirects the user back to your provided redirect URL with the query parameter `paymentId=f5a23a16-4d8b-4434-87fb-b25bcecba940`.
4. You request the status from the API using the [refresh status endpoint](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/payments/monitoring-payments/index.md), which responds with `"status.code": "Succeeded"`.

As the `status.code` is `Succeeded`, the payment has been successfully executed!

#### Scenario 2: A successfully initiated normal payment {#scenario-2-a-successfully-initiated-normal-payment}

Non-instant payments ("normal" payments) might not be executed straight away. Settlement times may vary depending on the bank.

If your application needs to fully confirm the outcome of the payment, but payment execution is not instantly confirmed, additional logic is needed.

1. You send a request to initiate a payment, including a `redirectUrl` for the user to be redirected to your application after the flow completes. The API responds with a payment ID like `f5a23a16-4d8b-4434-87fb-b25bcecba940` and a URL for starting the flow.
2. The user completes the flow and authorizes the payment. The bank receives the payment initiation request.
3. Our API redirects the user back to your provided redirect URL with the query parameter `paymentId=f5a23a16-4d8b-4434-87fb-b25bcecba940`.
4. You request the status from the API using the [refresh status endpoint](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/payments/monitoring-payments/index.md), which responds with `"status.code": "Pending"` and `"status.terminal": false`. `Pending` means that the payment initiation request has been received by the bank, but has not yet been executed. Depending on your application, knowing that the payment initiation request has been received by the bank might be adequate.
5. If your application needs to know the outcome of the payment, keep refreshing the payment's status until it reaches a terminal state.

If the status code is `Succeeded` (or if you are using the new payment status codes, `PaymentExecutedDebited` or `PaymentExecutedCredited`), then the payment was executed successfully.

If the status code does not indicate a success, use the status code and status reason to figure out what went wrong.

#### Scenario 3: The bank rejects the payment initiation {#scenario-3-the-bank-rejects-the-payment-initiation}

The bank can reject the payment for any number of reasons, including insufficient funds.

1. You send a request to initiate a payment, including a `redirectUrl` for the user to be redirected to your application after the flow completes. The API responds with a payment ID like `f5a23a16-4d8b-4434-87fb-b25bcecba940` and a URL for starting the flow.
2. The user completes the flow and authorizes the payment. The bank rejects the payment initiation, providing an error code.
3. Our API redirects the user back to your provided redirect URL with the query parameter `paymentId=f5a23a16-4d8b-4434-87fb-b25bcecba940`.
4. You request the status from the API using the [refresh status endpoint](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/payments/monitoring-payments/index.md), which responds with `"status.code": "Failed"` and `"status.details.errorCode": "PaymentFailed_InsufficientFunds"`. The payment failed due to a lack of funds in the specified account.

Use the information in the error code to determine the appropriate next action for your application. With some error codes it may be appropriate to immediately retry the payment initiation, whereas others required a deeper investigation.

#### Scenario 4: User cancels the payment initiation flow {#scenario-4-user-cancels-the-payment-initiation-flow}

1. You send a request to initiate a payment, including a `redirectUrl` for the user to be redirected to your application after the flow completes. The API responds with a payment ID like `f5a23a16-4d8b-4434-87fb-b25bcecba940` and a URL for starting the flow.
2. The user chooses to cancel the flow by pressing the 'X' (the "quit" button) in the flow.
3. Our API redirects the user back to your provided redirect URL with the query parameter `paymentId=f5a23a16-4d8b-4434-87fb-b25bcecba940`.
4. You request the status from the API using the [refresh status endpoint](https://developer.mastercard.com/open-finance-europe/documentation/licensed/aiia-enterprise/payments/monitoring-payments/index.md), which responds with `"status.code": "Cancelled"` . The payment initiation was cancelled by the user.

How to handle a user's cancelled payment initiation depends on the nature of your application.
