Skip to main content

Payment

Overview​

The Payment API is used to begin transactions for purchasing items with MobaCoins.


Payment Object Fields​

The Payment object represents a transaction for purchasing an item.

ValueDescriptionTypeNamespaceRemark
idThe id of the Payment objectxs:stringhttp://ns.dena.jp/mbga/gameapi/v1UUID format
appIdThe id of the application that will perform this settlement transactionxs:inthttp://ns.dena.jp/mbga/gameapi/v1–
userIdThe guid of the user who will perform this settlement transactionxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
statusThe status of this settlement transactionxs:inthttp://ns.dena.jp/mbga/gameapi/v1–
entryA collection of PaymentEntry objectsmbga:PaymentEntry (unbounded)http://ns.dena.jp/mbga/gameapi/v1–
callbackUrlThe URL of the settlement completion notification on the partner serverxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
finishUrlThe URL of the screen denoting the end of settlement on the partner serverxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
endpointUrlThe URL of the Mobage server where this settlement transaction is executedxs:stringhttp://ns.dena.jp/mbga/gameapi/v1–
publishedGeneration date and timexs:dateTimehttp://ns.dena.jp/mbga/gameapi/v1GMT
updatedUpdate date and timexs:dateTimehttp://ns.dena.jp/mbga/gameapi/v1GMT
note

There is no timezone specifier in the xsd:dateTime type in the response from the API. Therefore, it is represented in GMT (Greenwich Mean Time).

status Column Value​

ValueDescription
0Indicates the start of settlement
1Error
10Indicates successful completion

PaymentEntry Object Fields​

The PaymentEntry object represents information about each item that is contained in an item purchase transaction.

ValueDescriptionTypeNamespaceRemark
paymentIdid of Payment objectxs:stringhttp://ns.dena.jp/mbga/gameapi/v1UUID format
itemIdThe ID used by the partner for discriminating items.xs:inthttp://ns.dena.jp/mbga/gameapi/v1–
nameThe name of the itemxs:stringhttp://ns.dena.jp/mbga/gameapi/v1Maximum 64 bytes
unitPriceThe unit price of the item (coins)xs:inthttp://ns.dena.jp/mbga/gameapi/v1–
amountThe number of items purchasedxs:inthttp://ns.dena.jp/mbga/gameapi/v1255 is the upper limit
imageUrlThe URL of the item's imagexs:stringhttp://ns.dena.jp/mbga/gameapi/v1gif image only
descriptionThe description of the itemxs:stringhttp://ns.dena.jp/mbga/gameapi/v1Maximum 255 bytes

API Request​

HTTP Methods​

Proxy model

  • GET
    • Gets a Payment entry
  • POST
    • Creates a Payment entry

Trusted model

  • GET
    • Gets a Payment entry

Endpoint URL​

  • Sandbox environment

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

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

URI Template Parameters​

guid​

Specify one of the following values for the guid parameter.

ValueDescriptionRemark
@meRepresents the guid of the viewerRequired (when POST is used)
{guid}guid of the user who performed the settlementOptional (when GET is used)
selector​

Specify the following value for the selector parameter.

ValueDescriptionRemark
@selfRepresents the entire Payment collection resource of the viewerRequired
appid​

Specify the following value for the appid parameter.

ValueDescriptionRemark
@appapplication id of the application currently being executedRequired
paymentId​

Specify the following value for the paymentId parameter.

ValueDescriptionRemark
{paymentId}uuid-formatted stringOptional

Query Parameters​

The following query parameter can be specified.

format​

The response format is as shown below.

ValueDescriptionRemark
json"application/json; charset=utf8"Optional, default value

API Response​

Response Codes​

The following is a list of the API response codes.

Request HTTP methodResponse codeResponse messageDescription
GET200OKThe entry was acquired successfully
GET400Bad RequestInvalid request data
GET404Not FoundThe entry does not exist
GET500Internal Server ErrorFailed because of an API problem
POST201CreatedData was created successfully
POST400Bad RequestInvalid request data
POST401UnauthorizedOAuth authorization failed
POST403ForbiddenAccess failed for some reason other than an authentication error
POST500Internal Server ErrorFailed because of an API problem
–405Method Not AllowedMethod is not allowed

Notes​

  • The settlement id is in uuid format.

  • When getting a Payment entry, access can be performed using the Trusted Model (Consumer Request). Before issuing the request, set the guid parameter to the user's guid instead of '@me'.

  • If the total amount of the settlement entry (unitPrice X amount) exceeds 100,000 MobaCoins, an error will occur at the endpointUrl (i.e. settlement page).

  • If a user sends a POST request using the Trusted model to create a Payment entry but has not installed the corresponding application, a 403 will be returned for the response code.

  • If a non-existent paymentId is specified with the GET request when getting a Payment entry, a 404 will be returned for the response code.
     


    Examples​

    Adding a Payment​

This example shows how to add a Payment entry for the purpose of starting a new settlement transaction.

Request Format​

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": "Burst Mo",
"unitPrice": 100,
"amount": 3,
"description": "This is an enhanced version of Burst Doku",
"imageUrl": "http://example.com/img/item/12.gif"
}
]
}

Response Format​

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" : "Burst Mo",
"unitPrice" : 100,
"description" : "This is an enhanced version of Burst Doku",
}
],
"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
}

Get a Payment Entry​

Get a Payment entry that already exists.

Request Format​

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

Response Format​

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" : "Vault",
"unitPrice" : 1000,
"description" : "This is a traditional item that cannot be purchased now"
}
],
"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
}

Reference Material​

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

Revision History​

  • 03/01/2013
    • Initial release
  • Overview
  • Payment Object Fields
    • status Column Value
  • PaymentEntry Object Fields
  • API Request
  • API Response
    • Response Codes
    • Notes
  • Examples
    • Adding a Payment
    • Get a Payment Entry
  • Reference Material
  • Revision History