(858) 586 7777 | About | Testimonials | Contact
vteams vteams vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
Blog
  1. vteams
  2. Blog
  3. Developing A Recurring Cart Extension for Placing Orders in Magento
Jul 01
Recurring-Cart-Extension-in-magento

Developing A Recurring Cart Extension for Placing Orders in Magento

  • July 1, 2016

vteam #602 was required to develop a recurring cart extension for Magento. The client wanted its customers to place orders automatically using a Cron script.

Creation of recurring cart functionality was a straight forward task. But the payment method for automatic orders was problematic. vteams engineer Tahir Yasin had to use Authorize.Net CIM Payment Gateway recommended by the client. This method was used to gather credit cards’ account information of customers. Once the account data was stored in the CIM, there would be no need of requiring that particular individual’s card number to access the information.

It was impossible to fetch the stored credit card account details and create a new order using that information. The data was tokenized and Magento required full credit card number, CVV, card expiry and billing address. Hence, the information was clearly unavailable. The following attempt didn’t work:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$savedCards = Mage::getModel('tokenbase/card')->getCollection();
$savedCards->addFieldToFilter('active', 1)->addFieldToFilter('customer_id', $customer_id);
$card = $savedCards->getFirstItem();
$additional = $card->getAdditional();
$orderPayment = Mage::getModel('sales/order_payment')
        ->setStoreId(1)
        ->setCustomerPaymentId($card->getPaymentId())
        ->setMethod('authnetcim')
        ->setCcNumberEnc($card->getHash())
        ->setCcOwner('Tahir Yasin')
        ->setCcType($additional['cc_type'])
        ->setCcExpMonth($additional['cc_exp_month'])
        ->setCcExpYear($additional['cc_exp_year'])
        ->setCcLast4($additional['cc_last4']);
$this->_order->setPayment($orderPayment);

Tahir tried taking the help from support team of cart extension that gave him a clue to use card hash instead of encrypted card number. He had to come up with a solution as the information wasn’t available on any internet forum.

Based on research, Tahir created a quote and converted it into order. After that, Authorize.Net CIM payment gateway was applied to the quote. The card hash was then added to the quote/order payment object. Using tokenized information, the payment method handled its billing.

The following cron script solved the issue using saved credit cards that placed orders automatically:

1
2
3
4
$quote->getPayment()->importData(array(
                        'method' => ‘authnetcim’,
                        'card_id' => $card->getHash(),
                    ));

 

  • Facebook
  • Twitter
  • Tumblr
  • Pinterest
  • Google+
  • LinkedIn
  • E-Mail

Comments are closed.

SEARCH BLOG

Categories

  • Blog (492)
  • Captain's Log (1)
  • Closure Reports (45)
  • Experiments (7)
  • How-To (57)
  • Implementation Notes (148)
  • Learn More (158)
  • LMS (8)
  • Look Inside (10)
  • Operations Log (12)
  • Programmer Notes (20)
  • R&D (14)
  • Rescue Log (4)
  • Testimonials (25)
  • Uncategorized (4)

RECENT STORIES

  • Ultimate Django: Become a Skilled Developer in 5 minutes
  • Create your 1st workflow with GitHub Actions within 5 Minutes
  • GitHub Actions- Automate your software workflows with excellence
  • Yii Framework – Accomplish Repetitive & Iterative Projects with Ease
  • A Recipe for CRM Software Development

ARCHIVES

In Short

With the vteams model, you bypass the middleman and hire your own offshore engineers - they work exclusively for you. You pay a reasonable monthly wage and get the job done without hassles, re-negotiations, feature counts or budget overruns.

Goals for 2020

  • Open development center in Australia
  • Complete and Launch the Robot
  • Structural changes to better address Clients' needs

Contact Us

Address: NEXTWERK INC.
6790 Embarcadero Ln, Ste 100,
Carlsbad, CA 92011, USA

Tel: (858) 586 7777
Email: fahad@nextwerk.com
Web: www.vteams.com

© 2020 vteams. All Rights Reserved.

Content Protection by DMCA.com