How can I register a new Payment gateway?

I have created a PaymentDriver class, and a folder with a CreditCard class, but it does not show on the New Gateway providers list, I see you have a table on the database named gateways with a bunch of providers that do not show up in the dashboard either, so where do I have to register it so it can show up in the dashboard?

Thanks in advance.

Hi,

Have you seen the info here:

https://invoiceninja.github.io/docs/developer-guide/#adding-payment-gateways

@lucasctd

Please checkout the reference document Hillel posted above. This will guide you step by step.

Also, I am working on a sample set of scaffolded classes for an entire payment driver. You can inspect the code in this branch here:

https://github.com/turbo124/invoiceninja/tree/eway/app/PaymentDrivers/Samplehttps://github.com/turbo124/invoiceninja/tree/eway/app/PaymentDrivers/Sample

Let us know here if you need any further help.

1 Like

Thank you both, I will check that out.

@hillel Just wondering, why don’t you guys make the provider column unique and use it instead of the id in:
https://invoiceninja.github.io/docs/developer-guide/#step-3-app-models-gateway-php-model-getters-and-setters
The ids are auto generated making them hard to track. The provider column is already unique by your code convention so it would not be hard to make this movement I think and it’s also self-explanatory thus no more comments would be required to identify the providers there.

@hillel another thought that would require more work though, why don’t you guys put that stuff in the database? The help link - getHelp() - could easily be in the database and the getMethods() could be an enum column, so you wouldn’t have to change the Gateway model every time you add a payment driver.

I think it’s too much responsibility for that class actually.

@david any thoughts on this?

I was thinking about opening a PR for you to take a look, but first, I need to understand why do you have a table on the database for gateway types and payment types, but you seem to be using constants from the code instead.

Also, for both tables the ID’s are different than the ones you assigned in the model constants, so I am little confused.

@hillel I have a pay.blade page with a form that should be submitted to route(‘client.payments.response’) but for some reason, when I submit the form, it redirects to client.payments.show and I have no idea why.

I am getting a 404 on a resolveRouteBinding function

the $value received by the function is “process”, I have checked the middlewared, but I dont know why it goes to that route.

May you help me?

Thanks in advance.

@david any suggestions?

Most likely you are accessing this route via a GET - whereas it should be a POST

It seems you have some kind of middleware that’s redirecting the request to that endpoint since it does not reach the PaymentController@response method (which is where the route client.payments.response should address the request to).
I just was not able to figure out where it’s happening.

@hillel so it just happened to me what I have mentioned there: How can I register a new Payment gateway? - #5 by lucasctd

You guys added a new driver with a fixed ID number, so since I have already added a custom payment driver that’s not in your repository, I got an error running the migration because that ID is already in use.

I think you should not rely on a AUTOINCREMENT column for such thing, you could easy use the provider column which could be set to unique =)

I created a branch on my repo to do that before, but I am kind in lack of time to do it now;

@david any thoughts?

@lucasctd

We need to use fixed IDs due to our database cluster design.

However, you can PR your own gateway to the main repo and “claim” your our ID for your gateway so future updates won’t break the app.