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

# AceDataCloud プラットフォーム注文ステータスの更新

> Platform API guide - Ace Data Cloud

注文に対応する支払い方法の最新ステータスを能動的に照会し、プラットフォームに同期します。このリクエストは支払いサービスにアクセスして注文ステータスを変更する可能性があるため、コールバックが遅延している場合、または直ちに確認が必要な場合にのみ使用してください。

## 事前準備

* [Account Token](https://platform.acedata.cloud/documents/platform-token) を使用します。
* [注文リスト](https://platform.acedata.cloud/documents/platform-order-list)から自身の注文 ID を取得します。

```shell theme={null}
export PLATFORM_TOKEN='あなたのアカウントトークン'
export ORDER_ID='あなたの注文 ID'
```

## API 概要

| 項目 | 内容 |
| - | - |
| メソッド | `POST` |
| URL | `https://platform.acedata.cloud/api/v1/orders/{order_id}/refresh/` |
| 認証 | 注文所有者またはスーパー管理者 |
| Body | 通常は空です。PayPal コールバックのシナリオでは `payer_id` / `PayerID` が必要になる場合があります |

```shell theme={null}
curl -X POST \
  "https://platform.acedata.cloud/api/v1/orders/${ORDER_ID}/refresh/" \
  -H "Authorization: Bearer ${PLATFORM_TOKEN}"
```

成功すると、更新後の完全な Order オブジェクトを返します。`state` を使用して結果を判断し、`finished_at` を完了時刻として使用してください。現在のモデルには `paid_at` フィールドはありません。ステータス値には `Pending`、`Paid`、`Finished`、`Expired`、`Failed`、`Refunded` があります。

支払い期限は、まだ `Pending` 状態の注文のみを `Expired` に変更します。返金済みの `Refunded` 注文は、更新時または遅延した支払いコールバックを受信した後も、返金済みの状態を維持します。

## 再試行に関する推奨事項

* 通常の支払いでは、プラットフォームのコールバックを優先して利用してください。ステータスが長時間更新されない場合にのみ、能動的に refresh を行ってください。
* 固定の高頻度ポーリングは行わないでください。指数バックオフを推奨し、明確な終端状態になった後は停止してください。
* `401` はトークンが無効であることを示します。`403` は注文所有者ではないことを示します。`404` は注文が存在しないことを示します。
* 支払いサービスの照会に失敗した場合は、注文 ID と trace ID を保持して後で再試行してください。ステータス確認の代わりに重複した注文を作成しないでください。

## 関連 API

* [注文詳細を取得](https://platform.acedata.cloud/documents/platform-order-detail)
* [注文を支払う](https://platform.acedata.cloud/documents/platform-order-pay)
* [注文リストを取得](https://platform.acedata.cloud/documents/platform-order-list)


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