share_billing_code

You can share activation codes with users who are lower in the hierarchy. To do this, use the user/share_billing_code method.

Prerequisites

To share an activation code, the following prerequisites must be met:

  • The user with whom you want to share the code must have dealer rights.
  • The code must not be already shared with a user from another branch of the hierarchy.
  • The code must not be already assigned to any unit.

When sharing activation codes, consider the following details:

  • A code shared with a lower-level user is automatically shared with users higher in the same branch of the hierarchy.

  • You can’t share the same activation code with users from different branches of the hierarchy.

  • If dealer rights are revoked from an account, any shared activation codes are automatically unshared.

Endpoint

Copied!
svc=user/share_billing_code&params={
    "userId": <long>,
    "code": "<text>"
}

Parameters

The request must contain the following parameters:

Parameter Description
userId ID of the user with whom the activation code should be shared.
code Activation code to be shared.

Response

The response always contains the error code and its reason. If the request is completed successfully, the following response is returned:

Copied!
{
  "error": 0,
  "reason": "NO_ERROR"
}

If the request fails, the response contains the error code and the reason from the table below, for example:

Copied!
{
  "error": 7,
  "reason": "CODE_ALREADY_SHARED"
}

Error codes

Error code Reason Description
1 INVALID_PARAMS Invalid input parameters, or the activation code isn’t found.
2 NO_BILLING_BY_CODES The Activation codes module is not enabled.
3 INVALID_SOURCE_USER Invalid source user: the current user isn’t found, doesn’t have dealer rights, or isn’t the owner of their account.
4 TARGET_USER_NO_ACCESS The target user isn’t lower than the current user in the hierarchy.
5 INVALID_TARGET_USER Invalid target user: the user isn’t found, doesn’t have dealer rights, or isn’t the owner of their account.
6 CODE_NOT_SHARED_WITH_SOURCE The code is not shared with the source user.
7 CODE_ALREADY_SHARED The code has already been shared with the target user.
8 CODE_ASSIGNED_TO_UNIT The code is assigned to a unit.
9 INTERNAL_ERROR Internal error.

If you find a mistake in the text, please select it and press Ctrl+Enter.