Error: Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request

点点圈 提交于 2019-12-11 07:53:22

问题


I use Payum stable version 0.13 and Zend framework v2 for make payments via AuthorizeNet. My code for test:

    $storage = $this->getServiceLocator()
        ->get('payum')
        ->getStorage('LowbiddoPayment\Entity\AgreementDetails');

    $details                = $storage->create();
    $details['currency']    = 'USD';
    $details['amount']      = 100;
    $details['card_num']    = new SensitiveValue('4111111111111111');
    $details['exp_date']    = new SensitiveValue('10/16');
    $details['description'] = 'Test';
    $storage->update($details);

    $this->getServiceLocator()
        ->get('payum.security.token_factory')
        ->setUrlPlugin($this->url());

    $doneUrl = $this->url()->fromRoute('payment_done', array('id' => $orderId), array('force_canonical' => true));

    $captureToken = $this->getServiceLocator()
        ->get('payum.security.token_factory')
        ->createCaptureToken('authorize-net-aim', $details, $doneUrl);

I have this error

/vendor/payum/payum/src/Payum/AuthorizeNet/Aim/Action/CaptureAction.php:58

Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.

How can I fix it? Thanks!


回答1:


PayumModule does not provide (yet) a built-in ObtainCreditCardAction. So there are two ways to go.

  • You can ask for credit card information yourself. Like create a form than render it. User fills it and submit. You get that info and pass it to Payum with the rest of information. Authorize.Net AIM asks for 'card_num', 'exp_date' fields.

  • The other way is to create a zend specific ObtainCreditCardAction and add it to Payment object using addAction method. Here's an example of ObtainCreditCardAction for Symfony: https://github.com/Payum/Payum/blob/master/src/Payum/Core/Bridge/Symfony/Action/ObtainCreditCardAction.php



来源:https://stackoverflow.com/questions/27777599/error-credit-card-details-has-to-be-set-explicitly-or-there-has-to-be-an-action

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!