Horde_Payment
Bugs
People
Code
Description
Features
Payment process for user
Step 1: Type selection
Step 2: Enter data
Step 3: Validation
Step 4: Redirection page
Writing your payment module
Files
List user payment request
Implementation Api calls
authorizationRequest() usage example
authorizationResponse() API example
authorizationReturn() API example
Screenshots
Resources
Horde_Payment
Unified payment processor providing payment gateway for any Horde module.
Bugs
List any tickets on http://bugs.horde.org/ that cover this issue or are relevant to it.
People
Duck duck@obala.net
Code
http://cvs.horde.org/incubator/Horde_Payment/
Description
A payment processing module encapsulating all communications with various payment interfaces.
The application just pushes a payment request with the authorizationRequest API call. When a payment is processed, the payment module calls the selling application's authorizationResponse callback API method to notify it of the results. After payment processing is finished, the user will be redirected to the calling application's webroot, or to the URL provided by authorizationReturn result if the selling application provides it.
The payment module provides an administrative interface to list and search payment requests per module, amount, user status etc.
Features
Built in payment methods
Cash on delivery
Proforma invoice
Known statuses
pending
revoked
successful
void
Configurable payment methods
Limit payment methods per user
Limit payment methods per application
Limit payment methods per amount
Virtual host support
Possibility to add a testing process request
Payment process for user
Step 1: Type selection
When the user is redirected to the selling interface, he/her will be asked to select a payment module. The list will be populated with all modules available that are active, linked to application owning the transaction and in the amount value parameters. If there is only one module available, the selection screen is avoided and user is redirected directly to the next step. User can always come back and choose another method, as revoke a transaction at any time.
Step 2: Enter data
User is asked for additional data required by the selected module. Values are stored in database for administrative purposes. This step is automatically skipped for modules does not need additional data entered by user. (See Horde_Payment_Method::hasLocalForm())
Step 3: Validation
The validation process of the payment module will be called or the user will be redirected to the remote validation page if the module has it. Here is where the selling application will be called back to be notified about authorization status change. (See Horde_Payment_Method::hasRemoteValidation(), Horde_Payment_Method::process())
Step 4: Redirection page
The user will be redirected back to the selling application page or to the result of the authorizationReturn call.
Writing your payment module
Files
A payment module is class extension of Horde_Payment_Method and should reside in a sub-directory /of lib/Modules named the same as you module. Inside this directory there must be:
version.php telling the configuration screen the version of your module
conf.xml a configuration options
Module.php man class file.
List user payment request
A lot of payment request ends by user abort (they change their mind, the line falls, system creases...) To remind them about their order, you can use the listAthorizations method to list user's pending authorizations. So they can restart the process where they finish wherever they want.
// Get authorisations for current application and user
$authorizations = $registry->call('payment/listAuthorizations',
array(array('module_name' => $registry->getApp(),
'user_uid' => Auth::getAuth())));
// Get status names
$statuses = $registry->call('payment/getStatuses');
// List all authorizations and link pending ones to paymnet procces
foreach ($authorizations as $authorization) {
echo date('y-m-d h:i:s', $authorization['created']) . '
';
echo $authorization['amount'] . '
';
echo $statuses[$authorization['status']] . '
';
if ($authorization['status'] == Horde_Payment::PENDING) {
$link = $registry->link('payment/show', array('id' => $authorization['authorization_id']));
echo ' - ' . _("Please click here to continue!") . '';
}
echo '