Tuesday, September 21, 2010 - 05:13
Written by

Continuing the series, let's look at packaging payment processors. Before digging in the text below, make sure you're up to date with previous blog posts: on info file format and on packaging custom search.


We'll start as previously, by creating a directory named exactly the same as unique key that we're choosing for our extension. Let's use example of Google Checkout payment processor - both the key and the name of directory will be org.civicrm.googlecheckout.


Now, we need to create the info.xml file. Since this process has been described in detail before, going straight to final effect:


 <?xml version="1.0" encoding="UTF-8" ?>
 <extension key="org.civicrm.googlecheckout" type="payment">
  <name>Google Checkout</name>
  <description>Google Checkout Payment Processor</description>
  <maintainer>CiviCRM Core Team &lt;;</maintainer>
  <comments>For support, please contact project team on the forums. (</comments>


Again, following previous instructions, let's put info.xml and GoogleCheckout.php in the directory we just created. Payment processors do not require templates, so we don't need to follow any other steps that we know already, however, we need to do some more stuff in order for our extension to work.


First of all, this payment processor requires some external libraries to work - they're . Let's put them in packages directory inside org.civicrm.googlecheckout. So now, we have the following structure:


|-- CRM
|   |-- Contribute
|   |   `-- Payment
|   |       `-- Google.php
|   `-- Event
|       `-- Payment
|           `-- Google.php
|-- Google.php
|-- info.xml
|-- packages
|   `-- Google
|       |-- README
|       |-- demo
|       |   |-- cartdemo.php
|       |   `-- responsehandlerdemo.php
|       |-- googlemessage.log
|       `-- library
|           |-- googlecart.php
|           |-- googleitem.php
|           |-- googlemerchantcalculations.php
|           |-- googleresponse.php
|           |-- googleresult.php
|           |-- googleshipping.php
|           |-- googletaxrule.php
|           |-- googletaxtable.php
|           `-- xml-processing
|               |-- xmlbuilder.php
|               `-- xmlparser.php
`-- processor-type.xml 


Hey, there is one more file here that we didn't talk about before! We are going to need some additional information - hence the processor-type.xml file. It's contents reflect the contents of civicrm_payment_processor_type database table. Here's an example for Google Checkout payment processor (line break in urls are here only because of blog layout problems).


 <?xml version="1.0" encoding="UTF-8" ?>
  <user_name_label>Merchant ID</user_name_label>
Filed under