Payment Service

Overview

The Payment Service enables you to charge for content in an application and perform settlement with MobaCoins.

Notes

Verification of the settlement status, which is described in steps 15 and 16, and handling when assignment of the item was omitted, which is described in steps 19 and 20, are required. If settlement fails when the verification of assignment of a purchased item is successful, the recovery or cancellation of the item must be performed on the game server. Since a communication failure might occur that could cause the verification process not to complete, it is also necessary to verify the assignment of a purchased item and deal with cases when assignment is omitted.

Service Processing Flow

1. The user submits a purchase request to the Gadget server from the purchase page of the content.
2. The Gadget server relays the request to the game server just like a normal request.
3. The game server uses the Payment API to send settlement information to the API server.
4. The API server generates a Payment ID and settlement page endpoint URL and returns them to the game server.
5. The game server returns a response that contains a transition to the settlement page endpoint URL.
6. The Gadget server relays the response to the user.
7. The user accesses the settlement page that was set up on the platform.
8. MobaCoin settlement is performed by the platform.
9. The user finally sends a MobaCoin settlement request.
10. A sales verification request is sent to the game server from the platform. If processing has already started for assigning the purchased item for the relevant Payment ID, an error will occur.
11. The sale is verified by the partner who returns an HTTP 200 OK response to the sales verification request.
12. A transition to the Purchase Completed page that was specified by the partner is returned to the user.
13. The user is transitioned to the Purchase Completed page. At the same time, the Payment ID is assigned as the payment_id query parameter.
14. The Gadget server relays the request to the game server just like a normal request.
15. The Payment API is used to verify whether or not settlement was successful. The request is submitted to the API server.
16. The result indicating whether settlement was successful for the specified Payment ID is returned from the API server. Depending on whether or not settlement was successful, verification of the assignment of the purchased item will be performed or canceled on the game server .
17. The game server generates a page indicating that settlement is finished and returns it to the Gadget server.
18. The Gadget server relays the response to the user.
19. If a communication failure occurred which caused the verification of the assignment of a purchased item not to occur for a Payment ID, then you need to use the Payment API to verify whether or not settlement was successful and perform this as batch processing.
20. The result indicating whether settlement was successful for the specified Payment ID is returned from the API server. If the settlement status indicates success and the item has not been assigned, processing will be performed to verify the assignment of the purchased item for the respective Payment ID.

Starting Settlement and Verifying Settlement Information

To perform settlement using MobaCoins, you must use the Payment API to send settlement information.
 

Request

The following values can be specified for settlement information.

Parameter name

Description

callbackUrl

URL for reporting that settlement has completed on the partner server

finishUrl

URL of the end of settlement screen on the partner server

itemId

Identifier for discriminating items on the partner server

name

Item name

unitPrice

Unit price of item (coins)

amount

Number of items purchased

description

Item description

imageUrl

URL of the item image

  • The only port numbers that can be specified for callbackURL and finishURL are 80/443.
     

Response

The API Server returns a response in a fixed format using the Payment ID to uniquely identify the settlement, and which contains items such as the endpointUrl that are used to perform the settlement. The partner server must transition the user to this endpointUrl through redirection or a link.

For information on data transactions with the API Server, see Payment API.

Verifying Sales

Transitioning to the Settlement Page

The endpointURL (=settlement page) obtained from the API is used to verify the expenditure of Mobage MobaCoins. Although the user normally should be transitioned directly to the endpointURL that was obtained from the API, if you want to change the color scheme of the settlement page, you can add the following query parameters to the endpointUrl.

Parameter name

Required?

Description

p

Y

Payment ID. Contained in endpointUrl

color

 

body-color

bkcolor

 

body-background-color

hlcolor

 

highlight color

hlbkcolor

 

highlight background-color

  • For the above, specify url-encoded values representing hexadecimal color codes.

Examples

http://pfpay.mbga.jp/_pf_pay_confirm?p=AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA&color=%23611c00&bkcolor=%23fffd6e&hlcolor=%23ffffff&hlbkcolor=%2347bc00

Request

A request for a callbackUrl when sales are verified from Mobage is sent with the following query parameters added.

opensocial_app_id

Application ID

opensocial_viewer_id

ID of user using this application

opensocial_owner_id

ID of user who installed this application

payment_id

Payment ID

updated

Update time

status

Status (always 10)

  • Currently, opensocial_viewer_id and opensocial_owner_id contain the same value.

A signature is applied by OAuth for the request. Always verify the validity of the signature.

Response

The partner server that received the sales verification request must perform appropriate processing and then return an HTTP response with a status code of 200.

Example)

Status: 200
Content-Type: text/plain    
        
OK

If an HTTP status code other than 200 is returned in the response, it means that the sale has not been verified by Mobage and the user's MobaCoins are not spent. An error is also considered to have occurred if 10 seconds or more has passed between the time the request is received until a response is returned.

Verifying Settlement Results

Finally, verify whether settlement has finished successfully.
If settlement is successful, the response is returned directly and the process completes. However, if by some chance, the application server returns a status indicating that settlement failed even though it was previously verified, the settlement must be canceled, the assignment of the item must be reversed, and a response must be returned.

Revision History

  • 01/09/2013
    • Improved settlement security. Changed the implementation method.
    • Changed the sequence screens.
  • 12/11/2012
    • Initial release

PREVIOUS

Friend Request Service

NEXT

Activity Service