6 replies [Last post]
ellis's picture
Offline
Joined: 05/24/2011
Juice: 8
Was this information Helpful?

Hello,

I have recently setup a store for a client using ubercart and authorize.net.

They have a few different product classes.
Some product classes have products that have a lead time, because of this we have setup authorize.net to only authorize the amount but not capture it until the item is shipped.
The capture is processed manually once the product has shipped to the customer.

This client also sells software. Currently the software purchases are going through mivamerchant which automatically authorizes and captures using the same authorize.net account.
They would like to move their software sales over to ubercart and the CMS we've created for them.
To do this would require that a certain product class ('Software') Authorizes and Captures at checkout so that the customer could download the software immediately as opposed to waiting for the capture to be processed manually.
Currently we have configured the software product class so that the "Buy Now" button is replaced with a "Download" button which links to the mivamerchant cart page.

I searched through the forums and was unable to find any solution that would do this. I looked through conditional actions but could not find a trigger that would change the way authorize.net processes payment.

Is this going to require custom code or could it be handled with a conditional action?
Any help would be greatly appreciated, and if a solution does require custom coding we are very willing to pay for it.

Thanks,
ellis

a.ross's picture
Offline
Joined: 06/22/2011
Juice: 3
Re: Authorize.net Payments: Authorize Some Product Class, Author

What about the File downloads module which is in Ubercart's package?

tinker's picture
Offline
Joined: 05/26/2010
Juice: 94
Probably need custom module or extend Conditional Payments

There is the Conditional Payments module for Ubercart that provides a CA payment trigger but does not provide and Condition Action to set the credit auth capture. It can only select between different payment option on the top level, e.g. credit card, cod, check, and cannot control the authorization method used by credit card purchases. AFAIK there is no other module that changes payment types. You will probably need a custom module that hooks into the checkout process, detects if all products in cart are "Software" type, and alters the payment method to force UC_CREDIT_AUTH_CAPTURE. Probably not an easy task. Would be nice if you extended the Conditional Payments module to meet your needs and shared with the public.

tinker's picture
Offline
Joined: 05/26/2010
Juice: 94
Probably need custom module or extend Conditional Payments

There is the Conditional Payments module for Ubercart that provides a CA payment trigger but does not provide and Condition Action to set the credit auth capture. It can only select between different payment option on the top level, e.g. credit card, cod, check, and cannot control the authorization method used by credit card purchases. AFAIK there is no other module that changes payment types. You will probably need a custom module that hooks into the checkout process, detects if all products in cart are "Software" type, and alters the payment method to force UC_CREDIT_AUTH_CAPTURE. Probably not an easy task. Would be nice if you extended the Conditional Payments module to meet your needs and shared with the public.

imrubio's picture
Offline
Joined: 01/28/2011
Juice: 50
will this work

Hi All,

Has anyone found a way to create the action that captures the payment? My scenario is a little different and probably simpler in that all I want to do is capture payment for orders with the status 'Shipped'. The Shipped status is applied after having imported an order update using UC_EDI. I'm looking at using the Action to fire a php script when certain conditions are met but I'm not sure if the uc_payment_process() function within uc_payment.module will do what I need. Does anyone know for sure or if there is a better way to do this? I haven't been able to find more info on the web and forums. I'm going to test that function and I'll report back whether it worked or not.

thanks!

imrubio's picture
Offline
Joined: 01/28/2011
Juice: 50
update to will this work

Okay. So I have tried firing the PHP script to run uc_payment_process() which calls for passing in the $data array. Since there isn't a form being used to fire this function I can't really pass in $data unless I rebuild that array with order info. However, I found a document posted by CommerceGuys that shows an example where $data in the function call is replaced with array(‘txn_type’ => UC_CREDIT_AUTH_CAPTURE). I feel this is getting closer but not quite there yet as it's not working. Here's my full function call ---> uc_payment_process('credit', $order->order_id, $order->order_total, array(‘txn_type’ => UC_CREDIT_AUTH_CAPTURE), TRUE, NULL, FALSE);

Anyone have any clues to help?

thanks!

imrubio's picture
Offline
Joined: 01/28/2011
Juice: 50
Conditional Actions to capture payment through Authorize.net

So I'm happy to say that I got Conditional Actions to fire a PHP script that will capture a previously authorized payment through Authorize.net. I'm sure you can tweek this to work with some other payment gateway or to authorize and capture immediately by changing a few things. Here's the code I place within the Actions tab of a Conditional Action. I'm using the action 'Execute custom PHP code'.

foreach ($order->data['cc_txns']['authorizations'] as $auth_id => $data) {
    $auth_id_good = strtoupper($auth_id);
  }

$data = $order->data;
$data['txn_type'] = UC_CREDIT_PRIOR_AUTH_CAPTURE;
$data['auth_id'] = $auth_id_good;

//capture the amount
uc_payment_process('credit', $order->order_id, $order->order_total, $data, TRUE, NULL, FALSE);

The foreach statement is taken and modified from uc_credit.module. I'm passing in other order data from $order but I'm not quite sure if it's really needed. I think the important info is the $auth_id since I want to capture a previously authorized transaction.

I hope this helps someone!