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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# Quickstart: your first sandbox payment

> Create a connection, send one payment with a test card in the Yuno sandbox, and see it in the dashboard.

Getting started

Tutorial · about 10 minutes

Yuno is the AI operating system for payments, and a payment is the first thing you run on it. You send your first sandbox payment in about 10 minutes once you have sandbox credentials.

Create a connection
Send one payment with a test card
See it in the dashboard

<video src="https://docs.y.uno/videos/explainers/first-payment.mp4" poster="/videos/explainers/first-payment.jpg" controls preload="none" playsInline aria-label="Your first payment" />

Video: Your first payment (66 s, captions on screen, no voiceover)

## Before you start

You need these facts for every call on this page.

| Fact | Value |
| - | - |
| Account code | `account_id` in the dashboard, under **Developers** |
| Keys | `public-api-key` and `private-secret-key`, both starting with `sandbox_` |
| Base URL | `https://api-sandbox.y.uno/v1` (keep the `/v1`) |
| Amounts | `amount.value` is a number next to a `currency`. This page sends `25` with `USD` |
| Tools | Node 18 or later, or `curl` |

### 1. Get your sandbox credentials

Log in to the [Yuno dashboard](https://dashboard.y.uno/) and open **Developers** to find three values:

* **Account code**, shown as `account_id` in the dashboard
* **`public-api-key`**
* **`private-secret-key`**

Sandbox keys start with `sandbox_`. Production keys are different and start with `prod_`.

![Yuno dashboard log in page](https://mintcdn.com/yuno-3979e326/mqKc4056TZzyLssc/images/reference/step-1-set-up-your-account/image1.png?fit=max\&auto=format\&n=mqKc4056TZzyLssc\&q=85\&s=09be08d430f7f2e7af07821dd84f146f)

If you do not have an account yet, ask your Yuno contact or write to [sales@y.uno](mailto:sales@y.uno). There is no self-serve signup today.

Set your credentials as environment variables:

```bash Shell theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
export YUNO_PUBLIC_API_KEY="sandbox_..."
export YUNO_PRIVATE_SECRET_KEY="sandbox_..."
export YUNO_ACCOUNT_ID="your-account-code"
```

Prove the keys by creating a customer. The base URL is `https://api-sandbox.y.uno/v1`.

```bash cURL theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
curl --request POST \
  --url https://api-sandbox.y.uno/v1/customers \
  --header "public-api-key: $YUNO_PUBLIC_API_KEY" \
  --header "private-secret-key: $YUNO_PRIVATE_SECRET_KEY" \
  --header "content-type: application/json" \
  --data '{
    "merchant_customer_id": "customer-0001",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john.doe@example.com"
  }'
```

```javascript Node.js theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
const res = await fetch("https://api-sandbox.y.uno/v1/customers", {
  method: "POST",
  headers: {
    "public-api-key": process.env.YUNO_PUBLIC_API_KEY,
    "private-secret-key": process.env.YUNO_PRIVATE_SECRET_KEY,
    "content-type": "application/json",
  },
  body: JSON.stringify({
    merchant_customer_id: "customer-0001",
    first_name: "John",
    last_name: "Doe",
    email: "john.doe@example.com",
  }),
});
const customer = await res.json();
console.log(customer.id);
```

```python Python theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
import os
import requests

res = requests.post(
    "https://api-sandbox.y.uno/v1/customers",
    headers={
        "public-api-key": os.environ["YUNO_PUBLIC_API_KEY"],
        "private-secret-key": os.environ["YUNO_PRIVATE_SECRET_KEY"],
    },
    json={
        "merchant_customer_id": "customer-0001",
        "first_name": "John",
        "last_name": "Doe",
        "email": "john.doe@example.com",
    },
)
print(res.json()["id"])
```

The response includes an `id`. Save it as `YUNO_CUSTOMER_ID`, the payment steps use it.

> [!TIP]
>
> **Gate passed when** `POST /v1/customers` answers `201`.
>
> * `401` means the key pair is wrong. Copy both sandbox keys again from **Developers**.
> * `404` with an empty body means `/v1` is missing from the base URL.

### 2. Connect the Yuno Test Payment Gateway and publish a route

The Yuno Test Payment Gateway simulates a card provider. It works in sandbox only and needs no credentials.

1. Open [Connections](https://dashboard.y.uno/connections), search for **Yuno Test Payment Gateway**, click **Connect**, name the connection, and click **Save**.
2. Open [Routing](https://dashboard.y.uno/routing), open the **Not published** tab, find **Card**, and click **Set Up**.
3. Click **+ Create new route**, name it, and click **Save**.
4. Click the arrow, choose **Add step**, select **Yuno Test Payment Gateway**, and click **Publish**.
5. Open [Checkout builder](https://dashboard.y.uno/checkout-builder), turn on **Card**, and publish the settings.

> [!TIP]
>
> **Gate passed when** a new checkout session lists `CARD`. Create a session as in step 4 and save its `checkout_session` as `YUNO_CHECKOUT_SESSION`. Then call [`GET /v1/checkout/sessions/{checkout_session}/payment-methods`](https://docs.y.uno/reference/checkout-sessions/retrieve-payment-methods-for-checkout) and look for `"type": "CARD"` in the list.
>
> If `CARD` is missing, check the three settings: the Test Payment Gateway is connected, the Card route is under **Published**, and Card is on in the Checkout builder.

### 3. Choose how the payment is created

The `workflow` field tells Yuno who creates the payment. Pick one, then use the matching tab in step 4.

| Workflow | Who creates the payment | Use it when |
| - | - | - |
| `SDK_SEAMLESS` | The SDK creates the payment | You want the fewest moving parts. Recommended |
| `SDK_CHECKOUT` plus a `createPayment` callback | Your backend creates it, from the one-time token the SDK hands you | You add order data, fraud checks or idempotency on your server |
| `DIRECT` | Your backend sends the raw card data | You have PCI DSS scope. Otherwise use it for sandbox tests only |

A session and an integration that disagree end in `INTERNAL_ERROR`. See [Get started with the Yuno SDK](https://docs.y.uno/docs/yuno-sdk/get-started.md) and [Direct flow](https://docs.y.uno/docs/direct-integration-use-cases/direct-flow.md) for each path in full.

> [!TIP]
>
> **Gate passed when** you can name the workflow you will send: `SDK_SEAMLESS`, `SDK_CHECKOUT` or `DIRECT`. The checkout session (SDK paths) or the payment (`DIRECT`) carries it in the `workflow` field.

### 4. Send the payment

> [tab] DIRECT
>
> > [!WARNING]
> >
> > Sending raw card numbers from your server is for sandbox testing. In production it requires PCI DSS scope. Otherwise use the Yuno SDK or Secure Fields to collect card data.
>
> The `DIRECT` workflow is a back-to-back payment where your server sends the card data. Use the customer `id` you saved as `YUNO_CUSTOMER_ID` in step 1.
>
> Create the payment with a test card. Send a new `X-Idempotency-Key` with each payment.
>
> ```bash cURL theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> curl --request POST \
>   --url https://api-sandbox.y.uno/v1/payments \
>   --header "public-api-key: $YUNO_PUBLIC_API_KEY" \
>   --header "private-secret-key: $YUNO_PRIVATE_SECRET_KEY" \
>   --header "X-Idempotency-Key: $(uuidgen)" \
>   --header "content-type: application/json" \
>   --data '{
>     "account_id": "'"$YUNO_ACCOUNT_ID"'",
>     "merchant_order_id": "order-0001",
>     "description": "First test payment",
>     "country": "US",
>     "amount": { "currency": "USD", "value": 25 },
>     "workflow": "DIRECT",
>     "customer_payer": { "id": "'"$YUNO_CUSTOMER_ID"'" },
>     "payment_method": {
>       "type": "CARD",
>       "detail": { "card": { "card_data": {
>         "number": "4507990000000002",
>         "expiration_month": 11,
>         "expiration_year": 28,
>         "security_code": "123",
>         "holder_name": "John Doe"
>       } } }
>     }
>   }'
> ```
>
> ```javascript Node.js theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> const res = await fetch("https://api-sandbox.y.uno/v1/payments", {
>   method: "POST",
>   headers: {
>     "public-api-key": process.env.YUNO_PUBLIC_API_KEY,
>     "private-secret-key": process.env.YUNO_PRIVATE_SECRET_KEY,
>     "X-Idempotency-Key": crypto.randomUUID(),
>     "content-type": "application/json",
>   },
>   body: JSON.stringify({
>     account_id: process.env.YUNO_ACCOUNT_ID,
>     merchant_order_id: "order-0001",
>     description: "First test payment",
>     country: "US",
>     amount: { currency: "USD", value: 25 },
>     workflow: "DIRECT",
>     customer_payer: { id: process.env.YUNO_CUSTOMER_ID },
>     payment_method: {
>       type: "CARD",
>       detail: { card: { card_data: {
>         number: "4507990000000002",
>         expiration_month: 11,
>         expiration_year: 28,
>         security_code: "123",
>         holder_name: "John Doe",
>       } } },
>     },
>   }),
> });
> const payment = await res.json();
> console.log(payment.status, payment.sub_status);
> ```
>
> ```python Python theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import os
> import uuid
> import requests
>
> res = requests.post(
>     "https://api-sandbox.y.uno/v1/payments",
>     headers={
>         "public-api-key": os.environ["YUNO_PUBLIC_API_KEY"],
>         "private-secret-key": os.environ["YUNO_PRIVATE_SECRET_KEY"],
>         "X-Idempotency-Key": str(uuid.uuid4()),
>     },
>     json={
>         "account_id": os.environ["YUNO_ACCOUNT_ID"],
>         "merchant_order_id": "order-0001",
>         "description": "First test payment",
>         "country": "US",
>         "amount": {"currency": "USD", "value": 25},
>         "workflow": "DIRECT",
>         "customer_payer": {"id": os.environ["YUNO_CUSTOMER_ID"]},
>         "payment_method": {
>             "type": "CARD",
>             "detail": {"card": {"card_data": {
>                 "number": "4507990000000002",
>                 "expiration_month": 11,
>                 "expiration_year": 28,
>                 "security_code": "123",
>                 "holder_name": "John Doe",
>             }}},
>         },
>     },
> )
> payment = res.json()
> print(payment["status"], payment["sub_status"])
> ```
>
> The payment succeeds when the response looks like this:
>
> ```json Response (trimmed) theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> {
>   "id": "6c44ed29-cc51-4479-a5eb-108afdaadd50",
>   "status": "SUCCEEDED",
>   "sub_status": "APPROVED",
>   "amount": { "currency": "USD", "value": 25 }
> }
> ```

> [tab] SDK\_SEAMLESS
>
> The `SDK_SEAMLESS` tab splits the work. Your server creates a checkout session, and the browser loads the SDK and starts the transaction.
>
> **On your server**, create the checkout session. Use `workflow: "SDK_SEAMLESS"` so the SDK creates the payment for you. Without it the transaction ends in `INTERNAL_ERROR`.
>
> ```bash cURL theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> curl --request POST \
>   --url https://api-sandbox.y.uno/v1/checkout/sessions \
>   --header "public-api-key: $YUNO_PUBLIC_API_KEY" \
>   --header "private-secret-key: $YUNO_PRIVATE_SECRET_KEY" \
>   --header "content-type: application/json" \
>   --data '{
>     "account_id": "'"$YUNO_ACCOUNT_ID"'",
>     "merchant_order_id": "order-0001",
>     "payment_description": "First test payment",
>     "country": "US",
>     "amount": { "currency": "USD", "value": 25 },
>     "workflow": "SDK_SEAMLESS"
>   }'
> ```
>
> ```javascript Node.js theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> const res = await fetch("https://api-sandbox.y.uno/v1/checkout/sessions", {
>   method: "POST",
>   headers: {
>     "public-api-key": process.env.YUNO_PUBLIC_API_KEY,
>     "private-secret-key": process.env.YUNO_PRIVATE_SECRET_KEY,
>     "content-type": "application/json",
>   },
>   body: JSON.stringify({
>     account_id: process.env.YUNO_ACCOUNT_ID,
>     merchant_order_id: "order-0001",
>     payment_description: "First test payment",
>     country: "US",
>     amount: { currency: "USD", value: 25 },
>     workflow: "SDK_SEAMLESS",
>   }),
> });
> const session = await res.json();
> console.log(session.checkout_session);
> ```
>
> ```python Python theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> import os
> import requests
>
> res = requests.post(
>     "https://api-sandbox.y.uno/v1/checkout/sessions",
>     headers={
>         "public-api-key": os.environ["YUNO_PUBLIC_API_KEY"],
>         "private-secret-key": os.environ["YUNO_PRIVATE_SECRET_KEY"],
>     },
>     json={
>         "account_id": os.environ["YUNO_ACCOUNT_ID"],
>         "merchant_order_id": "order-0001",
>         "payment_description": "First test payment",
>         "country": "US",
>         "amount": {"currency": "USD", "value": 25},
>         "workflow": "SDK_SEAMLESS",
>     },
> )
> print(res.json()["checkout_session"])
> ```
>
> **In the browser**, load the SDK from the CDN, then start a transaction with the `checkout_session` value from your server.
>
> ```html Browser theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> <div id="payment-form"></div>
> <script src="https://sdk-web.y.uno/v2.5.1/main.js"></script>
> <script>
>   async function startYuno() {
>     const sdkPayments = await SdkPayments.initialize("your-public-api-key");
>     const transaction = sdkPayments.transaction({
>       checkoutSession: "checkout-session-from-your-server",
>       countryCode: "US",
>       elementSelector: "#payment-form",
>       onStatus: (result) => console.log("Final status:", result.status),
>     });
>     await transaction.start({ paymentMethod: { type: "CARD" } });
>   }
>
>   if (window.SdkPayments) {
>     startYuno();
>   } else {
>     window.addEventListener("sdk-payments-ready", startYuno);
>   }
> </script>
> ```
>
> The form renders in `#payment-form`. Enter the test card **4507 9900 0000 0002**, expiry **11/28**, CVV **123**, name **John Doe**, then click Pay. The result arrives in `onStatus` with the status `SUCCEEDED`.
>
> For iOS, Android, and every option, see the [SDK Get started](https://docs.y.uno/docs/yuno-sdk/get-started.md).

> [tab] SDK\_CHECKOUT
>
> Your server creates the checkout session with `workflow: "SDK_CHECKOUT"`. The browser starts the transaction and passes a `createPayment` callback. The SDK hands the callback a one-time token, and your backend creates the payment from it.
>
> **On your server**, create the checkout session with the customer from step 1:
>
> ```bash cURL theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> curl --request POST \
>   --url https://api-sandbox.y.uno/v1/checkout/sessions \
>   --header "public-api-key: $YUNO_PUBLIC_API_KEY" \
>   --header "private-secret-key: $YUNO_PRIVATE_SECRET_KEY" \
>   --header "content-type: application/json" \
>   --data '{
>     "account_id": "'"$YUNO_ACCOUNT_ID"'",
>     "merchant_order_id": "order-0001",
>     "payment_description": "First test payment",
>     "country": "US",
>     "customer_id": "'"$YUNO_CUSTOMER_ID"'",
>     "amount": { "currency": "USD", "value": 25 },
>     "workflow": "SDK_CHECKOUT"
>   }'
> ```
>
> **In the browser**, start the transaction and override `createPayment`. Send `token.token` and `token.checkout_session` to your backend:
>
> ```html Browser theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> <div id="payment-form"></div>
> <script src="https://sdk-web.y.uno/v2.5.1/main.js"></script>
> <script>
>   async function startYuno() {
>     const sdkPayments = await SdkPayments.initialize("your-public-api-key");
>     const transaction = sdkPayments.transaction({
>       checkoutSession: "checkout-session-from-your-server",
>       countryCode: "US",
>       elementSelector: "#payment-form",
>       createPayment: async (token) => {
>         await fetch("/api/pay", {
>           method: "POST",
>           headers: { "content-type": "application/json" },
>           body: JSON.stringify({
>             token: token.token,
>             checkout_session: token.checkout_session,
>           }),
>         });
>       },
>       onStatus: (result) => console.log("Final status:", result.status),
>     });
>     await transaction.start({ paymentMethod: { type: "CARD" } });
>   }
>
>   if (window.SdkPayments) {
>     startYuno();
>   } else {
>     window.addEventListener("sdk-payments-ready", startYuno);
>   }
> </script>
> ```
>
> Settle the promise on every path, including a network failure, or the transaction stays in progress. See [`createPayment`](https://docs.y.uno/docs/yuno-sdk/controllers/create-payment).
>
> **On your server again**, your `/api/pay` handler creates the payment with `POST /v1/payments`. Send the token in `payment_method.token` and the session in `checkout.session`:
>
> ```javascript Node.js theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
> // token and checkoutSession come from the browser request body
> async function createPayment({ token, checkoutSession }) {
>   const res = await fetch("https://api-sandbox.y.uno/v1/payments", {
>     method: "POST",
>     headers: {
>       "public-api-key": process.env.YUNO_PUBLIC_API_KEY,
>       "private-secret-key": process.env.YUNO_PRIVATE_SECRET_KEY,
>       "X-Idempotency-Key": crypto.randomUUID(),
>       "content-type": "application/json",
>     },
>     body: JSON.stringify({
>       account_id: process.env.YUNO_ACCOUNT_ID,
>       merchant_order_id: "order-0001",
>       description: "First test payment",
>       country: "US",
>       amount: { currency: "USD", value: 25 },
>       customer_payer: { id: process.env.YUNO_CUSTOMER_ID },
>       payment_method: { token },
>       checkout: { session: checkoutSession },
>     }),
>   });
>   return res.json();
> }
> ```
>
> Enter the test card **4507 9900 0000 0002**, expiry **11/28**, CVV **123**, name **John Doe**, then click Pay. The response has the same shape as the `DIRECT` response above.

> [!TIP]
>
> **Gate passed when** the payment `status` is `SUCCEEDED` with the test card **4507 9900 0000 0002** (11/28, CVV 123, John Doe).

### 5. See the result

* Check `status` and `sub_status` in the response. `SUCCEEDED` with `APPROVED` means the gateway approved the payment.
* Open [Payments](https://dashboard.y.uno/payments) in the dashboard, find your payment, and open it to see its details.
* To receive the result on your server, [configure a webhook](https://docs.y.uno/docs/webhooks/configure-webhooks.md) and [verify its signature](https://docs.y.uno/docs/webhooks/verify-webhook-signatures-hmac.md) (HMAC).

Payment statuses are listed in [Payment statuses](https://docs.y.uno/reference/payments/status-and-response-codes/payment.md).

> [!TIP]
>
> **Gate passed when** the payment shows as `SUCCEEDED` in the dashboard **Payments** list and in the `status` field of your response.

## Next

> [card] [Go live](https://docs.y.uno/docs/go-live.md)
>
> Guide
> Live keys, a published route, verified webhooks and a first real payment.

## Troubleshooting

> [accordion] The API returns 401
>
> The `public-api-key` or `private-secret-key` header is missing or wrong. Sandbox and production use different keys, so check that you copied the sandbox keys from the dashboard in Test Mode. See [Authentication](https://docs.y.uno/reference/getting-started/authentication.md).

> [accordion] The payment ends in INTERNAL\_ERROR
>
> The `workflow` does not match your integration. Use `DIRECT` when your server sends the card, and `SDK_SEAMLESS` on the checkout session when the Web SDK creates the payment.

> [accordion] No provider processes the payment
>
> Card has no published route. Open [Routing](https://dashboard.y.uno/routing) and check that the Card route with the Yuno Test Payment Gateway is under the **Published** tab, and that Card is turned on in the [Checkout builder](https://dashboard.y.uno/checkout-builder).

> [accordion] The card is declined
>
> Test cards are specific to a provider. The cards in this Quickstart only work when your sandbox routes Card to the Yuno Test Payment Gateway. Other results are listed on the [Yuno Test Payment Gateway](https://docs.y.uno/docs/direct-integration-use-cases/yuno-testing-gateway.md) page.

Stuck on a term? See the [Glossary](https://docs.y.uno/docs/glossary.md). For URLs, keys, and specs see [Developers](https://docs.y.uno/docs/developers.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.