Bank Debit

This page is not available in English.
Please select another language.

概要

ゲーム内仮想通貨でアイテム購入をおこなうAPIです。トランザクションの作成とキャンセルを処理します。

モバコインによるアイテム課金の詳細についてはチュートリアルもご参照下さい。
imageUrl には、https プロトコルの画像を指定して下さい。http プロトコルを指定するとブラウザで警告が出る場合があります。

Bank Debit オブジェクトフィールド

Bank Debit API へリクエストを行うと、Bank Debit オブジェクトが返却されます。

パラメータ名

説明

published

トランザクションが作成された時間

comment

トランザクションに対するコメント

id

トランザクション ID

updated

トランザクションが更新された時間

items

アイテム配列。ただいまアイテムは 1 つだけ指定可能

items[].item

下記パラメータを持つオブジェクト

items[].item.imageUrl

アイテム画像の URL (https)

items[].item.name

アイテム名

items[].item.id

購入対象アイテム ID

items[].item.price

アイテム価格

items[].item.description

アイテムの説明文

items[].quantity

本トランザクションで購入するアイテム個数

state

トランザクションのステート

エンドポイントURL

Sandbox環境

https://sb-app.mobage.jp/social/api/restful/v2.02/bank/debit/{appid}/{transactionId}

本番環境

https://app.mobage.jp/social/api/restful/v2.02/bank/debit/{appid}/{transactionId}

APIリクエスト

HTTP メソッド

  • Authorization Code Grant
    • POST トランザクションの新規作成。
    • PUT 作成されたトランザクションの状態を更新します。(キャンセルへのみ変更可能です)
    • GET 指定トランザクションの情報を取得します。
  • Client Credentials Grant
    • サポートしていません

署名方式

OAuth2

リクエストヘッダー

  • Authorization は必須になります。例に示した "Authorization: Bearer oauth2_token" を HTTP ヘッダーに追加して下さい。
  • Content-Type: application/json; charset=utf-8

APIレスポンス

HTTPステータスコード

HTTP ステータスメッセージ

説明

200

OK

データ取得が成功した場合

201

Created

データ取得が生成した場合

202

Accepted

データの更新が成功した場合

400

Bad Request

クライアント側のリクエストデータが不正です

401

Unauthorized

認証エラーです

403

Forbidden

リソースは存在するが認証エラー以外の理由でアクセス出来ない場合です

404

Not Found

存在しないリソースです

500

Internal Server Error

API サーバー側のエラーです

503

Service Unavailable

一時的に API が利用不可となっている場合です

サンプル

ゲームアイテム購入するためにトランザクションの新規作成

リクエスト形式

POST /social/api/restful/v2.02/bank/debit/@app
Authorization: Bearer 1126d0ba1d9e48ed3542c450318811b3
Content-Type: application/json; charset=utf-8
 
{
	 "items":[{
	   "item":{
	    "id":"item_1",
	    "name":"Sample Item",
	    "price":100,
	    "description":"This is a sample item",
	    "imageUrl":"https://mobage.com/homepage-assets/images/icon.png"
	  },
   "quantity":2
	}],
	"comment":"Purchase of 2 Sample Item(s)",
 "state":"new"
}

レスポンス形式

201 Created

 

作成されたトランザクションをキャンセルします。

リクエスト形式

PUT /social/api/restful/v2.02/bank/debit/@app/EBF8C5E8-D722-3F49-8F2F-60595A4C6F30?fields=state
Authorization: Bearer 1126d0ba1d9e48ed3542c450318811b3
Content-Type: application/json; charset=utf-8

{"state":"canceled"}

レスポンス形式

202 Accepted

{
	"published":"2013-09-29T12:28:26",
	"comment":"Purchase of 2 Sample Item(s)",
	"id":"EBF8C5E8-D722-3F49-8F2F-60595A4C6F30",
	"updated":"2013-09-29T12:29:36",
	"items":[{
	   "item":{
	    "imageUrl":"https://mobage.com/homepage-assets/images/icon.png",
	    "name":"Sample Item",
	    "id":"item_1",
	    "price":100,
	    "description":"This is a sample item"
		 },
	   "quantity":2
	}],
	"state":"canceled"
}

指定トランザクションの情報を複数取得します。

リクエスト形式

GET /social/api/restful/v2.02/bank/debit/@app/72FECA23-7E18-3E2B-BF81-305ED540DC39,5E61A3EB-8DCA-385C-94CE-A18294560F4B 
Authorization: bearer 6d796a30388f217db3dcff0d513e4206

レスポンス形式

200 OK

{
 "entry":[
	{
		"published":"2013-09-29T13:02:30",
		"comment":"Purchase of 2 Sample Item(s)",
		"id":"72FECA23-7E18-3E2B-BF81-305ED540DC39",
		"updated":"2013-09-29T13:02:30",
		"items":[{
		  "item":{
		   "imageUrl":"https://mobage.com/homepage-assets/images/icon.png",
		   "name":"Sample Item",
		   "id":"item_1",
		   "price":100,
		   "description":"This is a sample item"
		  },
		  "quantity":2
		}],
		"state":"new"
	},
	{
		"published":"2013-09-29T13:01:10",
		"comment":"Purchase of 2 Sample Item(s)",
		"id":"5E61A3EB-8DCA-385C-94CE-A18294560F4B",
		"updated":"2013-09-29T13:01:10",
		"items":[{
		  "item":{
		   "imageUrl":"https://mobage.com/homepage-assets/images/icon.png",
		   "name":"Sample Item",
		   "id":"item_1",
		   "price":100,
		   "description":"This is a sample item"
		  },
		  "quantity":2
		}],
		"state":"new"
	}
 ],
 "startIndex":1,
 "sorted":false,
 "itemsPerPage":2,
 "updatedSince":false,
 "totalResults":2,
 "filtered":false
}

更新履歴

  • 2016/03/16
    • PUT リクエストはキャンセルのみ利用可能なため、ドキュメントを修正
  • 2015/06/30
    • imageUrl に https の画像を設定する必要があったため、ドキュメントを修正

PREVIOUS

User Chat Channel

NEXT

Bank Inventory