> ## Documentation Index
> Fetch the complete documentation index at: https://devzone.nayax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pre-Authorization with External Settlement

The EMV Core implementation of [ExternalSettlement](/reference/spark/transactions/externalsettlement) separates the authorization and settlement phases of a transaction.

While EMV Core manages the initial interaction with the consumer and the payment card, the final financial settlement is performed by a 3rd-party server that sends the settlement request to Nayax's servers.

<Warning>
  **Prerequisite**

  For this flow to function, the [ExternalSettlement](/reference/spark/transactions/externalsettlement) setting must be enabled by Nayax.
</Warning>

## Configuration & Device Behavior

Once enabled, settlement is handled externally rather than by the host application:

* The only way to settle a transaction is via the [ExternalSettlement](/reference/spark/transactions/externalsettlement) command.
* The settlement amount can be less than or equal to the authorized amount.

This gives you the flexibility to trigger the settlement stage externally according to your own business logic.

| Feature               | Requirement                                                                                                                                 |
| :-------------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
| **Settlement Window** | Transactions must be settled within **60 hours** of initiation by default. This window can be adjusted for specific cases by Nayax support. |
| **Expiry**            | Settlement attempts performed after the settlement window will fail.                                                                        |
| **Auto-Cleanup**      | Transactions unsettled past the settlement window are automatically canceled via card scheme regulations (this should not be relied upon).  |
| **Settlement Amount** | The final settlement price must not exceed the authorized amount.                                                                           |

## Managing Unsettled Transactions

When no product or service is provided, you must proactively manage the transaction to maintain a good user experience.

* **External Cancel:** If no settlement will occur, you must send an **External Cancel** immediately.
* **Consumer Impact:** If a transaction remains authorized without being canceled or settled, the consumer's funds will stay captured on their payment method, leading to potential disputes.

## External Settlement Flow

The flow consists of two phases: payment authorization handled by EMV Core, and settlement or cancellation triggered by your 3rd-party server.

### Payment authorization

The steps below cover the authorization phase, from card tap through session completion.

<Frame>
  <img src="https://mintcdn.com/nayax-44d6e37b/Z7ZM90DfoPrgE0IB/images/docs/pre-authorization-with-external-settlement/payment-authorization.png?fit=max&auto=format&n=Z7ZM90DfoPrgE0IB&q=85&s=1bf1fffff91c4e1d0e7c4ece637d562a" alt="Sequence diagram of the payment authorization phase, from the PreAuthorize call through the TransactionComplete event and service delivery" width="2535" height="1366" data-path="images/docs/pre-authorization-with-external-settlement/payment-authorization.png" />
</Frame>

1. The host machine calls the [`PreAuthorize`](/docs/integrate-pos-device/emv-core/sdk-methods-functions/payment-1#preauthorize) method using the EMV Core SDK.
2. EMV Core begins polling the reader. The host application should prompt the buyer to tap their card.
3. The buyer taps their card on the reader.
4. EMV Core reads the card data and sends an authorization request to the Nayax Servers.
5. Nayax Servers perform authorization with the Billing Provider.
6. The Billing Provider sends an authorization response to the Nayax Servers.
7. Nayax Servers return the authorization response to EMV Core.
8. EMV Core sends a `TransactionComplete` event to the host application. The event contains the transaction ID and transaction data, including `NayaxTransactionId` and `SiteId` in the `authorizationDetails.Additional_Parameters` field.

At this point, the host application must retain the `NayaxTransactionId` and `SiteId` for later use in the External Settlement or External Cancel request.

9. The host application proceeds with providing the service (for example, starts an EV charging session or dispenses a product).

### Settling the transaction

After service delivery, a 3rd-party server handles either settlement or cancellation depending on the outcome.

If the service was provided:

<Frame>
  <img src="https://mintcdn.com/nayax-44d6e37b/Z7ZM90DfoPrgE0IB/images/docs/pre-authorization-with-external-settlement/external-settlement.png?fit=max&auto=format&n=Z7ZM90DfoPrgE0IB&q=85&s=e1b749c8d32e1f8d0f1b8a3648ae513b" alt="Sequence diagram of the external settlement flow, from StartAuthentication through the ExternalSettlement response" width="1328" height="1062" data-path="images/docs/pre-authorization-with-external-settlement/external-settlement.png" />
</Frame>

10. The 3rd-party server initiates communication by calling the `StartAuthentication` method with an encrypted cipher to authenticate.
11. The Nayax Server decrypts the cipher and validates the credentials to confirm authenticity.
12. The 3rd-party server sends an [ExternalSettlement](/reference/spark/transactions/externalsettlement) request. It must contain the `NayaxTransactionId` and `SiteId` retrieved from the `TransactionComplete` event, and must be sent within the settlement window.
13. Nayax Servers process the settlement with the Billing Provider.
14. Nayax Servers send an [ExternalSettlement](/reference/spark/transactions/externalsettlement) response to the 3rd-party server confirming the settlement outcome.

If the service was not provided:

<Frame>
  <img src="https://mintcdn.com/nayax-44d6e37b/Z7ZM90DfoPrgE0IB/images/docs/pre-authorization-with-external-settlement/external-cancel.png?fit=max&auto=format&n=Z7ZM90DfoPrgE0IB&q=85&s=8d3d2cf791d6225a84afe26c5ac92b4d" alt="Sequence diagram of the external cancel flow, from StartAuthentication through the ExternalCancel response" width="1328" height="1062" data-path="images/docs/pre-authorization-with-external-settlement/external-cancel.png" />
</Frame>

10. The 3rd-party server initiates communication by calling the `StartAuthentication` method.
11. The Nayax Server validates the credentials.
12. The 3rd-party server sends an [ExternalCancel](/reference/spark/transactions/externalcancel) request. It must contain the `NayaxTransactionId` and `SiteId` retrieved from the `TransactionComplete` event, and must be sent within the settlement window.
13. Nayax Servers initiate the cancellation process with the Billing Provider.
14. Nayax Servers receive the response from the Billing Provider.
15. Nayax Servers send an [ExternalCancel](/reference/spark/transactions/externalcancel) response to the 3rd-party server.

## Next steps

<CardGroup cols={2}>
  <Card title="External Settlement API" icon="link" href="/reference/spark/transactions/externalsettlement">
    API reference for the ExternalSettlement endpoint used to settle authorized transactions from a 3rd-party server.
  </Card>

  <Card title="External Cancel API" icon="link" href="/reference/spark/transactions/externalcancel">
    API reference for the ExternalCancel endpoint used to cancel authorized transactions when no service is provided.
  </Card>
</CardGroup>
