Skip to content

Activate a subscription

This guide shows how to give a user access to a MEGOGO subscription after the user buys it from you.

Before you start

Make sure that:

  • You have your partner ID, your keys and the service IDs of your subscriptions. See Credentials.
  • MEGOGO added the IP addresses of your servers to the list of your partner ID.
  • Your code calculates the signature correctly. See Sign a request.
  • You know the renewal mode of each service. See Subscription lifecycle.

The flow

sequenceDiagram
    participant User
    participant Server as Your server
    participant API as MEGOGO Terminals API
    User->>Server: Buys the subscription
    Server->>Server: Checks the phone number format
    Server->>API: subscription/subscribe (phone, serviceId)
    API-->>Server: "successful": true
    Server->>Server: Bills the user
    Server-->>User: Message: how to sign in to MEGOGO

Step 1. Check the phone number

Make sure that the phone number has only digits, in the international format: the country code and the number, for example 380000000001. A + at the start is permitted.

CAUTION

MEGOGO does not check the length of the number. A wrong number makes a MEGOGO user for this number. Check the number on your side.

Optional: to know if the user already has a MEGOGO account, send user/phone:

GET https://billing.megogo.net/terminals/{partner_id}/user/phone?phone={phone}&sign={sign}

{"successful": true} means that the user has an account. The subscription goes to this account, next to the other services of the user.

Step 2. Start the subscription

GET https://billing.megogo.net/terminals/{partner_id}/subscription/subscribe?phone={phone}&serviceId={service_id}&sign={sign}
Parameter Description
partner_id Your partner ID
phone The phone number of the user
serviceId The service ID of the subscription
sign The signature. See Sign a request

Expected response:

{"successful": true}

If MEGOGO has no user with this phone number, the request creates the user.

Step 3. Bill the user

Bill the user only after "successful": true. For other responses, do not bill the user. See Errors.

Step 4. Tell the user how to sign in

MEGOGO does not send a message to the user. Send it yourself, for example by SMS. Example text:

Example of a message

MEGOGO "Light" is active. To watch, install the MEGOGO application or open megogo.net. Select the sign-in with a phone number, enter this number and the code from SMS or Viber.

Step 5. Check the subscription

GET https://billing.megogo.net/terminals/{partner_id}/subscriptions?phone={phone}&sign={sign}

Expected response (shortened):

[
  {
    "serviceId": "example_light_30d",
    "serviceName": "Light (partner)",
    "dateFinish": 1796221882,
    "dateFinishString": "2026-12-02 14:31:22"
  }
]
  • dateFinish is the end of the current period, Unix time (seconds). dateFinishString is the same time in UTC.
  • Do not calculate the end date yourself. Get it from this response.

Errors

Response Cause Action
"successful": false, code 2023 The subscription is already active, and the service has automatic renewal. Or the end date would be more than 15 years from now No action is necessary
"message": "Service is not configured for this partner" The service ID is not configured for your partner ID Make sure that you use a service ID from your MEGOGO manager
"message": "General error" The phone number has characters that are not digits Do step 1 again
"successful": false, code 40009 The subscription is not sold through partners Tell your MEGOGO manager
HTTP 401 Not Authorized The signature, the keys or the IP address See Troubleshooting
Timeout, HTTP 5xx Temporary problem See Retries

For all errors, see the Error catalog.

Next steps


Guide version 1.0.0, 2026-11-02 · Report a problem on this page