phpmollie

mollie api bancontact fail


I am using this code to use the correct payment method. Except for bancontact it is working, when user opt for bancontact this error is shown API call failed: Error executing API call (request): The payment method is invalid. (Bancontact is set as approved payment option at Mollie)

Any suggestions? Or what part of code might be interesting to post here to prevent posting to much code.

if($_SESSION['checkout_betaling'] == 'iDEAL') { $method = 'ideal'; }
elseif($_SESSION['checkout_betaling'] == 'Bancontact') { $method = 'bancontact'; }
elseif($_SESSION['checkout_betaling'] == 'PayPal') { $method = 'paypal'; }
elseif($_SESSION['checkout_betaling'] == 'SOFORT') { $method = 'sofort'; }
elseif($_SESSION['checkout_betaling'] == 'Belfius') { $method = 'belfius'; }
elseif($_SESSION['checkout_betaling'] == 'KBC / CBC') { $method = 'kbc'; }
elseif($_SESSION['checkout_betaling'] == 'ING HomePay') { $method = 'inghomepay'; }
elseif($_SESSION['checkout_betaling'] == 'Creditcard') { $method = 'creditcard'; }

url: mollie.php?bestel_id=$bestel_id&ordernr=$ordernr&bedrag=$bedrag&method=$method&levertijd_dagen=$levertijd_dagen

$payment = $mollie->payments->create(array(
    "amount"       => "{$bedrag}",
    "description"  => $config['bedrijf']." Bestelling {$ordernr}",
    "redirectUrl"  => "{$protocol}://{$hostname}{$path}/checkout_complete.php?",
    "webhookUrl"   => "{$protocol}://{$hostname}{$path}/mollie_update_db.php",
    "method"       => "{$method}",
    "metadata"     => array(
        "bestel_id" => $bestel_id,
        "ordernr" => $ordernr,
        "levertijd_dagen" => $levertijd_dagen
    ),
));

Solution

  • Thanks to help of lovelace I was able to solve this problem with: Payment method mistercash should be bancontact · Issue #187 · mollie/mollie-api-php · GitHub