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

> ## Agent Instructions
> Treat these docs and the Whop MCP server as the source of truth for Whop API behavior. Don't infer endpoint behavior from marketing pages.
> MCP server: connect https://mcp.whop.com/mcp (streamable HTTP, browser sign-in, no API key in the client config) to search these docs and read or change live Whop data. Setup: https://docs.whop.com/developer/guides/ai_and_mcp.md
> Whop CLI: install with `curl -fsSL https://whop.com/install.sh | sh` to scaffold, run, and deploy Whop apps and websites. It acts on production, not the sandbox. Overview: https://docs.whop.com/cli/overview.md Agent mode: https://docs.whop.com/cli/agent-mode.md
> Hosting: Whop serves a site or app from the build `whop apps deploy` uploads, with rollbacks, secrets, and server logs. Guide: https://docs.whop.com/developer/websites/hosting.md
> Plugins: in Claude Code, run `/plugin marketplace add whopio/plugins`, then `/plugin install whop@whop`. Guide: https://docs.whop.com/developer/guides/plugins/claude-code.md Every agent tool: https://docs.whop.com/developer/ai/overview.md
> Environments: build and test in the sandbox (API `https://sandbox-api.whop.com/api/v1`, keys at https://sandbox.whop.com/dashboard/developer, SDK environment `Sandbox`; no real money). Production (API `https://api.whop.com/api/v1`, keys at https://whop.com/dashboard/developer, SDK environment `Production`, the SDK default) moves real money, so use it only at launch. The two share no accounts, keys, products, or webhooks, and their keys look identical: never mix them. Sandbox guide: https://docs.whop.com/developer/guides/sandbox.md Comparison: https://docs.whop.com/developer/quickstart.md
> API: send `Authorization: Bearer <API_KEY>` from your server only, and pin a dated version with the `Api-Version-Date` header. OpenAPI spec: https://api.whop.com/api/v1/openapi.json
> Which API: build on the Current API, whose pages live under https://docs.whop.com/api-reference/ (start at https://docs.whop.com/api-reference/overview.md). Pages under /api-reference/legacy/ are the Legacy API. Use one only when https://docs.whop.com/api-reference/stability.md lists the resource as Legacy-only.

# 샌드박스에서 테스트하기

> Whop SDK와 Elements를 샌드박스로 지정하고, 테스트 API 키와 웹훅을 생성하며, 테스트 카드로 결제를 시뮬레이션하고, 샌드박스의 제한 사항을 확인하세요.

Whop은 프로덕션 데이터에 영향을 주거나 실제 결제를 하지 않고 통합을 테스트할 수 있는 샌드박스 환경을 제공합니다.

## 샌드박스 URL

| 환경 | URL |
| - | - |
| 프론트엔드 | `https://sandbox.whop.com` |
| API | `https://sandbox-api.whop.com/api/v1` |

[sandbox.whop.com](https://sandbox.whop.com)에서 샌드박스 계정과 API 키를 생성하세요.

## 소프트웨어 개발 키트 구성

Whop SDK로 샌드박스 환경을 사용하려면 `Sandbox` 환경을 전달하세요. 환경은 SDK가 통신하는 모든 호스트를 지정하므로, 모든 요청이 한 번에 샌드박스로 이동합니다.

```typescript TypeScript theme={null}
import { WhopClient, WhopEnvironment } from "@whop/sdk";

const client = new WhopClient({
	token: process.env["WHOP_API_KEY"],
	environment: WhopEnvironment.Sandbox,
});
```

```python Python theme={null}
import os
from whop_sdk import Whop, WhopEnvironment

client = Whop(
    token=os.environ.get("WHOP_API_KEY"),
    environment=WhopEnvironment.SANDBOX,
)
```

```ruby Ruby theme={null}
require "whop_sdk"

client = Whop_sdk::Client.new(
  token: ENV.fetch("WHOP_API_KEY"),
  environment: Whop_sdk::Environment::SANDBOX,
)
```

```rust Rust theme={null}
use whop_sdk::prelude::*;

let config = ClientConfig {
    token: Some(std::env::var("WHOP_API_KEY").unwrap()),
    base_url: "https://sandbox-api.whop.com/api/v1".to_string(),
    ..Default::default()
};
let client = Whop::new(config).expect("Failed to build client");
```

```go Go theme={null}
import (
    "os"

    whopsdk "github.com/whopio/whopsdk-go/v2"
    "github.com/whopio/whopsdk-go/v2/client"
    "github.com/whopio/whopsdk-go/v2/option"
)

client := client.NewWhop(
    option.WithToken(os.Getenv("WHOP_API_KEY")),
    option.WithEnvironment(whopsdk.Environments.Sandbox),
)
```

> [!NOTE]
>
> `Sandbox` 환경은 SDK 2.0에서 도입되었습니다. 1.x에서는 대신 클라이언트를 `https://sandbox-api.whop.com/api/v1`로 지정하세요: TypeScript에서는 `baseUrl`, Python과 Ruby에서는 `base_url`, Go에서는 `option.WithBaseURL`을 사용합니다. TypeScript, Ruby, Go는 2.0에서도 이 재정의를 유지하지만, 모든 요청을 하나의 호스트로 보냅니다. 그러면 다른 호스트에 도달해야 하는 작업은 거부되므로 `environment`를 사용하세요. 2.0 Python 클라이언트에는 `base_url` 매개변수가 없습니다. Rust SDK는 아직 1.x이며 `base_url`을 유지합니다.

## 샌드박스의 Elements

[Whop Elements](https://docs.whop.com/ko/elements/latest/getting-started.md)를 샌드박스로 지정하려면 SDK 인스턴스를 생성할 때 `environment`를 설정하세요. 이 옵션은 구매자가 입력한 내용을 Elements가 보내는 위치를 변경하는 유일한 방법입니다.

변형을 선택하는 Elements 속성은 호환성을 위해 `plan`이라는 이름을 유지합니다.

```tsx React theme={null}
import { WhopElements, Payments, PaymentElement, BrandingElement } from "@whop/elements-react";
import { loadWhop } from "@whop/elements";

function App() {
	return (
		<WhopElements elements={loadWhop()} environment="sandbox">
			<Payments accountId="biz_xxxxxxxxxxxxx" plan="plan_xxxxxxxxxxxxx">
				<PaymentElement />
				<BrandingElement />
			</Payments>
		</WhopElements>
	);
}
```

```html JavaScript theme={null}
<script src="https://cdn.whop.com/elements/amber/elements.js" data-whop-elements></script>
<script type="module">
  const whop = window.WhopElements({ environment: "sandbox" });
  const payments = whop.payments.create({
    accountId: "biz_xxxxxxxxxxxxx",
    plan: "plan_xxxxxxxxxxxxx",
  });
  payments.create("payment").mount("#payment");
  payments.create("branding").mount("#branding");
</script>
```

## 애플리케이션 프로그래밍 인터페이스 키 및 웹훅

API 키와 웹훅은 샌드박스에서도 프로덕션과 동일하게 작동합니다:

* [sandbox.whop.com/dashboard/developer](https://sandbox.whop.com/dashboard/developer)에서 API 키를 생성하세요
* 샌드박스에서 이벤트를 수신하도록 웹훅을 구성하세요
* 동일한 인증 헤더(`Authorization: Bearer YOUR_API_KEY`)를 사용하세요

## 테스트 카드

샌드박스에서 결제를 시뮬레이션하려면 다음 테스트 카드 번호를 사용하세요:

| 카드 번호 | 설명 |
| - | - |
| `4242 4242 4242 4242` | 결제 성공 |
| `4000 0000 0000 0002` | 결제 거절 |
| `4000 0000 0000 0341` | 카드 설정은 성공하지만, 이후 청구는 프로세서가 거절함 |
| `5385 3083 6013 5181` | 3D Secure 필요(3DS 화면에서 `Checkout1!` 입력) |

프로덕션에서 거절된 결제에는 카드 발급사의 코드가 포함됩니다. [결제 거절 코드 설명](https://docs.whop.com/ko/payments-and-billing/payment-issues/payment-decline-reasons.md)에서 각 코드의 의미를 확인할 수 있습니다.

모든 테스트 카드에 대해:

* 미래의 아무 만료일이나 사용하세요(예: 12/34)
* 아무 3자리 카드 인증 코드나 사용하세요(예: 123)
* 아무 청구 주소나 사용하세요

카드는 성공적으로 저장되지만 저장된 카드에 대한 향후 청구가 실패하는 복구 흐름을 테스트하려면
`4000 0000 0000 0341`을 사용하세요.

## 샌드박스의 결제 수단

카드 결제를 테스트하려면 위의 [테스트 카드](#test-cards)를 사용하세요.

다음 수단도 각 제공업체의 자체 테스트 흐름을 통해 샌드박스에서 완료됩니다: PayPal, Bancontact, iDEAL, Cash App Pay, Pix, Boleto.

다음 수단은 아직 샌드박스에서 지원되지 않습니다:

* Apple Pay 및 Google Pay
* 은행 계좌(ACH)
* SEPA Direct Debit
* EU 은행 이체 및 전신 송금
* Alipay, WeChat Pay, MobilePay

## 알려진 제한 사항

> [!WARNING]
>
> 다음 기능은 샌드박스에서 사용할 수 없습니다:

* 지급
* 암호화폐 입금 및 온체인 이체
* Discord 다이렉트 메시지 및 역할 동기화
* 최신 검색 결과
* 사기 검토 및 다이제스트 이메일 등 프로덕션에서 실행되는 일부 예약 및 백그라운드 작업


## Related topics

- [인증 및 API 키](https://docs.whop.com/ko/developer/guides/auth-scoping.md)
- [AI 및 MCP](https://docs.whop.com/ko/developer/guides/ai_and_mcp.md)
- [체크아웃 임베드하기](https://docs.whop.com/ko/developer/guides/embed-checkout.md)
