Video - Creating Drivers

Watch the Video Here

Why create your own driver?

Because you think the idea of an open source PHP project supporting many payment gateways with one API is sexy as hell. Because you're not a douche. Because you like writing code and want to sharpen your teeth with payment APIs. These, and many others, are all excellent reasons to contribute to PHP-Payments.

Successfully integrating a new driver into PHP-Payments is all about preparation. You'll need to complete the following pre-requisites:

  • Have a testing account available for the gateway you want to integrate.
  • Have a github profile and create your own fork of the project.
  • Carefully examine which methods are supported by your gateway and what format they expect interaction to be in.
  • Find out if your gateway has an SDK. If it's any good, you may be able to just drop it into the vendor folder and write an interface for it.

Next, make sure you understand how PHP-Payments works.

PHP-Payments relies heavily on __call magic methods and matching methods and keys via arrays. Taking this approach allowed us to eliminate duplicate code and keep an extremely clear detail of what methods and parameters were supported by each method within each gateway, within the driver itself. When you instantiate PHP-Payments, the library first autoloads some helper classes such as a utility class, a response class, a request class, the payment driver abstract class. When you call a method, PHP-Payments make sure the driver and method you're using exists, and via the method_map() function which is implemented in each driver, ensures you've submitted the required keys for that method. If all checks out, the request can be made.

Hopefully you have a good feel for how PHP-Payments works. If you need any help, you can always create an issue on Github or add Calvin on Skype. His handle is halcyon-sky.

Support PHP-Payments

This stuff takes a lot of hard work. To date, we've logged hundreds of hours on this project, and sadly free code doesn't pay bills.

Contribute Code