Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8081249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:40:20+00:00 2026-06-05T16:40:20+00:00

So, horray – I’m attempting to create a new custom Payment Gateway. It’s designed

  • 0

So, horray – I’m attempting to create a new custom Payment Gateway. It’s designed to do auth/capture via a third-party API, but does NOT need to redirect to the third-party site.

From my understanding, when an order is placed/finalized in Magento, and the gateway is set to “Authorize and Capture”, it should be firing off the ‘capture’ method from the gateway model. Currently, it’s not doing this.

Of course, if I specifically capture from the Admin Order view, it’ll attempt to capture, but this needs to happen immediately upon checkout (and again, it’s my understanding that it already should).

In my gateway Model, I have the following (truncated for readability):

<?php
class Example_Gateway_Model_Payment extends Mage_Payment_Model_Method_Cc
{
    protected $_code = 'example';

    protected $_isGateway = true;
    protected $_canAuthorize = true;
    protected $_canCapture = true;
    protected $_canUseInternal = true;
    protected $_canUseCheckout = true;

    // This is an empty block class that extends Mage_Payment_Block_Form_Cc
    protected $_formBlockType = 'example/form_example';

    public function authorize(Varien_Object $payment, $amount)
    {
        Mage::log('Authorizing!');
    }

    public function capture(Varien_Object $payment, $amount)
    {
        Mage::log('** Capturing **');
        // Third-party API stuff would go here, with exceptions being thrown if the gateway determines they've provided an invalid card, etc.
    }

    public function assignData($data)
    {
        Mage::log('Assigning Data');
    }
}

This Payment model itself definitely works – I get logging output for assignData() and validate(), as well as __construct() if I add it. But no matter what I do, neither the capture or authorize methods fire when actually placing the order.

My config.xml reads somewhat like this:

<?xml version="1.0"?>
<config>
    <modules>
        <Example_Gateway>
            <version>0.0.5</version>
        </Example_Gateway>
    </modules>
    <global>
        <blocks>
            <gateway>
                <class>Example_Gateway_Block</class>
            </gateway>
        </blocks>
        <models>
            <gateway>
                <class>Example_Gateway_Model</class>
            </gateway>
        </models>
        <helpers>
            <gateway>
                <class>Example_Gateway_Helper</class>
            </gateway>
        </helpers>
    </global>
    <frontend>
      <!-- Snip.. Nothing special here -->
    </frontend>
    <default>
        <payment>
            <gateway>
                <sort_order>0</sort_order>
                <model>gateway/payment</model>
                <enabled>1</enabled>
                <order_staus>processing</order_status>
                <payment_action>authorize_capture</payment_action>
                <cctypes>VI,MC,AE,DI</cctypes>
                <useccv>1</useccv>
            </gateway>
        </payment>
    </default>
</config>

I don’t believe there’s a need for a resource model as I don’t need any additional tables; my expectation is that it will simply use sales_flat_order_payment and related tables to store any gateway-related/-provided data (txn id, etc)

Similarly, I’m simply extending the default CC block to get the standard payment form.

What am I missing? It has to be something small and simple that I’m overlooking.

Thanks in advance!


UPDATE:
So far, I have implemented a workaround that uses an observer to the checkout_type_onepage_save_order event that calls the capture() method manually – but I’m pretty sure this is not the right way to go.

I’m not wrong in thinking that Magento should automatically call capture() upon the initial order save, if the gateway is set to authorize_capture, right..?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:40:22+00:00Added an answer on June 5, 2026 at 4:40 pm

    Well, I used an observer to manually call the capture method.
    Not the most elegant solution, but it works well enough.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a new outgoing message with Microsoft Outlook 2011 for mac,
I create a new object of type Spam, with attr_accessor to both hooray and
I am fairly new to iphone development, and I am trying to create my
The idea here is to create a grid of boxes. underneath the black grid
The idea here is to create a grid of boxes. underneath the black grid
I am attempting to incorporate Windows Live ID in my application. First, I created
We're just getting started with a new project Visual Studio 2010 Team Foundation Server,
I'm an experienced software developer, but pretty new to JS and to node. I'm
I am using spring TransactionSynchronizationManager.Using this manager I register a new Synchronization TransactionSynchronizationAdapter and
Yesterday we received OTA Android 2.1 on my wife's HTC Droid - HOORAY!!! I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.