0

I'm trying to understand how to create a new off site payment gateway for Gestpay (Italy premiere Payment Gateway from banca Sella) in expresso store using omnipay library but I really need some guidance.

1) I've understand that I need to make an extension and I've seen the skeleton store_check

2) I've read the "skinny" Build you own gateway on the omnipay website and the only thing I've understood is to look in the existing packages

3) I've looked in the existing packages and I've understand that I need a gateway.php that extends AbstractGateway and in that class I need to put needed parameters plus getters/setters and also the "charging" functions purchase() and completepurchase().

here my understanding starts to fail...

3.1) Ok to the parameters and getters/setters those are the parameters that are editable on Store Payment method configuration page

next there are some methods defined and I understand that purchase() function defines what to do to autorize and capture and that I need a completepurchase() function to handle return from of-site gateway

but next those "official" methods there are other functions in those gateways: for example fetchPaymentmethods() or fetchTransaction() etc etc that are not defined in the omnipay docs...

so I really don't understand if the "standardization" of omnipay is just to have purchase() and completepurchase() and than I can define any other method that I want/need

But also I don't understand who and where those fetch functions are being called

Please HELP!

IMPORTANT

I have also found this GitHub repo with all the code needed to make payments with gestpay but haven' managed to understand how to integrate it with omnipay (saddly a very good library with VERY POOR documentation)

1

You're on the right track. When I was first developing a payment gateway for Store, Adrian (who developed Store and Omnipay) told me this:

Basically there is a Gateway class to create the requests, then a Request class for each different type of request. The simplest possible implementation would only need a gateway class, a PurchaseRequest class, and a Response class.

You can add anything else you need, like custom methods for manipulating/formatting data, or loading external libraries to handle parts of the request.

(If you want to take a look at a couple of custom gateways I wrote from knowing zero about how Omnipay works, check them out here and here - though they are both for on-site gateways, and you say that your gateway is off-site, so the implementation may differ a little.)

As for the library you linked to, you'd want to bundle that code in your add-on, then include it, instantiate it, and use the results to tell the required Omnipay methods what to do.

As a starting point, I'd be looking at this example for an idea of what to do in your purchase() method, and this example for an idea of what to do in your completePurchase() method.

Hope that helps!

|improve this answer|||||
  • Thankyou Derek! just a clarification: Adrian told you to create gateway, purchaserequest and response. Regarding the last one I'm strugling to understand what the response class is because in the docs it's not clear... maybe completePurchase() is response? – Francesco Pensabene May 6 '15 at 16:21
  • Nope - the response class determines what happens after the payment is complete (or failed). See the docs, or have a look at my gateways. I found it helpful to just start building and doing a lot of debugging at each step to see what was happening in a test environment. – Derek Hogue May 6 '15 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.