Menu

#6280 Create a payment gateway plugin

Parent Category:
DPCalendar
Category:
Developer corner
Last Updated:
Allon Moritz, Monday, 27 May 2024 08:33 (4 weeks ago.)
Created:
Monday, 27 August 2018 14:27
Hits:
2506

Introduction

DPCalendar lets 3rd party Joomla extensions interact with DPCalendar easily through plugin events. How a Joomla plugin can be developed is described in this article. DPCalendar fires the Joomla content events when an event is saved or displayed. This allows other plugins to interfere into the processes. For example the Joomla custom fields are integrated like that into the forms and when displaying events, locations, bookings or tickets.

If you want to integrate your own payment provider for DPCalendar, then you have to write a plugin for the dpcalendarpay group. Basically we fire the three events which are described below to work with a payment provider. It is recommended to inherit your plugin class from the PaymentPlugin class.

PaymentPlugin class

The PaymentPlugin class (located at /administrator/components/com_dpcalendar/admin/libraries/dpcalendar/DPCalendar/Plugin/PaymentPlugin.php) provides some convenient helper functions to integrate your payment provider into DPCalendar. It is highly recommended to extend your plugin class from the DPCalendar plugin. For extension developer are the functions "startTransaction" and "finishTransaction" interesting as there you can implement the payment gateway logic. All the rest is handled by the PaymentPlugin class itself.

Events

onDPPaymentNew

Description
Will be executed when a payment provider is selected and the booking gets paid. When the payment provider has output then this can simply be returned otherwise a redirect can be done here to the payment provider site.

Parameters

  1. booking The booking which gets processed by the payment provider.

Return value
HTML string.

onDPPaymentCallBack

Description
Will be executed when the user returns from the payment provider.

Parameters

  1. booking The booking which got processed by the payment provider.
  2. data
    The data from the payment provider.

Return value
Boolean if all is ok.

onDPCalendarLoadInvoice

Description
Will be executed when the PDF invoice is generated for a booking.

Parameters

  1. booking The booking to generate the invoice for.

Return value
Array with the following keys:

  • name: The name of the file
  • content: The binary content
  • mime: The mime type, when not set 'application/pdf' is assumed
  • size: The size of the file, defaults to 0 when not set

onDPPaymentProviders

Description
The payment providers of the plugin.

Parameters

  1. name The name of the plugin to get them from.

Return value
The payment providers array.

Example

We ship in our pro packages different payment plugins. The easiest way is to check them out to see, how you can integrate your payment provider.

Comments (0)

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.