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?
http://site.com/capture/orhttp://site.com/capture.php- DaemonHK