thephpleague / omnipay

A framework agnostic, multi-gateway payment processing library for PHP 5.6+
http://omnipay.thephpleague.com/
MIT License
5.94k stars 928 forks source link

How to use OmniPay from my Symfony2 bundle #106

Closed reypm closed 11 years ago

reypm commented 11 years ago

Hi, I'll like to use this amazing library in my bundle but I don't know how to. I read example here https://github.com/adrianmacneil/omnipay/blob/master/example/index.php but I'm not so clear in how to create a form to ask users about payment with credit card, what is the right way to do this? I found Sylius OmniPay bundle but it's not complete and I don't like it so I use the library from within my bundle

makasim commented 11 years ago

You may want to look at PayumBundle it allows to use omnipay gateways via OmnipayBridge. The bridge could miss some of the options but the bundle itself support capture\sync\instantnotifications out of the box with some small confugration.

Check the sandbox source, web. there is an ominpay usage example.

reypm commented 11 years ago

I'm getting this error after add the Payum bundle to my composer.json file:

Your requirements could not be resolved to an installable set of packages.

Problem 1

How I can fix it?

makasim commented 11 years ago

I will fix it tomorrow

makasim commented 11 years ago

I suggest you to use 0.5.x branch as it is stable and would not have any BC.

amacneil commented 11 years ago

While I'm not particularly familiar with symfony, you can just create a regular form in your application to accept the credit card details, and pass them through to omnipay in your controller - there's really no need to complicate things with any extra levels of abstraction.

This discussion would probably be best suited for stack overflow though, it's not a bug in omnipay.

reypm commented 11 years ago

@makasim well the error happen when I include the JSON line "payum/payum-bundle": "dev-master" since internally dependencies are resolved or I'm wrong?

makasim commented 11 years ago

This discussion would probably be best suited for stack overflow though, it's not a bug in omnipay.

yes, agree @paquitodev could you open an issue on payum bundle so we can continue there?

reypm commented 11 years ago

Done @makasim https://github.com/Payum/PayumBundle/issues/33

anush commented 11 years ago

I tried the Payum bridge, but it seemed like overkill to have two layers of abstraction to payment gateways. I've started working on a more direct Symfony2 support for Omnipay. It's pretty much working now, but would love to have others try it out: xola/OmnipayBundle

makasim commented 11 years ago

@anushr that's ok about payum, but maybe it would be a good idea to reuse https://github.com/Sylius/SyliusOmnipayBundle and do not invent one more bundle. As far as I can see it does exactly same thing your bundle does.

amacneil commented 11 years ago

@anushr That's great, I know there were a few people interested in seeing a Symfony bundle for Omnipay. I've since set up a google group so if you have any questions about integrating with Omnipay would be great to discuss there. I'll ping the Sylius guys too and see how they are getting on.

cordoval commented 11 years ago

I think just use payum, is almost done integrated with sylius. Not sure why you think payum is not good. Is very good for abstracting and is a different layer which omnipay doesn't reach. Both are complementary.

anush commented 11 years ago

@makasim You're right. For whatever reason, I had initially thought that I needed to be using Sylius in order to use that bundle. I'll take another look and see if it fits my needs.

@adrianmacneil I'm happy to take a deeper look into Sylius. If it makes more sense just to contribute to that, will do.

@cordoval I didn't say Payum is not good -- it seems like it's a good abstraction layer with support for many gateways. It's just that I prefer to use less layers of abstraction. But if Payum works well for you and others, then great! Choice is good :)