Jump to content
Larry Ullman's Book Forums
jwaldron92

How To Have Test Environment For Processing Payments?

Recommended Posts

My billing.php does not work, as the result is just a button that says processing. This is has to be the most frustrating coding I have ever done, its one thing finding a bug and reading about it, but there is no connection between the post method and final, there seems to be a loophole in my server.

The possible scenarios could be:
AuthorizeNet doesnt work, then which should I use?

 

The PHP built in server on PHPStorm is not using HTTP and the connection is never established (it uses a port on localhost)

 

In addition, why should I have to put in all the form data each time I do a test?
How do I create static variables instead of....

 

<?php create_form_input('cc_exp_year', 'select', $billing_errors); ?>

 

So here is my connections for the server
PHPStorm using built in server

define('BASE_URI', 'C:/xampp/htdocs/pay/coffeeShop/');
define('BASE_URL', 'localhost:8282/');
define('MYSQL', BASE_URI . 'mysql.inc.php');

 

 

Having a form of billing that loks like

if (!isset($_SESSION['customer_id'])) { // Redirect the user.
// $location = 'https://' . BASE_URL . 'checkout.php';
$location = '' . BASE_URL . 'checkout.php';
//$location='checkout.php';
header("Location: $location");
exit();
}

// Require the database connection:
require(MYSQL);

// Validate the billing form...

// For storing errors:
$billing_errors = array();

// Check for a form submission:
if ($_SERVER['REQUEST_METHOD'] === 'POST') {

...

...

if (isset($order_id, $order_total)) {


// Make the request to the payment gateway:
//require('library/anet_php_sdk/AuthorizeNet.php');
require('library/sdk-php-master/autoload.php');
define('API_LOGIN_ID', '***' );
define('TRANSACTION_KEY', '***' );
$aim = new AuthorizeNetAIM(API_LOGIN_ID, TRANSACTION_KEY);

// Are we testing?
//$aim->setSandbox(true);

// Set the amount (in dollars):
$aim->amount = $order_total/100;

...

...

 

if ($response->approved) {

// Add the transaction info to the session:
$_SESSION['response_code'] = $response->response_code;

// Redirect to the next page:
$location = '' . BASE_URL . 'final.php';
header("Location: $location");

exit();

}

...

 

Ultimately, looking to know what makes the processing take so long, and debugging strategies, thanks.

 

Share this post


Link to post
Share on other sites

Sorry for the delayed reply! I can't quite tell exactly what you're asking as you seem to be expressing many frustrations. I'm not an expert on PHPStorm, so I can't answer anything there, although it is possible PHPStorm is making it more complicated. I think the main thread here is problems testing Authorize.net locally. If you could confirm that, and if you're still having the same problem, that'd be great. Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...