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

  • SEARCH
  • Home
  • 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 9128309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:29:06+00:00 2026-06-17T07:29:06+00:00

I am trying to use Authorize.Net in a kohana 3.0 project. I have set

  • 0

I am trying to use Authorize.Net in a kohana 3.0 project. I have set up the module in the bootstrap.php file.
I want to best understand the process before I focus on the code. In their sample code, it is written.

<?php
require_once 'anet_php_sdk/AuthorizeNet.php'; // Include the SDK you downloaded in Step 2
$api_login_id = 'I_put_my_login_id_here';
$transaction_key = 'and_my_transaction_key_here;
$amount = "5.99";
$fp_timestamp = time();
$fp_sequence = "123" . time(); // Enter an invoice or other unique number.
$fingerprint = AuthorizeNetSIM_Form::getFingerprint($api_login_id,
  $transaction_key, $amount, $fp_sequence, $fp_timestamp)
?>

<form method='post' action="https://test.authorize.net/gateway/transact.dll">
<input type='hidden' name="x_login" value="<?php echo $api_login_id?>" />
<input type='hidden' name="x_fp_hash" value="<?php echo $fingerprint?>" />
<input type='hidden' name="x_amount" value="<?php echo $amount?>" />
<input type='hidden' name="x_fp_timestamp" value="<?php echo $fp_timestamp?>" />
<input type='hidden' name="x_fp_sequence" value="<?php echo $fp_sequence?>" />
<input type='hidden' name="x_version" value="3.1">
<input type='hidden' name="x_show_form" value="payment_form">
<input type='hidden' name="x_test_request" value="false" />
<input type='hidden' name="x_method" value="cc">
<input type='submit' value="Click here for the secure payment form">
</form>

So, I suppose a user accesses my website and tries to buy a product. I handle the process into the controller. I will use the php_curl.

public function action_authorize(){
$url = 'https://test.authorize.net/gateway/transact.dll';

                    $post_string = '';
                    $request = curl_init($url);

                    curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
                    curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
                    curl_setopt($request, CURLOPT_POSTFIELDS, $post_string); // use HTTP POST to send form data
                    curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment this line if you get no gateway response.

                    $post_response = curl_exec($request); // execute curl post and store results in $post_response

                    curl_close($request);

                    $response_array = explode($post_values["x_delim_char"],$post_response);
}

Here my problem is how can I know the server response to my query result in *$response_array*. How to identify error codes ?
Another thing, I enable the Authorize module. How can I access the *’api_login’* and the
*’transaction_key’* from my controller ?
When I do this in the controller, I get an error
*

$authorize = new Authorize;
$authorize->api_login;
  • gives an error.
    In fact I want to be able to implement Authorize.NET module in Kohana3.0
  • 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-17T07:29:07+00:00Added an answer on June 17, 2026 at 7:29 am

    Store your Authorize.Net SDK classes in application/vendor/anet_php_sdk/

    Demo Controller Method:

    class Controller_Payment extends Controller_Template
    {
        // Set properties at the top of the class for easier changes later
        $this->authorize_url = 'https://test.authorize.net/gateway/transact.dll';
        $this->api_login_id = 'I_put_my_login_id_here';
    
        public function action_authorize()
        {
            require Kohana::find_file('vendor', 'anet_php_sdk/AuthorizeNet');
    
            if($_POST)
            {
                $request = curl_init($this->authorize_url);
    
                // Build your post string
                $post_string = http_build_query($_POST);
    
                // The rest of the Authorize.net code
                curl_setopt($request, CURLOPT_HEADER, 0);
                curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
                curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
                curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
                $post_response = curl_exec($request);
                curl_close($request);
    
                $response_array = explode($post_values["x_delim_char"],$post_response);
    
                // Look in your SDK docs to determine the actual values you need
                // to check to verify that the transaction was successful:
                if($response_array['code'] == 200)
                {
                    Request::current()->redirect('success/page');
                }
                else
                {
                    // Error handling
                }
            }
    
            $transaction_key = 'transaction_key_here;
            $amount = "5.99";
            $fp_timestamp = time();
            $fp_sequence = "123" . time(); // Enter an invoice or other unique number.
            $fingerprint = AuthorizeNetSIM_Form::getFingerprint($this->api_login_id,
                $transaction_key, $amount, $fp_sequence, $fp_timestamp)
    
            $this->template->content = View::factory('payment/page')
                ->set('api_login_id', $this->api_login_id)
                ->set('amount = $amount)
                ->set('fp_timestamp = $fp_timestamp)
                ->set('fp_sequence = $fp_sequence)
                ->set('fingerprint', $fingerprint);
        }
    }
    

    Since you asked, accessing the POST variables from the controller:

    $transaction_key = $_POST['transaction_key'];
    

    View file (views/payment/page.php):

    <form method='post' action="payment/authorize">
    <input type='hidden' name="x_login" value="<?php echo $api_login_id?>" />
    <input type='hidden' name="x_fp_hash" value="<?php echo $fingerprint?>" />
    <input type='hidden' name="x_amount" value="<?php echo $amount?>" />
    <input type='hidden' name="x_fp_timestamp" value="<?php echo $fp_timestamp?>" />
    <input type='hidden' name="x_fp_sequence" value="<?php echo $fp_sequence?>" />
    <input type='hidden' name="x_version" value="3.1">
    <input type='hidden' name="x_show_form" value="payment_form">
    <input type='hidden' name="x_test_request" value="false" />
    <input type='hidden' name="x_method" value="cc">
    <input type='submit' value="Click here for the secure payment form">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I'm trying to use the authorize.net library for CI2.0 from https://github.com/cloudmanic/codeignitor-authorizenet-cim-library When running fulltest()
I'm trying to use httplib to send credit card information to authorize.net. When i
I am trying to use Authorize.net's SIM payment gateway process and am using the
I am trying use gem tire to search in my application. I have tables
I was trying use a set of filter functions to run the appropriate routine,
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am trying to find a way to refund payments using Authorize.net's AIM API.
We are trying to create a more specific [Authorize] Attribute for Asp.Net MVC [AttributeUsage(AttributeTargets.All)]
i'm trying to use OutputCaching in my ASP.NET MVC website. Problem is, when 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.