如何解决php中的“未捕获的错误:调用成员函数getPaymentMethods()”错误?

时间:2019-01-19 15:23:20

标签: get payment

如何解决此错误? 我不明白问题可能在哪里。 致命错误:未捕获错误:在/ dir /:98上的null上调用成员函数getPaymentMethods()堆栈跟踪:在第98行的/ dir /中引发了#0 {main}

<?php
    $config = array(
        'projectid'     => 11, // I deleted it because it was secret
        'sign_password' => '11', // I deleted it because it was secret
        'orderid'       => 0,
        'amount'        => 1000,
        'currency'      => 'EUR',
        'country'       => 'LT',
        'test'          => 1,
);
    $paymentMethodsInfo = WebToPay::getPaymentMethodList($config['projectid'], $config['currency'])
            ->filterForAmount($amount, $config['currency'])
            ->setDefaultLanguage('lt');

            foreach ($paymentMethodsInfo->getCountry('lt')->getPaymentMethods() as $paymentMethod) { //ERROR LINE
            echo '<input type="radio" name="payment" value="', $paymentMethod->getKey(), '" />';
            if ($paymentMethod->getLogoUrl()) {
                    echo '<img src="', $paymentMethod->getLogoUrl(), '" />';
            }
            echo $paymentMethod->getTitle(), '<br />';
    } ?></div>

0 个答案:

没有答案