# Accept Purchase (Payment Token)

> For the complete documentation index, see [llms.txt](https://docs.fondy.io/llms.txt).

This endpoint enables you to generate a payment and receive a token to create payment forms in your system. Using one of the Fondy solutions, you will use the generated token to mount the payment form. When your customer finishes the payment, adding the payment method information, Fondy will use a token generated by this endpoint to link the payment created with the payment information provided by your client.

**POST** `/checkout/token`

Base URL: `https://pay.fondy.eu/api`

This endpoint enables you to generate a payment and receive a token to create payment forms in your system. Using one of the Fondy solutions, you will use the generated token to mount the payment form. When your customer finishes the payment, adding the payment method information, Fondy will use a token generated by this endpoint to link the payment created with the payment information provided by your client.

## Header parameters

- `Content-Type` (string, required)
  Specifies the format for the request. Response will be in the same format.

## Body

Content type: `application/json`

- `request` (object)
  - `order_id` (string, required)
    A unique identifier for the order. This can be any value defined by the merchant, allowing you to use any internal order identification system your business employs.
  - `merchant_id` (integer, required)
    A unique identifier assigned to the merchant by Fondy upon account registration. This ID is required for authenticating requests and associating transactions with the merchant's account.
  - `order_desc` (string, required)
    A brief description of the order, encoded in UTF-8. This description will appear in payment records and can provide details for customer reference.
  - `signature` (string, required)
    Signature for request verification, generated according to Fondy’s algorithm. Required to verify merchant request consistency and authenticity.
    Learn how to use Fondy’s algorithm at the [Signature Generation for Request and Response](doc:signatures) page.
  - `amount` (integer, required)
    Total order amount in minor currency units (e.g., cents). For example, 1020 in EUR represents 10 euros and 20 cents. Separators or decimal points aren't allowed.
  - `currency` ("AED" | "AFN" | "ALL" | "AMD" | "ANG" | "AOA" | "ARS" | "AUD" | "AWG" | "AZN" | "BAM" | "BBD" | "BDT" | "BGN" | "BHD" | "BIF" | "BMD" | "BND" | "BOB" | "BRL" | "BSD" | "BTN" | "BWP" | "BZD" | "CAD" | "CDF" | "CHF" | "CLP" | "CNY" | "COP" | "CRC" | "CUP" | "CVE" | "CZK" | "DJF" | "DKK" | "DOP" | "DZD" | "EGP" | "ERN" | "ETB" | "EUR" | "FJD" | "FKP" | "GBP" | "GEL" | "GHS" | "GIP" | "GMD" | "GNF" | "GTQ" | "GYD" | "HKD" | "HNL" | "HRK" | "HTG" | "HUF" | "IDR" | "ILS" | "INR" | "IQD" | "IRR" | "ISK" | "JMD" | "JOD" | "JPY" | "KES" | "KGS" | "KHR" | "KMF" | "KRW" | "KWD" | "KYD" | "KZT" | "LAK" | "LBP" | "LKR" | "LRD" | "LSL" | "LTL" | "LVL" | "LYD" | "MAD" | "MDL" | "MGA" | "MKD" | "MMK" | "MNT" | "MOP" | "MUR" | "MVR" | "MWK" | "MXN" | "MYR" | "MZN" | "NAD" | "NGN" | "NIO" | "NOK" | "NPR" | "NZD" | "OMR" | "PAB" | "PEN" | "PGK" | "PHP" | "PKR" | "PLN" | "PYG" | "QAR" | "RON" | "RSD" | "RWF" | "SAR" | "SBD" | "SCR" | "SDG" | "SEK" | "SGD" | "SHP" | "SLL" | "SOS" | "SRD" | "STD" | "SVC" | "SZL" | "THB" | "TJS" | "TMT" | "TND" | "TOP" | "TRY" | "TTD" | "TWD" | "TZS" | "UAH" | "UGX" | "USD" | "UYU" | "UZS" | "VEF" | "VND" | "VUV" | "WST" | "XAF" | "XCD" | "XOF" | "XPF" | "YER" | "ZAR" | "ZMW" | "ZWD", required)
    Currency for the transaction (e.g., GBP, EUR, USD). Refer to the [Currencies](doc:supported-currencies) page for a full list of available currencies.
  - `version` (string)
    Specifies the protocol version. Use version '1.0.1' to ensure that the `additional_info` parameter is included in the callback response.
  - `response_url` (string)
    The URL where the customer is redirected after completing the payment. Typically used to display the transaction status or next steps.
  - `server_callback_url` (string)
    URL for server-to-server callback post payment. See [Receiving Callbacks](doc:callbacks) for more details on callbacks.
  - `payment_systems` (string)
    A list of allowed payment systems for processing this order, separated by commas or semicolons. If not specified, the default allowed payment systems set in the Fondy merchant portal will be used.

    Supported Values:

    | Payment system code | Description             |
    |---------------------|-------------------------|
    | `card`              | Visa/MasterCard/Maestro |
    | `banklinks_pl`      | Polland bank links      |
    | `banklinks_eu`      | European countries bank links |
    | `installments`      | Installments            |
  - `default_payment_system` (string)
    Specifies the preferred payment system to be displayed first to the customer. Supported values match those available in the `payment_systems` parameter.
  - `lifetime` (integer)
    The duration for which the order is valid, in seconds. Default is 36000 seconds (10 hours), with a maximum of 69120000 seconds (8 days).
  - `merchant_data` (string)
    Custom data provided by the merchant in the request. You can include any arbitrary string data relevant to your business needs, such as user IDs, session information, or notes. The data must be in string format and must not contain the '|' (pipe) character.
  - `preauth` ("Y" | "N")
    Pre-authorisation parameter for Visa/MasterCard payments to determine the timing of the charge.
  - `sender_email` (string)
    Your customer's email address. Fondy will send an email regarding the payment to this address.
  - `descriptor` (string)
    Dynamic descriptor appearing on the customer's bank statement to indicate transaction details.
  - `delayed` ("Y" | "N")
    Flag controlling the behavior of delayed payments, which impacts retry attempts if the initial payment fails.
  - `lang` ("az" | "cs" | "da" | "de" | "en" | "es" | "fi" | "fr" | "hu" | "it" | "ka" | "ko" | "lv" | "nl" | "pl" | "ro" | "ru" | "sk" | "uk" | "zh")
    Specifies the main language displayed to users during the payment process. Refer to the [Language Support](doc:checkout-language) page for more details.
  - `product_id` (string)
    Unique identifier assigned by the merchant for the product or service being purchased.
  - `required_rectoken` ("Y" | "N")
    Indicates if a card token should be generated by Fondy to facilitate recurring payments without cardholder re-entry. Set to 'Y' to request a card token for future payments. Refer to the [Recurring Payments](ref:recurring-payment) documentation for more details.
  - `verification` ("Y" | "N")
    Indicates whether Fondy should automatically reverse the payment after a successful approval, primarily used for card verification. Refer to the [Verification](doc:card-verification-guide) guide for more information.
  - `rectoken` (string)
    A reusable token generated by Fondy to facilitate card payments without cardholder re-entry for future transactions.
  - `receiver_rectoken` (string)
    Token used for crediting funds to a card without requiring the full card number. Primarily for use cases where the cardholder is a recipient.
  - `design_id` (integer)
    The unique identifier for a custom checkout page design as configured in the Fondy merchant portal.
  - `subscription` ("Y" | "N")
    Enables or disables scheduled (recurring) payments for this order. Set to 'Y' to activate scheduled payments for a subscription service, or 'N' to process a one-time payment.
  - `subscription_callback_url` (string)
    The URL for server callbacks triggered after each scheduled (recurring) payment is processed.
  - `recurring_data` (string<byte>)
    A Base64-encoded JSON string that configures the details of a recurring payment plan. When decoded, the JSON object specifies the schedule, amount, and start/end times for the recurring payments. 

    **Decoded JSON Structure:**
    ```json
    {
      "every": 1,
      "period": "month",
      "amount": 10000,
      "start_time": "2024-04-26",
      "end_time": "2025-04-26"
    }
    ```

    - **`every`** *(integer)*: Interval between payments. Defaults to `1` if not provided. Example: `1` represents one period (e.g., one month if `period` is "month").
    - **`period`** *(string)*: Unit of time for the payment interval. Defaults to `"month"` if not specified.
      - Accepted Values: `"day"`, `"week"`, `"month"`, `"year"`.
    - **`amount`** *(integer)*: Payment amount in minor currency units (e.g., cents). Example: `10000` represents $100.00 for currencies with two decimal places.
    - **`start_time`** *(string)*: Start date for the recurring payments in ISO 8601 format (e.g., `"2024-04-26"`). Defaults to the current date or the calculated start date if not provided.
    - **`end_time`** *(string)*: End date for the recurring payments in ISO 8601 format. Defaults to the system-defined end date if not provided.

Example:

```json
{
  "request": {
    "order_id": "ORDER_12345678",
    "merchant_id": 1,
    "order_desc": "Hotel booking №1234 Antalya Resort",
    "signature": "1773cf135bd89656131134b98637894dad42f808",
    "amount": 1020,
    "currency": "AED",
    "version": "1.0.1",
    "response_url": "http://site.com/responseurl",
    "server_callback_url": "http://site.com/callbackurl",
    "payment_systems": "card,banklinks_eu",
    "default_payment_system": "card",
    "lifetime": 600,
    "merchant_data": "string",
    "preauth": "N",
    "sender_email": "string",
    "descriptor": "string",
    "delayed": "Y",
    "lang": "en",
    "product_id": "string",
    "required_rectoken": "N",
    "verification": "N",
    "rectoken": "544d3f86237886b6404d8b000f6a7d71c45410b7",
    "receiver_rectoken": "string",
    "design_id": 123,
    "subscription": "N",
    "subscription_callback_url": "http://site.com/subscriptioncallback",
    "recurring_data": "eyJldmVyeSI6MSwicGVyaW9kIjoibW9udGgiLCJhbW91bnQiOjEwMDAwLCJzdGFydF90aW1lIjoiMjAyNC0wNC0yNiJ9"
  }
}
```

## Responses

### 200

The response for a successful request.

- `response` (object)
  - `token` (string)
  - `response_status` (string)

Example:

```json
{
  "response": {
    "token": "9f0124be2b72333fb0e809f82c8f7e4eaeb6ec6e",
    "response_status": "success"
  }
}
```