Event on Application Payment onAppPayment

Choose a tool for developing with an AI agent:

  • use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
  • use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation

Scope: basic

Who can subscribe: any user

The ONAPPPAYMENT event is triggered when an application is paid for or its paid period is extended. Bitrix24 receives the new status from the Market, for example, when a user opens the application or the list of installed applications. Therefore, the event may arrive later than the payment itself. The event is sent only to the application that was paid for.

Events will not be sent to the application until the installation is complete. Check the application installation.

What the Handler Receives

Data is transmitted as a POST request

{
            "event": "ONAPPPAYMENT",
            "event_handler_id": "14",
            "data": {
                "CODE": "bitrix.gds_company",
                "VERSION": "1",
                "STATUS": "P",
                "PAYMENT_EXPIRED": "N",
                "DAYS": "28"
            },
            "ts": "1466439714",
            "auth": {
                "domain": "some-domain.bitrix24.com",
                "server_endpoint": "https://oauth.bitrix.info/rest/",
                "client_endpoint": "https://some-domain.bitrix24.com/rest/",
                "member_id": "a223c6b3710f85df22e9377d6c4f7553",
                "application_token": "51856fefc120afa4b628cc82d3935cce"
            }
        }
        

Request Parameters

Required parameters are marked with *

Name
type

Description

event*
string

Event character code — ONAPPPAYMENT

event_handler_id
integer

Event handler ID

data*
object

Data about the application payment status.

The structure is described below

ts*
timestamp

Date and time of the event sent from the queue

auth*
object

Object containing authorization parameters and information about the account where the event occurred.

The structure is described below

Parameter data

Name
type

Description

CODE*
string

Application code

VERSION*
string

Installed application version

STATUS*
string

Application status in Bitrix24.

Possible values:

  • L — local application
  • F — free mass-market application
  • D — demo version of a mass-market application
  • T — trial version of a mass-market application, time-limited
  • P — paid mass-market application

PAYMENT_EXPIRED*
string

Whether the paid period of the application has expired. Always N: the event is not sent when the period has expired

DAYS
integer

Number of days remaining until the end of the paid period. If the application has no period end date, the key is not passed

Parameter auth

Name
type

Description

domain*
string

Address of the Bitrix24 account where the event occurred

server_endpoint*
string

Authorization server address for token renewal

client_endpoint*
string

Common path for API method calls to the account

member_id*
string

Unique identifier of the account

application_token*
string

Application token. Compare it with the token retained during installation to make sure the request came from Bitrix24. For more details, see the article Security in Handlers

If the event could be linked to a user, auth additionally contains access_token, expires_in, scope, and status, more details. The refresh_token key is not passed for this event.

Continue Learning