Generate a Link for a Specific Payment salescenter.payment.getPublicUrl

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: salescenter

Who can execute the method: any user. A webhook or application requires the salescenter scope

The salescenter.payment.getPublicUrl method returns a public link to the payment page, a short link, and a QR code with the short link. The payment method that the client selects on the page is written to this payment.

Method Parameters

Required parameters are marked with *

Name
type

Description

id*
sale_order_payment.id

Payment identifier. You can retrieve the payment identifiers of a CRM object using the crm.item.payment.list method

options
object

QR code settings. One key is supported: qr (detailed description)

Parameter options.qr

If options.qr is not passed, the QR code is generated at 380 × 380 pixels without padding.

Name
type

Description

w
integer

Image width in pixels

h
integer

Image height in pixels

p
integer

Padding around the QR code in pixels

wq
integer

Width of the quiet zone around the QR code in modules

Code Examples

How to Use Examples in Documentation

curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"id":1063}' \
        https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/salescenter.payment.getPublicUrl
        
curl -X POST \
        -H "Content-Type: application/json" \
        -H "Accept: application/json" \
        -d '{"id":1063,"auth":"**put_access_token_here**"}' \
        https://**put_your_bitrix24_address**/rest/salescenter.payment.getPublicUrl
        
// This snippet is an ES module: top-level await requires type="module" or a bundler.
        // $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
        import { Text } from '@bitrix24/b24jssdk'
        import type { B24Frame } from '@bitrix24/b24jssdk'
        
        declare const $b24: B24Frame
        
        // Shape of the payload returned in result (match the "response handling" section of the page)
        type SalesCenterPaymentGetPublicUrlResult = {
          payment: {
            url: string
            shortUrl: string
            qr: string
          }
        }
        
        try {
          const response = await $b24.actions.v2.call.make<SalesCenterPaymentGetPublicUrlResult>({
            method: 'salescenter.payment.getPublicUrl',
            params: {
              id: 1063,
            },
            requestId: Text.getUuidRfc4122()
          })
        
          // The payload is available only on a successful response
          if (!response.isSuccess) {
            console.error(response.getErrorMessages().join('; '))
          } else {
            const result = response.getData()!.result
            console.info('Payment URL:', result.payment.url)
            console.info('Short URL:', result.payment.shortUrl)
          }
        } catch (error) {
          // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
          console.error(error)
        }
        
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
        <script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
        <script>
          async function getPaymentPublicUrl() {
            try {
              // Initialize the SDK inside a Bitrix24 frame
              const $b24 = await B24Js.initializeB24Frame()
        
              const response = await $b24.actions.v2.call.make({
                method: 'salescenter.payment.getPublicUrl',
                params: {
                  id: 1063,
                },
                requestId: B24Js.Text.getUuidRfc4122()
              })
        
              // The payload is available only on a successful response
              if (!response.isSuccess) {
                console.error(response.getErrorMessages().join('; '))
                return
              }
        
              const result = response.getData().result
              console.info('Payment URL:', result.payment.url)
              console.info('Short URL:', result.payment.shortUrl)
            } catch (error) {
              // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
              console.error(error)
            }
          }
        
          document.addEventListener('DOMContentLoaded', getPaymentPublicUrl)
        </script>
        
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
        
        try:
            bitrix_response = client.salescenter.payment.get_public_url(
                bitrix_id=101,
            ).response
            result = bitrix_response.result
            print(result)
        except BitrixAPIError as error:
            print(
                "Bitrix API error",
                f"error: {error.error}",
                f"error_description: {error.error_description}",
                sep="\n",
            )
        except BitrixSDKException as error:
            print(f"Bitrix SDK error: {error.message}")
        except Exception as error:
            print(f"Unexpected error: {error}")
        
try {
            $response = $b24Service
                ->core
                ->call(
                    'salescenter.payment.getPublicUrl',
                    [
                        'id' => 1063,
                    ]
                );
        
            $result = $response
                ->getResponseData()
                ->getResult();
        
            echo 'Success: ' . print_r($result, true);
        
        } catch (Throwable $e) {
            error_log($e->getMessage());
            echo 'Error getting public URL: ' . $e->getMessage();
        }
        
BX24.callMethod(
            'salescenter.payment.getPublicUrl', {
                id: 1063,
            },
            function(result) {
                if (result.error()) {
                    console.error(result.error());
                } else {
                    console.log(result.data());
                }
            }
        );
        
require_once('crest.php');
        
        $result = CRest::call(
            'salescenter.payment.getPublicUrl',
            [
                'id' => 1063
            ]
        );
        
        echo '<PRE>';
        print_r($result);
        echo '</PRE>';
        
// client and ctx are already created — see the Go SDK section
        res, err := client.Core().Call(ctx, "salescenter.payment.getPublicUrl", b24.Params{
        	"id": 1063,
        })
        if err != nil {
        	return fmt.Errorf("salescenter.payment.getPublicUrl: %w", err)
        }
        
        // The method wraps the response in an object with the "payment" key.
        raw, ok := b24.Unwrap(res.Result, "payment")
        if !ok {
        	return fmt.Errorf("no payment key in the response")
        }
        
        var item struct {
        	URL      string `json:"url"`
        	ShortUrl string `json:"shortUrl"`
        	Qr       string `json:"qr"`
        }
        if err := json.Unmarshal(raw, &item); err != nil {
        	return fmt.Errorf("parse response: %w", err)
        }
        fmt.Println(item.URL, item.ShortUrl)
        

Response Handling

HTTP status: 200

{
            "result": {
                "payment": {
                    "url": "http:\/\/account.home\/pub\/site\/10\/oformleniezakaza\/?orderId=3689\u0026access=f83b5926bd8cb4f0248b4b5a8e48b6fb\u0026paymentId=1063",
                    "shortUrl": "http:\/\/account.home\/~tR9sB",
                    "qr": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAF8CAYAAADM5wDKAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAHaElEQVR4nO3csW7jVhRF0SjQ\/\/+y0owFN4GVeYou7+y1KhdjiCI5G8\/NuT0ej8dfAPzx\/p6+AAA+4\/71w+12m7wOXnDyx9jJ8536I7D2Tm78Y7v2jDb6\/l454QNECD5AhOADRAg+QITgA0QIPkCE4ANECD5AhOADRAg+QITgA0QIPkCE4ANECD5AxP3nf\/KzjbOuUzbOyU5d88Y56Kl7tXH+Wjde9673ygkfIELwASIEHyBC8AEiBB8gQvABIgQfIELwASIEHyBC8AEiBB8gQvABIgQfIELwASLeM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                }
            },
            "time": {
                "start": 1718372619.163703,
                "finish": 1718372619.567831,
                "duration": 0.4041280746459961,
                "processing": 0.15733885765075684,
                "date_start": "2024-06-14T16:43:39+02:00",
                "date_finish": "2024-06-14T16:43:39+02:00"
            }
        }
        

Returned Data

Name
type

Description

result
object

Root element of the response. Usually contains the payment key.

If a site is connected to CRM but its phone number is not confirmed, the link cannot be retrieved. In this case, instead of payment, the method returns two keys:

  • connectedSiteId — identifier of the connected site
  • isPhoneConfirmed — whether the phone number is confirmed, false in this case

payment
object

Payment link data (detailed description)

time
time

Information about the request execution time

Object payment

Name
type

Description

url
string

Full link to the payment page

shortUrl
string

Short link to the payment page

qr
string

QR code with the short link: a PNG image encoded in base64 without the data: prefix. To display it in a browser, add the data:image/png;base64, prefix

Error Handling

HTTP status: 400

{
            "error": 200640400001,
            "error_description": "payment is not exists"
        }
        

Name
type

Description

error
string

String error code. It consists of digits, Latin letters, and underscores. It may arrive empty — in that case only error_description shows the reason

error_description
string

Error message for the developer. Do not show it to the end user without processing

Possible Error Codes

Status

Code

Description

Value

400

200640400001

payment is not exists

The payment with the passed id was not found

400

0

Parameter id must be integer

The value passed in id is not a number

400

0

Public url is not available

The public payment page is not available in this Bitrix24

400

0

Error retrieving url info

Failed to generate the payment link

400

100

Could not find value for parameter

The required parameter id was not provided

401

insufficient_scope

The request requires higher privileges than provided by the webhook token

The webhook or application does not have the salescenter scope

The method returns the code 0 for several different errors. To determine the cause, check the text in error_description.

Statuses and System Error Codes

HTTP Status: 4xx, 5xx

The errors described below are returned by the REST API itself, not by the logic of a specific method. They can arrive in response to any method.

Status

Code
Error Message

Description

500

INTERNAL_SERVER_ERROR
Internal server error

An internal server error has occurred. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

500

ERROR_UNEXPECTED_ANSWER
Server returned an unexpected response

The server returned an unexpected response. Retry the call, and if the error persists, contact the server administrator or Bitrix24 technical support

503

QUERY_LIMIT_EXCEEDED
Too many requests

The request intensity limit has been exceeded

429

OPERATION_TIME_LIMIT
Method is blocked due to operation time limit

The method is blocked because the request resource intensity limit has been exceeded. The block is lifted automatically once the accumulated execution time of the method no longer exceeds the limit

401

NO_AUTH_FOUND
Wrong authorization data

The request contains no authorization data: neither an access token nor a webhook code was passed

401

INVALID_REQUEST
Https required

Methods are called over the HTTPS protocol only

401

OVERLOAD_LIMIT
REST API is blocked due to overload

The REST API is blocked due to overload. This is a manual individual block. To have it lifted, contact Bitrix24 technical support

401

ACCESS_DENIED
REST is available only on commercial plans

REST API access is not active for this account. In Bitrix24 Cloud, check the current plan or trial status: Vibe+ plans include REST API access, while Essentials plans do not. A webhook receives a different error message — REST is available only by subscription

401

INVALID_CREDENTIALS
Invalid request credentials

No active webhook with the specified user identifier and secret code was found

404

ERROR_METHOD_NOT_FOUND
Method not found!

No method with this name was found. The name is misspelled, the method does not exist in the REST API, or it is unavailable without the required scope

401

insufficient_scope
The request requires higher privileges than provided by the webhook token

The request requires broader permissions than the token has: for a webhook these are the permissions granted to it, for an application it is the scope. For an application, the error message ends with provided by the access token

401

expired_token
The access token provided has expired

The access token has expired

401

user_access_error
The user does not have access to the application

The application is installed, but the Bitrix24 administrator has granted access to it only to specific users

403

PORTAL_DELETED
Portal was deleted

The public part of the site is closed. To open it on an on-premise installation, disable the "Temporary closure of the public part of the site" option. Path to the setting: Desktop > Settings > Product Settings > Module Settings > Main Module > Temporary closure of the public part of the site

Continue Learning