/initialize endpoint is the first step in processing an e-commerce transaction within the Nayax system. Its primary function is to initiate a payment request from the Nayax SDK, essentially setting the stage for a customer to complete their purchase.
TokenizationThe
/initialize endpoint is also part of the process for tokenizing a card. If a Card-on-File (COF) initialization is triggered, the eCom API will respond with a Nayax card token to the Nayax SDK. See Nayax Tokens for more details.Sale Request
Here is an example of a JSON request for the POST/initialize endpoint, demonstrating a simple sale transaction.
/initialize endpoint API reference page.
Transaction Type
TheRequestType parameter specifies the type of transaction to be performed. Different values apply to different endpoints. Use codes 0–1 when calling /initialize. Use codes 2–8 when calling /close-transaction.
/initialize request types
The table below displays theRequestType codes accepted by the /initialize endpoint.
| Code | Transaction Type | Description |
|---|---|---|
0 | Sale | Authorizes and captures funds in a single step. Used for immediate, complete purchases. |
1 | Auth (Authorization) | Reserves funds on the card without capturing them. Used to place a hold before a final amount is known. |
/close-transaction request types
The table below displays theRequestType codes accepted by the /close-transaction endpoint. These are second-step operations that act on an existing authorized transaction.
| Code | Transaction Type | Description |
|---|---|---|
2 | Settlement | Captures previously authorized funds, finalizing the transaction. |
3 | Void | Cancels a transaction before it has been settled. |
4 | Refund | Returns funds to the customer after a sale has been completed. |
5 | Partial Refund | Returns a portion of the original transaction amount to the customer. |
6 | Incremental Auth | Increases the amount on an existing pre-authorization. Must reference the original transactionId and transactionTimeUtc. The amount field must contain the new total, not the delta. |
7 | Cancel Auth | Cancels a pre-authorized transaction, releasing the held funds. |
8 | Partial Capture | Captures a portion of the pre-authorized amount rather than the full amount. |
Codes
2–8 are not valid on /initialize. Sending them to /initialize will not perform the intended operation. Always use POST /close-transaction for second-step operations. See the request samples for full examples.