Hi there!
I am running a self-hosted v4.5.19 | White labeled on an Ubuntu 18.0.4 via Digital Ocean One-Click app.
Everything seems to be working as it should, only the Mollie refuses to cooperate.
When clicking “pay now” on the invoice, I am being shown following error:
Mollie: The redirect URL is invalid
Moreover, the pay now
button has no options to choose the payment method (like the Stripe does) and defaults to credit card:
https://mydomain.tld/payment/#########################/credit_card
i have checked the logs and this is what I found there:
[2020-08-12 17:13:18] production.INFO: Payment Error [mollie]: ***Exception*** [0] : /var/www/html/ninja/app/Ninja/PaymentDrivers/BasePaymentDriver.php [Line 435] => The redirect URL is invalid {"context":"PHP","user_id":1,"account_id":1,"user_name":"#########","method":"GET","user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36","locale":"nl","ip":"999.999.999.999","count":12,"is_console":"no","is_api":"no","db_server":"mysql","url":"payment/################/credit_card"} []
hillel
August 12, 2020, 8:09pm
2
Hmm… I’m not sure, are you using a proxy?
no, @hillel no proxy.
I had checked it on 3 computers: each at different location and using different ISP
at server side, InvoiceNinja is running on LEMP stack
hillel
August 13, 2020, 3:31am
4
Sorry, I’m not sure. I believe the gateway is working for other users.
Are you able to see the request details in the Mollie portal?
no. the request is not reaching Mollie
hillel
August 13, 2020, 10:33am
6
I’m not sure… if you want to debug the code here’s where we set the returnUrl in Invoice Ninja and then where it’s passed to Mollie in the payment driver.
protected function paymentDetails($paymentMethod = false)
{
$invoice = $this->invoice();
$gatewayTypeAlias = $this->gatewayType == GATEWAY_TYPE_TOKEN ? $this->gatewayType : GatewayType::getAliasFromId($this->gatewayType);
$completeUrl = $this->invitation->getLink('complete', true) . '/' . $gatewayTypeAlias;
$data = [
'amount' => $invoice->getRequestedAmount(),
'currency' => $invoice->getCurrencyCode(),
'returnUrl' => $completeUrl,
'cancelUrl' => $this->invitation->getLink(),
'description' => trans('texts.' . $invoice->getEntityType()) . " {$invoice->invoice_number}",
'transactionId' => $invoice->invoice_number,
'transactionType' => 'Purchase',
'clientIp' => Request::getClientIp(),
];
if ($paymentMethod) {
if ($this->customerReferenceParam) {
$data[$this->customerReferenceParam] = $paymentMethod->account_gateway_token->token;
public function getData()
{
$this->validate('apiKey', 'amount', 'currency', 'description', 'returnUrl');
$data = [];
$data['amount'] = [
"value" => $this->getAmount(),
"currency" => $this->getCurrency()
];
$data['description'] = $this->getDescription();
$data['redirectUrl'] = $this->getReturnUrl();
$data['method'] = $this->getPaymentMethod();
$data['metadata'] = $this->getMetadata();
if ($this->getTransactionId()) {
$data['metadata']['transactionId'] = $this->getTransactionId();
}
if ($issuer = $this->getIssuer()) {
$data['issuer'] = $issuer;
}
so I inserted a file dumping functions in both files
pay now
button has following url:
https://mydomain.tld/payment/aaaaaaaaaaaaaaaaaaaaaaaa/credit_card
and when clicked, the first file dumps following:
mydomain.tld/complete/aaaaaaaaaaaaaaaaaaaaaaaa/credit_card
and dumping whole $data
array from second file, yields following results:
array (
'amount' => '72.60',
'description' => 'Factuur F200051',
'redirectUrl' => 'mydomain.tld/complete/aaaaaaaaaaaaaaaaaaaaaaaa/credit_card',
'method' => NULL,
'metadata' =>
array (
'transactionId' => 'F200051',
),
'webhookUrl' => 'https://mydomain.tld/payment_hook/aaaaaaaaaaaaaaaaaaaaaaaa/9',
)
hillel
August 13, 2020, 12:01pm
8
I’m not sure, that looks ok to me.