====== EPP-DRS payment modules API ====== This document will help you to create EPP-DRS payment module.\\ \\ :!: You can find sources for PayPal and BeanStream modules inside [[EPP-DRS SDK]].\\ \\ #toc# ===== Essential requirements ===== EPP-DRS payment module is a folder inside module/payments. Folder name is the name of your module. Module folder must contain at least one file named ''class.PaymentModule.php''. This file must contain PHP class called ''MyPaymentModule'', where ''My'' is the name of your payment module. :!: Module folder must also be named ''My'' in this case. The class must conform the following requirements: - Extend AbstractPaymentModule - Implement either ''IPostBackPaymentModule'' or ''IDirectPaymentModule'' interface \\ \\ For example, PayPal module will be defined like this: class PayPalPaymentModule extends AbstractPaymentModule implements IPostBackPaymentModule { } ===== IDirectPaymentModule or IPostBackPaymentModule? ===== If your module does not redirect users to external webpage and proccesses your payment internally (for example, using XML-RPC, SOAP or other protocol), and the status of the payment is known immediately, than you must implement IDirectPaymentModule. If to make a payment, user must leave your site and fill forms on gateway's website, then you must implement IPostBackPaymentModule. ==== IDirectPaymentModule ==== IDirectPaymentModule contains one single method, ProcessPayment(), which is called when user submits a payment form. See [[http://epp-drs.com/docs/phpdoc/|phpdoc]] for detailed description of a method. ==== IPostbackPaymentModule ==== Since this interface describes stateless transactions, it has two main methods: ''RedirectToGateway()'' and ''OnPaymentComplete()'' See [[http://epp-drs.com/docs/phpdoc/|phpdoc]] for detailed description of each method. The following proccess diagram will help you understand the ordering proccess flow: {{order-proccess-flow.png?150}} ===== Guide: Creating module using sample ===== - Copy folder from ''PAPI/samples/PayPal/'' or ''PAPI/samples/BeanStream/'' inside SDK to ''modules/payments'' inside EPP-DRS. - Rename folder to ''MyPaymentModule''. This will be the name of your module. - Open class.PaymentModule.php and rename the class inside to ''MyPaymentModule''. - Fill all methods. - Create module icon and copy it to ''www/images/modules/My_icon.gif'' - Log in to Registrar CP, configure module and try to make a payment using it. ===== Module icon ===== You must create an image that will be displayed as a module icon, and copy it in ''www/images/modules/ModuleName_icon.gif''.\\ You can find a template for creating module icons in ''resources/www/images/modules/template.png'' inside SDK.