Skip to main content
This guide explains how to create a new payment session by calling the Create a Payment Session endpoint. This is the first and most critical step in the Hosted Checkout integration.

Creating a Payment Session

Follow these steps to construct your request, call the API, and handle the response.

Step 1: Construct the Request Body

Create a JSON object with the payment details. At a minimum, you must include customer, amount_total, currency, and line_items. The table below describes all the required fields for creating a payment session: See the API Reference for a full list of all available fields.

Step 2: Call the API Endpoint

Send a POST request to the Create a Payment Session endpoint for your environment, including your API key as a Token in the Authorization header. This example demonstrates how to create a payment session using cURL or Node.js:

Payment Method Types

The payment_method_types field defines which payment methods are available in the checkout. You should only include the method(s) you want to enable — there is no need to send all of them. Available options:
In this example, only spei is included in payment_method_types. Include only the methods relevant to your integration.

Step 3: Handle the Response

If successful, Tonder returns a 201 status and the session object. The two most important fields are id (the session ID) and url (the redirect URL). Here’s an example of a successful response:

What’s Next

Now that you have created a payment session, here are the next steps: