# 沙箱开发

{% hint style="info" %}
遇到 API 接入问题时，可登录 [Eva](https://www.atriptech.com/) 寻求帮助。
{% endhint %}

用这页在沙箱中完成并验证完整的 Atlas 集成。

### 本阶段目标

在沙箱里跑通端到端集成流程。

这一阶段既要覆盖 API 调用，也要覆盖 webhook 跟进。

### 沙箱可以验证什么

可在沙箱验证：

* 请求格式和请求头
* 搜索、验价、下单、支付和查询链路
* webhook 处理和后续逻辑
* 异常处理和边界场景
* UAT 准备情况

### 沙箱不能证明什么

沙箱**不能**证明：

* 真实库存质量
* 生产票价准确性
* 真实卡扣款行为
* 所有场景下的最终航司行为

沙箱票价和结果都只用于测试。

### 开始前准备

如果你还没确认凭证、网络和 happy path，先运行 [沙箱环境验证](/api-wen-dang/ji-cheng-zhi-nan/quick-start/sha-xiang-huan-jing-yan-zheng.md)。

先确认你已经具备：

* ATRIP 发放的沙箱凭证
* 正确的沙箱接口地址
* 已配置好的请求头
* 可用于测试的基础服务端集成

{% hint style="info" %}
沙箱基础地址是 `https://sandbox.atriptech.com/`。

把具体接口名拼在后面调用。

例如：`https://sandbox.atriptech.com/search.do`
{% endhint %}

{% hint style="info" %}
你也可以把 GitBook MCP 接入到常用 AI 工具中，让 AI 基于当前文档辅助生成示例代码、解释报错和梳理集成链路。使用方式见 [GitBook MCP 辅助开发](/api-wen-dang/ji-cheng-zhi-nan/gitbook-mcp-fu-zhu-kai-fa.md)。
{% endhint %}

### 开发清单

在沙箱中完成这些事项：

* 配置认证和请求头
* 将客户端指向沙箱
* 实现搜索、验价、下单、支付和查询
* 注册并验证 webhook
* 测试异常处理和边界场景

这一阶段要保存并复用：

* `routingIdentifier`
* `sessionId`
* `orderNo`

### 测试模式

在测试模式下：

* 预订是模拟的
* 不会向真实航司出票
* 票价是沙箱票价
* 测试凭证只能用于沙箱
* 生产凭证只能用于生产

测试模式适合验证：

* 请求构造
* 预订状态流转
* 支付与出票逻辑
* 预期错误处理
* webhook 和后续处理

### 沙箱票价说明

沙箱搜索结果来自 Atlas 沙箱数据。

覆盖范围和价格都不同于生产。

不要用沙箱价格做商业对比。

### 支付失败模拟

你可以在 `pay.do` 中触发常见 VCC 失败场景。

#### 触发支付拒绝

使用：

* 持卡人名字：`Reject`

预期结果：

* `604` — 航司拒绝支付

#### 触发 3DS 错误

使用：

* 持卡人名字：`Three DS`

预期结果：

* `616` — 3DS Authentication

这个模拟场景下，卡号和姓氏可任意填写。

### 沙箱参考数据

需要公开的沙箱输入时，可配合这些页面：

* [预订流程概览](/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan.md)
* [Webhook 概览](/api-wen-dang/ji-cheng-zhi-nan/webhook-gai-lan.md)
* [沙箱测试航线](/api-wen-dang/ji-cheng-can-kao/sha-xiang-ce-shi-shu-ju/sandbox-test-routes.md)
* [沙箱测试卡](/api-wen-dang/ji-cheng-can-kao/sha-xiang-ce-shi-shu-ju/sha-xiang-ce-shi-ka.md)
* [集成参考](/api-wen-dang/ji-cheng-can-kao.md)

### 完成标准

当你能在沙箱中稳定做到以下几点时，本阶段完成：

* 跑通端到端预订流程
* 保存并复用 `routingIdentifier`、`sessionId` 和 `orderNo`
* 验证所需支付路径
* 接收并处理所需 webhook 事件
* 复现预期成功和失败场景

### 本阶段产出

* 稳定的沙箱预订链路
* 已验证的 webhook 处理
* 可用于 UAT 的证据材料

### 下一步

沙箱流程稳定后，进入 [UAT 验证](/api-wen-dang/ji-cheng-zhi-nan/quick-start/uat-submission-guide.md)。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/quick-start/sha-xiang-kai-fa.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
