メインコンテンツまでスキップ

Introspection API

概要

アイテム決済完了時、アプリケーションに通知される JWT 形式のトランザクショントークンの検証を行う API です。

認可方法​

この API を利用する為には表に示す grant_type, scope で取得した access token を Authorization リクエストヘッダに指定する必要があります。

  • 認可タイプ
    • Bearer
  • 対応している grant_type
    • client_credentials_grant
  • 必要な scope
    • transactionToken:introspect

エンドポイント URL​

各環境におけるエンドポイント URL は下記になります。

itemdescription
HTTP MethodPOST
Request URIsandbox java https://sb-api.andapp.jp/1.0.0/payment/introspection 本番環境 java https://api.andapp.jp/1.0.0/payment/introspection

リクエストヘッダー​

リクエストヘッダーは以下になります。

namevaluerequireddescription
Content-Typeapplication/jsontrue 

リクエスト本文​

下記パラメータを持つ JSON 文字列を設定できます。

propertytitletyperequireddescription
transactionTokenトランザクショントークンstringtrueアイテム決済完了時、アプリケーションに通知される JWT 形式のトランザクショントークンです。

リクエスト例​

リクエスト例は以下のようになります。

POST /1.0.0/payment/introspection HTTP/1.1
Host: sb-api.andapp.jp:443
Content-Type: application/json
Authorization: Bearer {access_token}

{
"transactionToken": "eyj..."
}

レスポンスステータス​

成功時のレスポンスステータスに関しては以下のようになります。

statusdescription
200 OKTransaction Token が妥当な場合に返されます。

レスポンスヘッダー​

レスポンスヘッダーは以下のようになります。

namevaluerequireddescription
Content-Typeapplication/jsontrue 

レスポンス本文​

下記パラメータを持つ JSON 文字列。詳細は下記の例を参照してください。

propertytitletyperequireddescription
issIssuer クレームstringtrue

発行者を表す URI です。

実行環境によって以下のような値になります。

sandbox
https://sb-api.andapp.jp/1.0.0/payment
本番環境
https://api.andapp.jp/1.0.0/payment
subSubject クレームstringtrue

支払いを行ったプレイヤーを表す URI になります。

実行環境によって以下のような URI 形式 (URI Template 形式) になります。

sandbox
https://sb-api.andapp.jp/1.0.0/users{/playerId}
本番環境
https://api.andapp.jp/1.0.0/users{/playerId}
audAudience クレームstringtrue

支払い要求を行ったゲームの Client ID を表す URI になります。

実行環境によって以下のような URI 形式 (URI Template 形式) になります。

sandbox
https://sb-api.andapp.jp/1.0.0/clients{/clientId}
本番環境
https://api.andapp.jp/1.0.0/clients{/clientId}
typトークン種別stringtruetransaction_token の固定値です
iat発行日時の UNIX タイムスタンプintegertrue

transaction_token が発行された日時を表す UNIX タイムスタンプ値です

exp失効日時の UNIX タイムスタンプintegertruetransaction_token が無効になる日時を表す UNIX タイムスタンプ値です
失効日時を超えた Transaction Token は無効になります
transactionトランザクション オブジェクトobjecttrue

 

transaction.idトランザクション IDintegertrue最大 16 桁
transaction.product購入したプロダクト オブジェクトobjecttrue 
transaction.clientIdトランザクション オブジェクトを作成した クライアント IDintegertrue最大 16 桁
transaction.userIdトランザクション オブジェクトを作成した プレイヤー IDintegertrue最大 16 桁
transaction.product.idプロダクト オブジェクトの IDstringtrue 
transaction.product.clientIdプロダクト オブジェクトを作成したクライアント IDintegertrue最大 16 桁
transaction.product.typeプロダクト種別stringtrueCONSUMABLE の固定値です
transaction.product.stateプロダクトの状態stringtrueAVAILABLE の固定値です
transaction.product.pricesプロダクトの通貨別税込み価格リストarraytrue 
transaction.product.prices[]プロダクトの通貨別税込み価格オブジェクトobjecttrue 
transaction.product.prices[].value価格numbertrue 
transaction.product.prices[].currency通貨単位stringtrueJPY の固定値です
transaction.product.prices[].taxRate税率(%)numbertrue0-100 までの値です
transaction.product.language言語stringtrueja-JP の固定値です
transaction.product.titleプロダクトの名称stringtrue 
transaction.product.descriptionプロダクトの説明文stringtrue 
transaction.product.createdAtプロダクトの作成日時の UNIX タイムスタンプintegertrue 
transaction.product.updatedAtプロダクトの更新日時の UNIX タイムスタンプintegertrue 
transaction.quantity購入個数integertrue 
transaction.totalPrice税込み合計購入価格オブジェクトobjecttrue 
transaction.totalPrice.value合計価格numbertrue 
transaction.totalPrice.currency通貨単位stringtrueJPY の固定値です
transaction.totalPrice.taxRate税率(%)numbertrue0-100 までの値です
transaction.stateトランザクションの状態stringtruePURCHASED の固定値です
transaction.developerPayload支払い要求時にデベロッパーによって指定された任意のペイロードstringtrue 
transaction.refundToリファンド先のトランザクション IDintegertruenullの固定値です
transaction.refundedByリファンド元のトランザクション IDintegertruenullの固定値です
transaction.consumedAtプロダクト消費日時の UNIX タイムスタンプintegertruenullの固定値です
transaction.purchasedAt支払い確定日時の UNIX タイムスタンプintegertrue 
transaction.createdAtトランザクションの作成日時の UNIX タイムスタンプintegertrue 
transaction.updatedAtトランザクションの更新日時の UNIX タイムスタンプintegertrue 
developerPayloadデベロッパーが任意入力できるフィールドstringtrue0-4096 文字. デフォルトでは "" が入ります。

レスポンス例​

HTTP/1.1 200 OK
Content-Type: application/json

{
"iss": "https://sb-api.andapp.jp/1.0.0/payment",
"sub": "https://sb-api.andapp.jp/1.0.0/users/6104524",
"aud": "https://sb-api.andapp.jp/1.0.0/clients/189268204754",
"typ": "transaction_token",
"iat": 1464095267,
"exp": 1464096167,
"transaction": {
"id": 1234567890123456,
"clientId": 189268204754,
"userId": 1234567890123456,
"product": {
"id": "xxx.yyy.zzz.3000",
"clientId": 189268204754,
"type": "CONSUMABLE",
"state": "AVAILABLE",
"prices": [
{ "value": 3240, "currency": "JPY", "taxRate": 8 }
],
"language": "ja-JP",
"title": "アイテム名",
"description": "アイテムの説明",
"createdAt": 1463468400,
"updatedAt": 1463468400
},
"quantity": 2,
"totalPrice": { "value": 6480, "currency": "JPY", "taxRate": 8 },
"state": "PURCHASED",
"developerPayload": "",
"refundTo": null,
"refundedBy": null,
"consumedAt": null,
"purchasedAt": 1463468400,
"createdAt": 1463468400,
"updatedAt": 1463468400
}
}

エラーレスポンス​

エラーレスポンスは application/problem+json 形式で応答されます。ステータスコードと Problem Type の type プロパティの値は以下のようになります。

statustitletypedescription
400Invalid JWT Formatabout:blank

トランザクショントークンの形式が JWT 形式でない場合

400Invalid JOSE Headerabout:blankトランザクショントークンの JOSE Header の形式が不正な値の場合
400Invalid JWT Claimsabout:blank

トランザクショントークンの JWT Claims の形式が不正な値の場合

403Signature is not verifiedabout:blank

トランザクショントークンの署名が妥当ではない場合

403Unexpected audienceabout:blank

この API を呼び出した Client とトランザクショントークンの aud クレームが表す Client が一致しない場合

403Expired tokenabout:blank

トランザクショントークンが失効している場合に返されます

403

Withdrawal user

about:blankユーザーに制限が課せられている場合に返されます。
500Server Errorabout:blankAPI サーバー側のエラーが発生した場合に返されます
503Service Unavailableabout:blankAPI サーバーが一時的に応答出来ない場合に返されます

エラーレスポンス例​

エラーレスポンスの例は以下のようになります。

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
 
{
"type": "about:blank",
"title": "Bad Request",
"code": 400,
"instance": "https://sb-api.andapp.jp/1.0.0/payment/introspection"
}

更新履歴​

  • 2017/02/07
    • 以下の最大桁数を追加
      • transaction.id

        transaction.clientId

        transaction.userId

        transaction.product.clientId

  • 2016/10/05
    • レスポンス本文に transaction.clientId と transaction.userId の説明が抜けていたので追記しました。
  • 2016/10/03
    • ユーザーに制限が課せられている場合のエラーコードを追記しました。
  • 2016/07/28
    • 新規作成