Z
Z
zencd2015-06-03 18:08:59
CRM
zencd, 2015-06-03 18:08:59

How to set up Bitrix to receive notifications from the payment system?

Some custom payment system has been added to Bitrix. The PS knocks on Bitrix with a notification about the completion of the payment to the general handler /result_payment.php, which in one way or another calls the PS handler pay_rec.php. Then pay_rec.phphe does something and answers with Jason. As they explained to me, this is a standard integration scheme with PS. And everything is almost as it should.
My problem is that even though the system responds with jason, this response is framed in a Bitrix HTML header and footer. And the PS requires exactly the correct JSON.
Below is the code /result_payment.phpthat is edited through the visual editor in Bitrix. It is clear where the header / footer comes from - through require. But firstly, a visual editor, and secondly, if you remove require, then the $APPLICATION variable will not be declared and it will not reach pay_rec.

<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");
$APPLICATION->SetTitle("Title");
?><?$APPLICATION->IncludeComponent(
  "bitrix:sale.order.payment.receive",
  "",
  Array(
    "PAY_SYSTEM_ID" => "3",
    "PERSON_TYPE_ID" => "1"
  ),
false
);?> <?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/footer.php");
?>

Question : What is the correct way to answer in the right format?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey Nikolaev, 2018-08-03
@gromdron

You can try to make a crutch - create a universal list and store the elements that have already been placed there. Well, the type of BP during creation, which would check.
But it's better to do it in code.

P
Pavel Kupreev, 2018-08-04
@start-crm

when sending an application, immediately sort them by managers,
for example, from the site via api, you can

A
Alexey Tsykarev, 2015-06-11
@hipahopa

First option. I think that this option is the most correct
. The simplest thing is to replace the connection

<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/header.php");

on the
<?
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");

In this case - the core will be included (respectively, $APPLICATION will be available), but the html layout will not be displayed.
Before calling the component, make
it almost like ob_start(), only through the Bitrix API.
In both cases, you do not need to include a file with a footer.
Well, it header('Content-Type: application/json');doesn't hurt to put

N
Nazar Mokrinsky, 2015-06-03
@nazarpc

There are two options:
1) a crutch - use ob_start () and the rest of the family of functions to control the output
2) read and understand the documentation, there should be an option to disable page layout generation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question