Download cInvoice User Guide

Transcript
CInvoice User Guide
6.0 Payment Plugin Development
The cInvoice allows you to create your own payment plugin. Once you mount your
payment plugin into the system, the pay link or button will be shown in the invoice
list page and invoice details page for your client. (The admin login won’t see the pay
button. To test the feature, please use client logins.)
Payment plugin has two parts in terms of coding, one for creating button to allow
your client to pay, the other allow your merchant account provider to call back to
update your invoice payment status.
6.1
How payment plugin works for cInvoice
In the include/paymentsys.php, we defined a base class for payments. Your payment
class extends this base class (you do not have to as long as you implements all
methods needed in the interface code, such as do_payment($client_id,
$invoice_id, $amount, $link_text, $ppmoneyunit, $use_icon=false)).
In your payment class, you need implement do_payment method. The cInvoice will
call this function to build the do_pay link.
In your do_payment method, you may alternatively to call another file to present
your client an interface to input payment info. This payment info is submitted to your
logic file to process, i.e. communicating with your merchant account gateway for
processing. Based on your communication with your merchant account gateway, call
methods in invoices.php class to update invoice payment status. Please review
moneris payment plugin for a good example.
If your merchant account gateway does not send back response for your payment
call, then you may need to create a file for your merchant account provider to call
back (Not all merchant account provides this service, check with your merchant
account provider). For example, you create a file call ipn.php for your merchant
account provider to call back. You may also need to register this file with your
merchant account.
Group all your files, put them into
<cinvoice_root>/payment/<your_payment_plugin_name>
Then, edit the file <cinvoice_root>/payment/payments.php
Page 44