Introspection API
Overview
This API is to verify the JWT transaction token notified to the application when complete to payment the item.
How to Authorize
To use this API, an access token which retrieve by the grant_type and scope described on the following table must be specified on the Authorization request header.
- Authorization Type
- Bearer
- Supported grant_type
- client_credentials_grant
- The necessary scope
- transactionToken:introspect
Endpoint URL
Endpoint URL in each environment will be following.
| item | description |
|---|---|
| HTTP Method | POST |
| Request URI | sandbox java https://sb-api.andapp.jp/1.0.0/payment/introspection production java https://api.andapp.jp/1.0.0/payment/introspection |
Request header
Request header is as follows.
| name | value | required | description |
|---|---|---|---|
| Content-Type | application/json | true |
Request body
You can set the JSON string with the following parameters.
| property | title | type | required | description |
|---|---|---|---|---|
| transactionToken | Transaction token | string | true | The JWT transaction token to notify to the application when complete to payment the item. |
Request Example
Request example is as follows.
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..."
}
Response Status
The response status when succeeded is as follows.
| status | description |
|---|---|
| 200 OK | It will be returned if the Transaction Token is valid. |
Response Header
Response header is as follows.
| name | value | required | description |
|---|---|---|---|
| Content-Type | application/json | true |
Response Body
The JSON string with the following parameters is sent. Please refer to the example below for details.
| property | title | type | required | description |
|---|---|---|---|---|
| iss | Issuer claim | string | true | The URI that represents the issuer. The following value is specified depending on each environment. sandbox https://sb-api.andapp.jp/1.0.0/payment
Production https://api.andapp.jp/1.0.0/payment
|
| sub | Subject claim | string | true | The URI which represents the player who made the payment. The following URI format (URI Template) is specified depending on each environment. sandbox https://sb-api.andapp.jp/1.0.0/users{/playerId}
Production https://api.andapp.jp/1.0.0/users{/playerId}
|
| aud | Audience claim | string | true | Will URI representing the game of Client ID, which was carried out a payment request. By the execution environment will be URI format (URI Template format) as follows. sandbox https://sb-api.andapp.jp/1.0.0/clients{/clientId}
Production https://api.andapp.jp/1.0.0/clients{/clientId}
|
| typ | Token type | string | true | Fixed value: "transaction_token". |
| iat | UNIX timestamp of the issue date and time | integer | true | The UNIX timestamp when the transaction_token issued. |
| exp | UNIX time stamp of the expiration date and time | integer | true | The UNIX timestamp which represents the date and time when the transaction_token is expired. The Transaction Token is invalid after the expiration date and time. |
| transaction | Transaction object | object | true |
|
| transaction.id | Transaction ID | integer | true | Up to 16 digits |
| transaction.product | Product objects that were purchased | object | true | |
| transaction.clientId | Client ID that created the transaction object | integer | true | Up to 16 digits |
| transaction.userId | Player ID that created the transaction object | integer | true | Up to 16 digits |
| transaction.product.id | ID of product object | string | true | |
| transaction.product.clientId | Client ID that created the product object | integer | true | Up to 16 digits |
| transaction.product.type | Product type | string | true | Fixed value: "CONSUMABLE". |
| transaction.product.state | The state of the product | string | true | Fixed value: "AVAILABLE". |
| transaction.product.prices | Currency by tax-inclusive price list of products | array | true | |
| transaction.product.prices[] | Currency by tax-inclusive price object of the product | object | true | |
| transaction.product.prices[].value | price | number | true | |
| transaction.product.prices[].currency | Currency unit | string | true | Fixed value: "JPY" |
| transaction.product.prices[].taxRate | tax rate(%) | number | true | Between 0 and 100. |
| transaction.product.language | language | string | true | Fixed value: "ja-JP" |
| transaction.product.title | Name of Product | string | true | |
| transaction.product.description | Product description sentence | string | true | |
| transaction.product.createdAt | UNIX time stamp of the product of the creation date and time | integer | true | |
| transcation.product.updatedAt | UNIX time stamp of the product update date and time of | integer | true | |
| transaction.quantity | Purchase number | integer | true | |
| transaction.totalPrice | Tax total purchase price object | object | true | |
| transaction.totalPrice.value | Total Price | number | true | |
| transaction.totalPrice.currency | Currency unit | string | true | Fixed value: "JPY". |
| transaction.totalPrice.taxRate | tax rate(%) | number | true | Between 0 and 100. |
| transaction.state | The state of the transaction | string | true | Fixed value: "PURCHASED". |
| transaction.developerPayload | Any of the payload that has been specified by the developer at the time of payment request | string | true | |
| transaction.refundTo | Transaction ID of the refund destination | integer | true | Fixed value: null |
| transaction.refundedBy | Refund the original transaction ID | integer | true | Fixed value: null |
| transaction.consumedAt | UNIX time stamp of product consumption date and time | integer | true | Fixed value: null |
| transaction.purchasedAt | UNIX time stamp of payment fixed date | integer | true | |
| transaction.createdAt | UNIX time stamp of the transaction of the creation date and time | integer | true | |
| transaction.updatedAt | UNIX time stamp of the transaction update date and time of | integer | true | |
| developerPayload | Fields that developers can be any input | string | true | This length is between 0 and 4096. By default, it contains the "". |
Response Example
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": "Item Name",
"description": "Description of Item",
"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
}
}
Error Response
Error response will be returned in the application/problem+json format. The status code and the value of the type property of Problem Type is as follows.
| status | title | type | description |
|---|---|---|---|
| 400 | Invalid JWT Format | about:blank | The format of the transaction token is not JWT. |
| 400 | Invalid JOSE Header | about:blank | The JOSE Header of the transaction token is incorrect value. |
| 400 | Invalid JWT Claims | about:blank | The JWT Claims of the transaction token is illegal value. |
| 403 | Signature is not verified | about:blank | The signature of the transaction token is invalid. |
| 403 | Unexpected audience | about:blank | The Client which calls this API and the Client represented by the aud claim of the transaction token are not same. |
| 403 | Expired token | about:blank | The transaction token was already expired. |
| 403 | Withdrawal user | about:blank | The user is restricted. |
| 500 | Server Error | about:blank | The error occurs on the API server. |
| 503 | Service Unavailable | about:blank | The API server can't answer temporary. |
Error Response Example
The example of an error response is as follows.
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"
}
Change log
- 2017/02/07
- Added the maximum number of digits of the following
-
transaction.id
transaction.clientId
transaction.userId
transaction.product.clientId
-
- Added the maximum number of digits of the following
- 2016/10/05
- Description of transaction.clientId and transaction.userId in response body we added because it was missing.
- Added descriptions of the transaction.clientId and transaction.userId on the Response Body section.
- 2016/10/03
- Added the error code when a user is restricted.
- 2016/07/28
- Create