Magento 2 Extensions:Saved Credit Cards

From XTENTO Support Wiki
Jump to: navigation, search
This is a guide for Magento 2. This extension is a Magento 2 only extension, we don't offer a version for Magento 1 at this point.

Ccsave.png
Buy-now.png

Contents

Overview

Saved Credit Card functionality for Magento 2 is back! Do you need to process credit cards offline or using your card terminal manually? Need to save credit card numbers for orders placed by your customers? Then this is the extension you've been looking for - this is a payment method for Magento that saves credit card information entered in the checkout by your customers encrypted in the Magento database.

Interested in this Magento Extension?

Head over to our store to purchase this extension: Saved Credit Cards (Magento 2)

Got questions? Feel free to contact us! Contact Form

Setting up the extension

The extensions configuration section is located at System > XTENTO > Saved Credit Cards. Make sure to enable the module there.

Then, go to Stores > Configuration > Sales > Payment Methods and open the "Saved Credit Cards" payment method. Enable the payment method, and configure the payment method title, as well as other settings such as whether card validation code is required, etc.

You can now use this payment method in the checkout/backend.

Using the extension

Credit card information entered by customers can be seen when viewing an order at Sales > Orders. From the orders details page, you can also wipe the credit card information.

Retrieving CC data programmatically

Credit card information is encrypted using Magentos encryption functions, specifically \Magento\Framework\Encryption\Encryptor::encrypt().

You can decrypt it using \Magento\Framework\Encryption\Encryptor::decrypt().

Credit card information is stored in the sales_order_payment table in the additional_information field, in a serialized manner.

Sample code:

<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$decryptor = $objectManager->get('\Magento\Framework\Encryption\Encryptor');
$paymentDetails = $order->getPayment();
$ccNo = $decryptor->decrypt($paymentDetails->getAdditionalInformation('cc_number_enc'));
$ccCVC = $decryptor->decrypt($paymentDetails->getAdditionalInformation('cc_cid_enc'));
$ccType = $paymentDetails->getAdditionalInformation('cc_type');
$ccLastFour = $paymentDetails->getAdditionalInformation('cc_last_4');
$ccExpiryMonth = $paymentDetails->getAdditionalInformation('cc_exp_month');
$ccExpiryYear = $paymentDetails->getAdditionalInformation('cc_exp_year');
?>
 
<?php if ($paymentDetails->getMethod() == 'xtsavedcc'): ?>
<?php echo $ccType ?> <?php echo $ccNo; ?> (<?php echo $ccExpiryMonth?>/<?php echo $ccExpiryYear?>) / CVC: <?php echo $ccCVC ?>
<?php endif; ?>

Troubleshooting

Checkout: Month / Year duplicated, CC validation fails

This seems to be caused by the "Magenest_Stripe" module you have installed.

Disable it: bin/magento module:disable Magenest_Stripe

The Magenest_Stripe module does a "rewrite" on the CC config provider class, which they shouldn't because it affects other payment methods as well, the way they do it now. Every new CC payment method you'd install in Magento 2 would have the same issue like our extension if Magenest_Stripe is enabled. So if you need to use this module, you will need to contact them and ask for a fix. Otherwise, just leave disabled.

Checkout: Add billing address into "Payment Method" step

Open the file: app\code\Xtento\SavedCc\view\frontend\layout\checkout_index_index.xml

Look for: <item name="isBillingAddressRequired" xsi:type="boolean">false</item>

Replace with: <item name="isBillingAddressRequired" xsi:type="boolean">true</item>

Save file. Clear Magento cache.

Note: Once you upgrade the module, you will need to make this change again.

Multiple address checkout

The multiple address checkout feature of Magento is not supported by the extension. We don't have plans to add this feature to the extension.

Personal tools
Namespaces
Variants
Actions
General Information
Magento 2 Guides
Magento 2 Extensions
Magento 1 Guides
Magento 1 Extensions
Magento Integration Suite
Product Feed Guides
Toolbox