phpwhmcs

WHMCS payment gateway: recurring but not credit card


I'm working on a custom WHMCS payment gateway module for the Mollie payment gateway. So far I integrated one-off payments with no issue, but I'm having some trouble implementing recurring payments.

The flow for either a subscription or authorization to charge the customer on-demand differs slightly.

The flow for creating a subscription is:

  1. Create a customer profile in Mollie
  2. Create a mandate by performing an authorization payment - used to link a payment method to a customer (must be a payment of at least €0.01, requires user input)
  3. Add a subscription to a mandate, telling Mollie to charge the associated card x amount every x days/weeks/months

The flow for authorizing the merchant to charge on-demand is:

  1. Create a customer profile in Mollie
  2. Create a mandate by performing an authorization payment - used to link a payment method to a customer (must be a payment of at least €0.01, requires user input)
  3. Merchant sends a payment request to Mollie for every new invoice

The problem that I have is that Mollie supports multiple payment methods per customer. While WHMCS has built their gateway module system around single-method gateways such as Stripe.

What I want to do is replace the credit card management page with a custom page (preferably generated in the module, without modifying any templates) that allows customers to manage their Mollie details. This would include seeing active mandates and adding new ones (again, a mandate is basically an authorization for me to use a specific payment method for subscriptions or on-demand charging).

I could not find any way of doing this in the WHMCS documentation. Is this at all possible, or should I accept that the only way for customers to see the pages generated by my module is for them to go through an invoice first.


Solution

  • You are going to need to create two modules that work together, a payment gateway module and an addon module. The addon module will allow you to create client side pages where customers can enter agreements / adjust agreements and then use the _link function to display a form where clients can pick which agreement to use when paying the invoice.