PHPBuilder - CyberCash Page 4



RSS Twitter
Articles Application Architecture

CyberCash - Page 4

by: Nathan Cassano
|
December 24, 2000

Next let's look at an outline example of an order processing script using the cyberauth.

<?php

include('cyberauth.php');

/*
 Verify your user input
*/

/* Make authorization request */
$result cyberauth(array(
'order-desc' => "$order-description",
'amount' => "usd $order-price",
'card-number' => "$card-num",
'card-name' => "$card-name",
'card-exp' => "$card-month/$card-year",
'card-address' => "$card-address",
'card-city' => "$card-city",
'card-state' => "$card-state",
'card-zip' => "$card-zip",
'card-country' => "$card-country"
)
);


/* If the authorization was a success */
if($result['success']){
    
/* Fulfill the order */

    /* Show and email receipt */
}else{
    
/* Else return error */
    
echo $result['message'];
    exit();
}

?>
As it goes in this outline, the user input is first verified. If you catch input errors here it will keep CyberCash from returning missing field and other errors. Next the authorization request is sent to CyberCash. If it is successful then the customer receives there goods or services. If it was otherwise an error is displayed to the customer and the script exits . Lastly, display the customer's order receipt. Emailing a receipt to the customer's email address is also a good thing to do.

Conclusion

CyberCash is an extensive topic. Many issues were not addressed in this article because they do not specifically relate to PHP and CyberCash and are covered in the CyberCash documentation. To get a full understanding of CyberCash development and management you need to read the documentation provided by CyberCash.
In the future I see CyberClass transitioning into a PEAR (PHP Extension and Add-on Repository) module or the like. Also, development of integrated CyberCash applications would be better for flexibility and customization in things like authorizations, voids, returns and batches. The applications could tie into the PEAR DB.php module to properly log the transactions on any database that DB.php supports.
So there is certainly room left for growth for PHP CyberCash support, but I believe with time PHP can have better support for CyberCash than CyberCashes supported languages if developers continue to share their code and experience.
-- Nathan

« Previous Page
1
|
2
|
3
|
4

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Nathan Cassano

Comment:



Comment:

(Maximum characters: 1200). You have characters left.