跳到主要内容

Payment

概要​

アイテム購入トランザクションを開始する API です。


Payment オブジェクトフィールド​

アイテム購入トランザクションを表現するオブジェクトです。

値説明型名前空間補足
idPayment オブジェクトの id 値ですxs:stringhttp://ns.dena.jp/mbga/gameapi/v1UUID 形式
appIdこの決済トランザクションを行うアプリケーションの id ですxs:inthttp://ns.dena.jp/mbga/gameapi/v1–
userIdこの決済トランザクションを行うユーザーの guid ですxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
statusこの決済トランザクションのステータス値ですxs:inthttp://ns.dena.jp/mbga/gameapi/v1–
entryPaymentEntry オブジェクトです(entryの複数指定は非対応です)mbga:PaymentEntry (unbounded)http://ns.dena.jp/mbga/gameapi/v1–
callbackUrlパートナー様側の決済完了通知用の URLxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
finishUrlパートナー様側の決済終了画面用の URLxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
endpointUrlこの決済トランザクションを実行する決済画面の URLxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
published生成日時xs:dateTimehttp://ns.dena.jp/mbga/gameapi/v1GMT
updated更新日時xs:dateTimehttp://ns.dena.jp/mbga/gameapi/v1GMT
备注

API からのレスポンスに含まれる xsd:dateTime 型の形式にはタイムゾーン指定子は含まれていません。従って GMT (グリニッジ標準時)での表記となっております。

status カラム値​

値説明
0決済開始時
1エラー
10成功

PaymentEntry オブジェクトフィールド​

アイテム購入トランザクションに含まれる各アイテムの情報を表すオブジェクトです。

値説明型名前空間補足
paymentIdPayment オブジェクトの idxs:stringhttp://ns.dena.jp/mbga/gameapi/v1UUID 形式
itemIdパートナー様がアイテムを区別する為の識別子です。xs:inthttp://ns.dena.jp/mbga/gameapi/v1–
nameアイテムの名称ですxs:stringhttp://ns.dena.jp/mbga/gameapi/v164byte まで
unitPriceアイテムの単価ですxs:inthttp://ns.dena.jp/mbga/gameapi/v1–
amountアイテムの購入個数ですxs:inthttp://ns.dena.jp/mbga/gameapi/v1255 が上限
imageUrlアイテム画像のある URL ですxs:stringhttp://ns.dena.jp/mbga/gameapi/v1gif 画像のみ
descriptionアイテムの説明文ですxs:stringhttp://ns.dena.jp/mbga/gameapi/v1255byte まで

API リクエスト​

HTTP メソッド​

Proxy モデル

  • GET
    • Payment エントリの取得
  • POST
    • Payment エントリの作成

Trusted モデル

  • GET
    • Payment エントリの取得

エンドポイント URL​

  • Sandbox 環境

    http://sb.sp.app.mbga.jp/api/restful/v1/payment/{guid}/{selector}/{appid}{-prefix|/|paymentId}
  • 本番環境

    http://sp.app.mbga.jp/api/restful/v1/payment/{guid}/{selector}/{appid}{-prefix|/|paymentId}

URI Template パラメータ​

guid​

guid パラメータは下記のいずれかの値を指定します。

値説明備考
@meviewer の guid を表します必須 (POST時)
{guid}決済を行ったユーザーの guid 値任意 (GET 時)
selector​

selector パラメータは下記のいずれかの値を指定します。

値説明備考
@selfviewer の Payment コレクションリソース全体を表します必須
appid​

appid パラメータは下記のいずれかの値を指定します。

値説明備考
@app現在実行中の application id必須
paymentId​

paymentId パラメータは下記のいずれかの値を指定します

値説明備考
{paymentId}uuid 形式の文字列です任意

クエリパラメータ​

下記のクエリパラメータを指定する事が出来ます。

format​

レスポンス形式を指定する事が出来ます。

値説明備考
json"application/json; charset=utf8"任意、デフォルト値

API レスポンス​

レスポンスコード​

API のレスポンスコードは以下のいずれかになります。

リクエスト HTTP メソッドレスポンスコードレスポンスメッセージ説明
GET200OK正常にエントリの取得が完了しました
GET400Bad Requestリクエストデータが不正です
GET404Not Found存在しないエントリです
GET500Internal Server ErrorAPI 側の問題による失敗です
POST201Created正常にデータ生成が完了しました
POST400Bad Requestリクエストデータが不正です
POST401UnauthorizedOAuth による認可が失敗しています
POST403Forbidden認証エラー以外の理由でアクセス出来ない場合です
POST500Internal Server ErrorAPI 側の問題による失敗です
–405Method Not Allowedメソッドが許可されていません

注意事項​

  • 決済 id は uuid 形式となっております。

  • Payment エントリの取得時に Trusted Model (Consumer Request) でのアクセスが可能です。その際は guid パラメータに '@me' ではなく、ユーザーの guid 値を設定して下さい。

  • 決済エントリの総額 (unitPrice×amount) が10万を超えた場合には、endpointUrl (=決済ページ) でエラーとなります。

  • Payment エントリの作成 (POST) 時にユーザーがそのアプリケーションをインストールしていない場合やTrustedモデルでリクエストされた場合に、レスポンスコードは 403 が返ります。

  • Payment エントリの作成 (POST) 時にamountの購入上限個数の255以上が値に設定された場合、レスポンスコードは 400 が返ります。

  • Payment エントリの取得 (GET) 時に存在しない paymentId を指定しリクエストされた場合、レスポンスコードは 404 が返ります。

  • Payment エントリの取得 (GET) 時にユーザーがそのアプリケーションをインストールしていない場合に、レスポンスコードは 403 が返ります。


    サンプル​

    Payment の追加​

    新しい決済トランザクションを開始する為の Payment エントリを追加する例です。

    备注

PaymentEntryオブジェクトは複数指定に対応しておりません。 :::

リクエスト形式​

POST /api/restful/v1/payment/@me/@self/@app
Content-Type: application/json; charset=utf8

{
"callbackUrl": "http://example.com/callback",
"finishUrl": "http://exaple.com/finish",
"entry": [
{
"itemId": 12,
"name": "バースト猛",
"unitPrice": 100,
"amount": 3,
"description": "バースト毒の強化版です",
"imageUrl": "http://example.com/img/item/12.gif"
}
]
}

レスポンス形式​

201 Created
Content-Type: application/json; charset=utf-8
Location: http://sb.sp.app.mbga.jp/api/restful/v1/payment/@me/@self/@app/1807AD76-C302-3DF6-BC91-1709EC8F8FB5

{
"startIndex" : 1,
"payment" : {
"finishUrl" : "http://example.com/finish",
"entry" : [
{
"itemId" : 12,
"amount" : 3,
"imageUrl" : "http://example.com/img/item/12.gif",
"paymentId" : "1807AD76-C302-3DF6-BC91-1709EC8F8FB5",
"name" : "バースト猛",
"unitPrice" : 100,
"description" : "バースト毒の強化版です"
}
],
"status" : 0,
"userId" : " sb.sp.app.mbga.jp:100000",
"published" : "2009-12-04T08:03:32",
"endpointUrl" : " http://sb.sp.app.mbga.jp/_pf_pay_confirm?p=1807AD76-C302-3DF6-BC91-1709EC8F8FB5&app_id=12000001",
"appId" : 12000001,
"callbackUrl" : "http://example.com/callback",
"id" : "1807AD76-C302-3DF6-BC91-1709EC8F8FB5",
"updated" : "2009-12-04T08:03:32"
},
"itemsPerPage" : 1,
"totalResults" : 1
}

Payment エントリの取得​

既に存在する Payment エントリを取得します。

リクエスト形式​

GET http://sb.sp.app.mbga.jp/api/restful/v1/payment/@me/@self/@app/3E37C512-6891-35C1-84FE-B081B5443997?format=json

レスポンス形式​

200 OK
Content-Type: application/json
Client-Date: Tue, 16 Feb 2010 06:11:35 GMT
Client-Peer: 202.213.218.55:80
Client-Response-Num: 1

{
"startIndex" : 1,
"payment" : {
"finishUrl" : "http://example.com/finish",
"entry" : [
{
"itemId" : 1,
"amount" : 5,
"imageUrl" : "http://example.com/img/example.gif",
"paymentId" : "3E37C512-6891-35C1-84FE-B081B5443997",
"name" : "金庫",
"unitPrice" : 1000,
"description" : "今は購入出来ない伝説のアイテムです"
}
],
"status" : 0,
"userId" : "sb.sp.app.mbga.jp:10045",
"published" : "2010-02-15T11:21:58",
"endpointUrl" : "http://sb.sp.app.mbga.jp/_pf_pay_confirm?p=3E37C512-6891-35C1-84FE-B081B5443997&app_id=12000125",
"appId" : 12000125,
"callbackUrl" : "http://example.com/callback",
"id" : "3E37C512-6891-35C1-84FE-B081B5443997",
"updated" : "2010-02-15T11:21:58"
},
"itemsPerPage" : 1,
"totalResults" : 1
}

関連項目​

決済サービス

参考資料​

XML Schema Part 2: Datatypes Second Edition
URI Template draft-gregorio-uritemplate-03

更新履歴​

  • 2013/10/31
    • Payment エントリPOSTの購入個数制限による400エラーに関する記述を追加
  • 2013/2/22
    • Payment エントリGETの403エラーに関する記述を追加
  • 2012/06/28
    • ニュース掲載 API 改修 の対応に関する記述を追加
  • 2011/08/29
    • 注意事項に決済額の上限について加筆
  • 2010/12/09
    • status カラム値 から "キャンセル" を削除
  • 概要
  • Payment オブジェクトフィールド
    • status カラム値
  • PaymentEntry オブジェクトフィールド
  • API リクエスト
    • HTTP メソッド
    • エンドポイント URL
    • クエリパラメータ
  • API レスポンス
    • レスポンスコード
  • 注意事項
  • サンプル
    • Payment の追加
    • Payment エントリの取得
  • 関連項目
  • 参考資料
  • 更新履歴