Answer the question
In order to leave comments, you need to log in
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.php
he 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.php
that 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");
?>
Answer the question
In order to leave comments, you need to log in
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.
when sending an application, immediately sort them by managers,
for example, from the site via api, you can
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");
<?
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php");
header('Content-Type: application/json');
doesn't hurt to put
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 questionAsk a Question
731 491 924 answers to any question