I am trying to use Payum to receive payments on the site.

The problem is that it is not clear how to change the capture url. By default, it is built as '... / capture.php', and I need to specify my url there, since the application has its own routing rules (using yii2).

But I don’t understand the architecture of this package at all. I looked at the source code, looked at the existing extensions for various frameworks, saw that there is a TokenFactory where you can set the url, but still did not understand exactly how to do it. I would quit, but the number of stars on the github project hints to me that I just don’t know something.

Can you please tell me how to set your url for capture / done and so on in payum?

Details:

Initial payum:

 $ymGateway = new \yandexmoney\YandexMoney\Gateway(); $payum = (new PayumBuilder()) ->addDefaultStorages() ->addGateway('yandexKassa', [ 'factory' => 'omnipay', 'payum.api' => $ymGateway, ]) ->getPayum() ; 

Prepare:

 $paymentClass = \Payum\Core\Model\Payment::class; /** @var \Payum\Core\Payum $payum */ $storage = $payum->getStorage($paymentClass); $payment = $storage->create(); $payment->setNumber(uniqid()); $payment->setCurrencyCode('EUR'); $payment->setTotalAmount(123); // 1.23 EUR $payment->setDescription('A description'); $payment->setClientId(234); $payment->setClientEmail('foo@example.com'); $storage->update($payment); $captureToken = $payum->getTokenFactory()->createCaptureToken('yandexKassa', $payment, 'done.php'); die($captureToken->getTargetUrl()); 

This action works on the '/ pay / prepare' page. The output is the link '/pay/prepare/capture.php'. I need the link to be '/ pay / capture'.

TokenFactory should I insert the TokenFactory initialization TokenFactory and what should it look like, or if this is the wrong way, what should I do to be able to set my url?

  • In theory, all payment systems ask / require them to create separate scripts / pages that will work with them, for example, a request for data, payment, payment confirmation, payment verification, payment refusal, etc. Accordingly, you have to create such handlers yourself and specify them for the payment system, where the bank will then knock to work with your site. - DaemonHK
  • @DaemonHK it is. I am trying to create such handlers using payum. But I don’t understand how to set up a url for me in payum. - cronfy
  • Try not to bathe and set paths from the domain, for example, http://site.com/capture/ or http://site.com/capture.php - DaemonHK
  • The default URL is set only if it was not explicitly specified. Here, for example, the place where this is checked in the case of Paypal EC: github.com/Payum/Payum/blob/master/src/Payum/Paypal/ ... You just need to set this value at the payment preparation stage. A side question, why do you need your url? I ask because there is a shock that you are doing something wrong. - Maksim Kotlyar
  • @MaksimKotlyar I added details to the question. My url is needed so that when it turns out that the default url needs to be changed (and this always happens suddenly and unpredictably) so that I can do it. - cronfy

0