问题
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