【发布时间】:2018-03-19 05:07:32
【问题描述】:
我需要在 Magento 2.1.5 中以编程方式 (BrainTree) 将信用卡详细信息添加到 Vault
基本上我想要的是在 LoginIn 之后将有一个单独的部分用于保存卡。在那个客户用于添加/编辑/删除他所有的信用卡详细信息。
以下代码用于列出客户保存的所有信用卡
use Magento\Vault\Api\PaymentTokenManagementInterface;
use Magento\Customer\Model\Session;
...
// Get the customer id (currently logged in user)
$customerId = $this->session->getCustomer()->getId();
// Card list
$cardList = $this->paymentTokenManagement->getListByCustomerId($customerId);
现在我想要的是如何将卡片详细信息添加到保险柜?
以下是核心php中添加卡片的代码
$result = Braintree_Customer::create(array(
'firstName' => 'first name',
'lastName' => 'last name',
'company' => 'company',
'email' => 'xxxx@gmail.com',
'phone' => '1234567890',
'creditCard' => array(
'cardholderName' => 'xxx xxx',
'number' => '4000 0000 0000 0002 ',
'expirationMonth' => '10',
'expirationYear' => 2020,
'cvv' => '123',
'billingAddress' => array(
'firstName' => 'My First name',
'lastName' => 'My Last name'
)
)
));
但是我如何在 magento 2 中执行相同的过程。
感谢您的帮助
【问题讨论】:
标签: magento2