callbacks.payment
API callback request that is sent when an in-game payment is being processed. Used for in-game purchases and in-game subscriptions
| Name | Required | Type | Description |
|---|---|---|---|
| uid | true | User id | |
| transaction_id | true | Unique payment transaction id. For some in-game subscription events (trial subscription period start, subscription cancellation) this parameter can be empty | |
| transaction_time | true | Transaction time in yyyy-mm-dd HH:MM:SS format | |
| product_code | false | Product code | |
| product_option | false | Product option code | |
| amount | true | Amount of currency paid for a product within transaction | |
| currency | false | Payment currency (if product was payed in OKs this field is not sent) | |
| payment_system | false | Payment system for RUB payments | |
| extra_attributes | false | JSON with additional transaction information which game send via FAPI.UI.showPayment method | |
| trial_days | false | Trial period of a game subscription | |
| card_promo | false |
Authorization
Session is prohibitedRequired permissions
- VALUABLE_ACCESS
Additional information about in-game payments can be found on in-game payment example page.
- Callback is sent up to 3 times. Retry period - 5 seconds. Request is sent again if game server does not respond correctly. If after 3 retries game server still does not respond, transaction is cancelled.
- Only HTTP GET request can be send.
- XML-type or JSON-type responses are supported.
- Content-type should be “application/xml” or “application/json”.
- In case of an error it’s code should be passed in “Invocation-error” HTTP-header.
- Developer must validate product’s price and code. Not following this recommendation can result in fake in-game purchases.
- Developer must validate request signature.
Request are to come only from following addresses:
- 217.20.145.192/28
- 217.20.151.160/28
- 217.20.153.48/28
Error codes
| Name | Code | Description |
|---|---|---|
| UNKNOWN | 1 | Unknown error |
| SERVICE | 2 | Service is temporary unavailable |
| CALLBACK_INVALID_PAYMENT | 1001 | Payment is invalid and can’t be processed |
| SYSTEM | 9999 | Critical system error |
| PARAM_SIGNATURE | 104 | Invalid request signature |
XML response examples
<?xml version="1.0" encoding="UTF-8"?>
<callbacks_payment_response xmlns="http://api.forticom.com/1.0/">
true
</callbacks_payment_response><?xml version="1.0" encoding="UTF-8"?>
<ns2:error_response xmlns:ns2='http://api.forticom.com/1.0/'>
<error_code>1001</error_code>
<error_msg>CALLBACK_INVALID_PAYMENT : Payment is invalid and can not be processed</error_msg>
</ns2:error_response>JSON response examples
true{
"error_code": 1001,
"error_msg": "CALLBACK_INVALID_PAYMENT : Payment is invalid and can not be processed",
"error_data": null
}
