Bank Debit

Endpoint for Bank API


Mobage Simplified Chinese Platform

Mobage Traditional Chinese Platform

API NameHTTP MethodREST URI FragmentDescription
Get Bank DebitGET/bank/debit/{appId}/{-list|,|transactionId}Retrieve transaction resource or collection.
Create Bank DebitPOST/bank/debit/{appId}Create a transaction resource.
Update Bank DebitPUT/bank/debit/{appId}/{transactionId}Update a transaction resource.

Data Type Definition

BankTransaction

NameTypeDescription
idStringUnique transaction identifier
itemsBankBillingItem, Array<BankBillingItem>Billing items
commentStringAny comment for developer
stateString"new" / "authorized" / "open" / "closed" / "canceled"
publishedDatePublish date of this transaction
updatedDateLast updated date of this transaction

 BankBillingItem

NameTypeDescription
itemBankItemItem to bill
quantityNumberQuantity to bill

BankItem

NameTypeDescription
idStringUnique item identifier. ALPHA / DIGIT / "_". 64 or less characters.
nameStringItem name
priceNumberItem price
descriptionStringItem description
imageUrlStringImage URL of the Item

 

Create Bank Debit

Description

Create a transaction resource.

URI Fragment

/bank/debit/{appId}

Supported Formats

JSON

HTTP Method

POST

Request Headers

Any request to the Mobage REST APIs must include the Authorization header. For more details, see How to add the Authorization Header 

REST Query and URI Template Parameters

NameTypeRequired/OptionalParameterDescription
appIdAppIdRequiredURI Template ParametersOnly @app is specifiable

Request Body

BankTransaction

Response Status Code

HTTP Status CodeHTTP Status MessageMeaning
201CreatedData successfully created
400Bad RequestCorrupt request data on the client side
401UnauthorizedAuthorization error
403ForbiddenThe resource exists, but access is not possible due to a reason other than an authorization error.
404Not FoundThe resource doesn’t exist
500Internal Server ErrorAn error on the API server side
503Service UnavailableThe API cannot be used temporarily

Response Body

The response body contains a single JSON object with 1 property. The following table describes the property of the JSON object in the response body.

Name
Type
Description
idStringtransaction id

Example. Create Single Transaction Resource with Item Detail

HTTPS Request
HTTPS Response

 

Get Bank Debit

Description

Retrieve transaction resource or collection.

URI Fragment

/bank/debit/{appId}/{-list|,|transactionId}

Supported Formats

JSON

HTTP Method

GET

REST Query and URI Template Parameters

NameTypeRequired/OptionalParameterDescription
appIdAppIdRequiredURI Template ParametersOnly @app is specifiable
transactionIdTransactionId, Array<TransactionId>RequiredURI Template Parameters 
fieldsArrayOptionalQuery String 
formatStringOptionalQuery StringOnly json is specifiable

Request Headers

Any request to the Mobage REST APIs must include the Authorization header. For more details, see How to add the Authorization Header 

Request Body

None

Response Status Code

HTTP Status CodeHTTP Status MessageMeaning
200OKData successfully acquired
400Bad RequestCorrupt request data on the client side
401UnauthorizedAuthorization error
403ForbiddenThe resource exists, but access is not possible due to a reason other than an authorization error.
404Not FoundThe resource doesn’t exist
500Internal Server ErrorAn error on the API server side
503Service UnavailableThe API cannot be used temporarily

Response Body

BankTransaction

Example. Retrieve Single Transaction Resource

HTTPS Request
HTTPS Response

 

Update Bank Debit

Description

Update a transaction resource.

URI Fragment

/bank/debit/{appId}/{transactionId}

Supported Formats

JSON 

HTTP Method

PUT

REST Query and URI Template Parameters

NameTypeRequired/OptionalParameterDescription
appIdAppIdRequiredURI Template ParametersOnly @app is specifiable
transactionIdTransactionId, Array<TransactionId>RequiredURI Template Parameters 
fieldsArrayOptionalQuery String 
formatStringOptionalQuery StringOnly json is specifiable

Request Body

BankTransaction

Request Headers

Any request to the Mobage REST APIs must include the Authorization header. For more details, see How to add the Authorization Header 

Response Body

BankTransaction

Response Status Code

HTTP Status CodeHTTP Status MessageMeaning
202AcceptedData successfully updated
400Bad RequestCorrupt request data on the client side
401UnauthorizedAuthorization error
403ForbiddenThe resource exists, but access is not possible due to a reason other than an authorization error.
404Not FoundThe resource doesn’t exist
409ConflictIllegal state
500Internal Server ErrorAn error on the API server side

Notes

new state can only be updated to authorized.

An authorized state can only be updated to open.

An open state can only be updated to closed.

closed state cannot be updated to canceled.

Example. Update Single Transaction Resouce

HTTPS Request
HTTPS Response

How to Add the Authorization Header

Step 1. Create the base string

1. build a string for OAuth parameters:  firstly sort the following parameters alphabetically and URL encode the names and values, then join name and value with "=", finally join name/value pairs with "&" 

ParameterDescriptionValue
oauth_consumer_keyThe Consumer Key for the applicationIssued when resist the application
oauth_nonceUnique value for each requestGenerated on the game server
oauth_signature_methodHash methodOnly HMAC-SHA1 is specifiable
oauth_timestampUNIX timestampGenerated on the game server
oauth_tokenThe token code

oauth_token is obtained from the token credential.

oauth_versionOAuth versionOnly 1.0

2. URL encode the following three parameters.

ParameterDescription
Request MethodHTTP Method to the API Server
API URLURL to the API Server (exclude query parameters)
OAuth ParametersA string Built in previous step

3. join the encoded parameters with "&".

Step 2. Generate the oauth_signature

1. Build a secret by joining the Consumer Secret and  the Token Secret (obtained from the token credential) with "&".

2. Pass the base string and secret to the HMAC-SHA1 hashing algorithm.

3. the output of HMAC-SHA1 hashing algorithm is a binary string. Use base64 encode to produce the signature string.

A tool is provided to verify whether your signature is correct. Refer to Oauth Signature Tool

Step 3. Build the Authorization Header

Follow the steps to build the “Authorization” header:

1. URL encode the parameter names and values in the table below 

2. Double quote the value, join name and value with "=", join name/value pairs with "," 

3. Add realm parameter as an option

4. Add "OAuth " (including the space at the end) to the beginning of the header.

ParameterValue
oauth_consumer_keyIssued when resist the application
oauth_nonceGenerated on the game server
oauth_signatureGenerated on the game server, Refer to Step 2. Generate the oauth_signature
oauth_signature_methodonly "HMAC-SHA1" is specifiable
oauth_timestampGenerated on the game server
oauth_token

oauth_token is obtained from the token credential.

oauth_versionOnly 1.0
Authorization Header Example

 

 

Appendix

These sequence diagrams display patterns for the Bank Debit APIs.


PREVIOUS

Profanity

NEXT

Bank Inventory