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

# Quick Start

This guide walks you through the foundational integration of Subotiz's payment capabilities using our Hosted Checkout solution ([hosted mode](/en/integration/hosted)) to quickly implement a payment flow. Subotiz provides complete payment capabilities that support core features such as subscription management and transaction processing, making it suitable for various business scenarios including AI platforms, SaaS applications, and more.

## Prerequisites

1. Have a registered Subotiz merchant account（<a href="https://admin.subotiz.com/" target="_blank">signup url</a>）
2. Have completed the Subotiz payment gateway setup and payment method configuration
3. Have created products and pricing

## Integration Steps

<Steps>
  <Step title="Obtain Access Credentials">
    Log in to the [Subotiz merchant platform](https://admin.subotiz.com/) and complete the following two configurations:

    #### 1. Configure Payment Callback URLs

    * `return_url`: Redirect URL after payment success — the default value when using the API to create a checkout session.
    * `cancel_url`: Redirect URL after payment cancellation — the default value when using the API to create a checkout session.

    <Info>
      Priority rule: URLs supplied at session creation override the defaults set here. We recommend setting a global default here for convenience, and passing a custom URL via the API for specific scenarios.
    </Info>

    <Frame>
      <img src="https://mintcdn.com/shoplazza-92a3a725/kRg57qaFxQCCAN8Z/images/4bc476dd-bbcb2337d2f24928bc44bf7f892b01c4e184eab3d7a7872fa557eccc-image.png?fit=max&auto=format&n=kRg57qaFxQCCAN8Z&q=85&s=89ea23bef873b0f4fd26cd63461fcb1a" width="1917" height="804" data-path="images/4bc476dd-bbcb2337d2f24928bc44bf7f892b01c4e184eab3d7a7872fa557eccc-image.png" />
    </Frame>

    #### 2. Obtain the Platform Access Information

    * `access_no`: Unique identifier for the integrating party
    * `merchant_id`: Unique merchant identifier
    * `API Key`: API authentication key. See [Authentication](/en/api/authentication-1) for how to obtain it (**Keep strictly confidential, never expose on the client-side**)

    <Frame>
      <img src="https://mintcdn.com/shoplazza-92a3a725/kRg57qaFxQCCAN8Z/images/60143008-bbdcfb26ba83270836234a454d4550ab41cda7a73292e82ab24ad544-image.png?fit=max&auto=format&n=kRg57qaFxQCCAN8Z&q=85&s=3579cda43784d502522efb7e6bccead5" width="1920" height="803" data-path="images/60143008-bbdcfb26ba83270836234a454d4550ab41cda7a73292e82ab24ad544-image.png" />
    </Frame>
  </Step>

  <Step title="Obtain Product Information">
    Create products and product pricing within the Subotiz merchant platform. Store the product and price information on your server. Creating a Checkout Session relies on the `pricing_id` of the product pricing to dynamically retrieve product information.

    <Frame caption="Create a Product">
      <img src="https://mintcdn.com/shoplazza-92a3a725/kRg57qaFxQCCAN8Z/images/8dde4ef3-8850f8c0d7752d9788b2a2199ae5f9a28f12cc6a494a71548a73957e-20250901-184228.jpeg?fit=max&auto=format&n=kRg57qaFxQCCAN8Z&q=85&s=48a7e362658755b41676c6b7c72d70fb" width="1913" height="855" data-path="images/8dde4ef3-8850f8c0d7752d9788b2a2199ae5f9a28f12cc6a494a71548a73957e-20250901-184228.jpeg" />
    </Frame>

    <Frame caption="Create Product Pricing">
      <img src="https://mintcdn.com/shoplazza-92a3a725/kRg57qaFxQCCAN8Z/images/85b2c965-e53d406672357cd34d75d986fc422b854db63cb8d416b6b9ff1e5dca-image.png?fit=max&auto=format&n=kRg57qaFxQCCAN8Z&q=85&s=ec55844e75a8e45615e16d4112684ac8" width="1920" height="853" data-path="images/85b2c965-e53d406672357cd34d75d986fc422b854db63cb8d416b6b9ff1e5dca-image.png" />
    </Frame>
  </Step>

  <Step title="Create a Checkout Session">
    Use the API to create a checkout session, retrieve the payment page URL, and guide the customer through completing the payment.

    **Request example:**

    ```bash theme={null}
    curl --location 'https://api.sandbox.subotiz.com/api/v1/session' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {your_api_key}' \
    --header 'Request-Id: 07949371-7868-2282-78af-2a8d5c043760' \
    --data-raw '{
      "access_no": "{Your access_no}",
      "sub_merchant_id": "{Your merchant_id}",
      "order_id": "test_order_001",
      "email": "customer@example.com",
      "line_items": [
        {
          "price_id": "{Product pricing ID}",
          "quantity": "1"
        }
      ],
      "return_url": "https://your-app.com/success",
      "cancel_url": "https://your-app.com/cancel"
    }'
    ```
  </Step>

  <Step title="Test Payment Completion">
    #### 1. Obtain the payment page URL

    Upon a successful API response, obtain `data.session_url` (the payment page URL).

    #### 2. Open the checkout page

    Access this link in a browser to view the Subotiz-hosted checkout page.

    <Frame caption="Example Checkout Page">
      <img src="https://mintcdn.com/shoplazza-92a3a725/kRg57qaFxQCCAN8Z/images/548ad7c1-9422d5a8a2d984657bbac8b5c7d0ed905277e347f3ae2790b3ebbf48-sample_checkout.png?fit=max&auto=format&n=kRg57qaFxQCCAN8Z&q=85&s=864ccd016e35f21070c8242c64f4a14e" width="3834" height="1696" data-path="images/548ad7c1-9422d5a8a2d984657bbac8b5c7d0ed905277e347f3ae2790b3ebbf48-sample_checkout.png" />
    </Frame>

    #### 3. Complete payment with a test card

    Use the following test card numbers (for Subotiz Payments):

    * Payment success: card number `4242424242424242`, any 3-digit CVC, any future expiration date
    * Payment failure: card number `4000000000000002`, any 3-digit CVC, any future expiration date
  </Step>

  <Step title="Handle Payment Result Notifications">
    #### 1. Redirect back to return\_url

    After payment completes, the user is redirected back to the `return_url` (success scenario).

    #### 2. Receive the Webhook notification

    Subotiz also sends a Webhook notification to your endpoint (event type `trades.succeeded`).

    #### 3. Verify the Webhook Signature

    1. **Extract parameters**: obtain the X-Timestamp from the request headers (denoted as `timestamp`), and get the raw request body content (denoted as `body`).
    2. **Construct the signature string**: format is `${timestamp}.${body}`.
    3. **Compute the signature**: using the `API Key` assigned by Subotiz as the key, compute the signature value via the HMAC-SHA256 algorithm (see the example below).
    4. **Compare and verify**: compare the calculated signature with the X-Signature value from the request headers. If they match, the request is legitimate.

    ```go theme={null}
    // Compute Signature
    func CalcSignature(timestamp int64, body []byte, secret string) string {
        mac := hmac.New(sha256.New, []byte(secret))
        mac.Write([]byte(fmt.Sprintf("%d", timestamp)))
        mac.Write([]byte("."))
        mac.Write(body)
        return hex.EncodeToString(mac.Sum(nil))
    }
    ```
  </Step>
</Steps>

## Verifying the Result

1. Log in to the Subotiz merchant platform to review transaction records and subscription records.
2. Verify that the order amount and product information are correct.
