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

NameRequiredTypeDescription
uid true String

User id

transaction_id true String

Unique payment transaction id. For some in-game subscription events (trial subscription period start, subscription cancellation) this parameter can be empty

transaction_time true Date

Transaction time in yyyy-mm-dd HH:MM:SS format

product_code false String

Product code

product_option false String

Product option code

amount true int

Amount of currency paid for a product within transaction

currency false String

Payment currency (if product was payed in OKs this field is not sent)

payment_system false String

Payment system for RUB payments

extra_attributes false String

JSON with additional transaction information which game send via FAPI.UI.showPayment method

trial_days false Long

Trial period of a game subscription

card_promo false Boolean

Authorization

Session is prohibited

Required 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

NameCodeDescription
UNKNOWN1Unknown error
SERVICE2Service is temporary unavailable
CALLBACK_INVALID_PAYMENT1001Payment is invalid and can’t be processed
SYSTEM9999Critical system error
PARAM_SIGNATURE104Invalid 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
}

Type

void

Application paramters

User session data

Method

List of paramters

Используем для подписи secret_key = session_secret_key
Используем для подписи secret_key = application_secret_key
Используем для подписи secret_key = MD5(access_token + application_secret_key)
secret_key =
Сортируем и склеиваем параметры запроса и secret_key
Рассчитываем MD5 от полученной строки и получаем параметр sig