i have just set up indico and i would like to create a payment plugin for my organisation’s payment service provider. is there any guide available on how to do this?
You have a guide on how to create Indico plugins here:
The best option is to look at the code of the paypal plugin, copy it and adapt it to your payment provider.
We had a development for paybox (“french paypal”) in CTA, which I had started to document here. It is outdated now (for 0.97), but eventually can serve as a guideline. And everyone is free to update this documentation.
I just requested the merge into the indico github.
Thanks for the suggestion of adding it to the wiki, but considering how much the plugin system (and payment method integration) changed I’m afraid a plugin written for 1.2 and earlier won’t be much help for any new payment plugin.
I see exactly one line which is outdated. (“Install the python/Indico code under /MaKaC/plugins/EPayment.”)
It should be easy to find the up to date replacement for that, and the rest will still serve for the case of paybox. But I do not want to change the documentation without having tested. Maybe @HDSS can say, what he wants to do exactly, and if he is ready to share his success/recipe with the community afterwards.
Not only the way how plugins are registered changed but also all the APIs related to integration with indico’s payment module.
thanks for pointing me to the PayPal plugin. I’ve now almost completed writing my own payment plugin. However i got two questions:
i can only exchange a very limited amount of data with the payment provider. so instead of identifying an event by it’s uuid in the controller
self.registration = Registration.find_first(uuid=self.token)
i am using the shorter id
self.registration = Registration.find_first(id=self.reg_id)
is this safe, or can i end up registering transactions on the wrong event?
i would like to add payment error notifications to the event’s log:
so that a conference organizer can help people encountering problems in the payment proccess.
haw can i access that log from the plugin’s controller?
You can use the ID instead of the token, it’s also unique. Just keep in mind that the tokens are secret (only the event managers and the registrant can see them) as they can be used to access/manage the registration while the IDs aren’t (they are just numbers that increment for each registration). You can simplify the query in this case:
self.registration = Registration.get(self.reg_id). Note that by using the ID anyone could send requests to your endpoint that match a valid registration. Depending on how much logging you do it means someone could spam your event log (by sending requests for a valid registration ID but obviously without valid details about a payment)
self.registration.event.log(...)(see the docstring of
Event.log()and other places where this is being called for some information about the arguments)