Hi Guys,
Im using OpenCart for a project that requires WorldPay support,
I'm a confident OOP PHP coder but would like to know if anybody has done this before, or if anybody has an empty class or example code to work from.
Thanks,
Mike
Im using OpenCart for a project that requires WorldPay support,
I'm a confident OOP PHP coder but would like to know if anybody has done this before, or if anybody has an empty class or example code to work from.
Thanks,
Mike
It will depend on the worldpay API.
If the customer is diverted to a worldpay website to collect credit card details for payment then the paypal module shipped with opencart or the new authorize.net (SIM) module by Qphoria are good starting points.
If you want to capture the customer's credit card details within opencart and send them to worldpay to make a payment then the SecurePay example in payment contributions is a good starting point.
The above mentioned can be found here.
cheers
Bruce
If the customer is diverted to a worldpay website to collect credit card details for payment then the paypal module shipped with opencart or the new authorize.net (SIM) module by Qphoria are good starting points.
If you want to capture the customer's credit card details within opencart and send them to worldpay to make a payment then the SecurePay example in payment contributions is a good starting point.
The above mentioned can be found here.
cheers
Bruce
OpenCart's structure is based on MVC (Model-View-Controller) Framework. OpenCartv0.x is about 66.66666% MVC (as model isn't really used in this version) and 1.x has been set 100% MVC. You can read more about MVC on wikipedia and such.
Anyway, to keep it simple.
There are 5 major sections.
1. First the "library" files do a lot of the common stuff. Handle sessions, totals, format conversions
2. Then the "controller" files are the invididual brains of each functional page. They define what content drives that page. Home page, product page, categories, cart, etc.
3. A subset of controller files are the "extension" files. These are the sideboxes, header/footer, but also where payment & shipping modules are handled. For example, the main controller for "checkout_shipping" looks up all the available shipping "extensions". The controller for "checkout_payment" looks up all the available payment "extensions".
4. The "View" part of MVC is handled by the Templates. These are the tpl files. There is virtually a one-for-one match between controller and templates. So 'catalog/controller/product.php is displayed using "catalog/template/default/content/product.tpl", etc.
5. Finally, as part of "view", proper language support is also used, a generic placeholder is put in place in the template file, and that placeholder variable is replaced by the version defined in the language file so "$text_yes" looks up in the current language setting and finds "yes" (in english) or "si" (in spanish), etc. It too has a similar directory structure with the related controllers.
Anyway, to keep it simple.
There are 5 major sections.
1. First the "library" files do a lot of the common stuff. Handle sessions, totals, format conversions
2. Then the "controller" files are the invididual brains of each functional page. They define what content drives that page. Home page, product page, categories, cart, etc.
3. A subset of controller files are the "extension" files. These are the sideboxes, header/footer, but also where payment & shipping modules are handled. For example, the main controller for "checkout_shipping" looks up all the available shipping "extensions". The controller for "checkout_payment" looks up all the available payment "extensions".
4. The "View" part of MVC is handled by the Templates. These are the tpl files. There is virtually a one-for-one match between controller and templates. So 'catalog/controller/product.php is displayed using "catalog/template/default/content/product.tpl", etc.
5. Finally, as part of "view", proper language support is also used, a generic placeholder is put in place in the template file, and that placeholder variable is replaced by the version defined in the language file so "$text_yes" looks up in the current language setting and finds "yes" (in english) or "si" (in spanish), etc. It too has a similar directory structure with the related controllers.
Last edited by Qphoria on Thu Oct 23, 2008 12:15 am, edited 1 time in total.
Hey Guys,
WorldPay module coming on really well, although my client hasn't received his account login so i'm kinda coding blind lol
I have written the controller for admin, the language and the template file. I'm just working on the catalog extension.
I need a clarification...
The process() function : I assume this is called to actually add the order to the DB, and you can pass it an order status id. Usually this is called after the payment gateway has completed and it passes the user back to a URL on the shopping cart. However i'm not sure with WorldPay its possible to pass a return URL in the payment submit form (although it might be possible to configure it in the admin panel - i wont know till i get a login).
If its not possible to config the return URL in the WorldPay panel, should I just call process in the callback() function so that when WorldPay posts a notification the order gets processed and confirmed in one swoop?
The only drawback I can see is that the user won't receive an order confirmation email until WorldPay calls callback().
Please correct any incorrect assumptions
Thanks
Mike
WorldPay module coming on really well, although my client hasn't received his account login so i'm kinda coding blind lol
I have written the controller for admin, the language and the template file. I'm just working on the catalog extension.
I need a clarification...
The process() function : I assume this is called to actually add the order to the DB, and you can pass it an order status id. Usually this is called after the payment gateway has completed and it passes the user back to a URL on the shopping cart. However i'm not sure with WorldPay its possible to pass a return URL in the payment submit form (although it might be possible to configure it in the admin panel - i wont know till i get a login).
If its not possible to config the return URL in the WorldPay panel, should I just call process in the callback() function so that when WorldPay posts a notification the order gets processed and confirmed in one swoop?
The only drawback I can see is that the user won't receive an order confirmation email until WorldPay calls callback().
Please correct any incorrect assumptions
Thanks
Mike
All assumptions are ok but...mikeytrw wrote: However i'm not sure with WorldPay its possible to pass a return URL in the payment submit form (although it might be possible to configure it in the admin panel - i wont know till i get a login).
If its not possible to config the return URL in the WorldPay panel, should I just call process in the callback() function so that when WorldPay posts a notification the order gets processed and confirmed in one swoop?
The only drawback I can see is that the user won't receive an order confirmation email until WorldPay calls callback().
After redirecting to worldpay, it should return you to some configurable location on the store website. This would be checkout_process which automatically calls the process function of your payment extension. That function should check the REQUEST for confirmation/rejection details. Success then $order->process otherwise redirect to checkout_failure.
Hi Guys,
Nearly finished
Can someone clarify which order_status i should be using for each part of the order process?
Pending , Processing , Cancelled , Shipped , Complete....
in PaymentWorldpay->process() should i be setting the order status to 'pending'? if so then what do i set it to in callback() once payment has been verified?
thanks
this contrib will be available for others as soon as ive tested with a live account.
Nearly finished
Can someone clarify which order_status i should be using for each part of the order process?
Pending , Processing , Cancelled , Shipped , Complete....
in PaymentWorldpay->process() should i be setting the order status to 'pending'? if so then what do i set it to in callback() once payment has been verified?
thanks
this contrib will be available for others as soon as ive tested with a live account.
Pending usually means "order is pending payment". Like waiting for a money order or check to clear
Processing usually means the payment was made and the order is being processed
Canceled is obvious
Shipped means it was shipped from you to the customer
Complete means you have confirmed delivery
Pending is probably good enough for what you want, however, some have opted to add a slightly less ambiguous title like "Unconfirmed Payment" which means that the order was "pre-processed" (to prevent losing it) and then when the callback is hit, it updates the order to "Processing" state.
To keep it simple, you could probably just use
PaymentWorldpay->process() ----> Pending
Callback ----> Processing
Processing usually means the payment was made and the order is being processed
Canceled is obvious
Shipped means it was shipped from you to the customer
Complete means you have confirmed delivery
Pending is probably good enough for what you want, however, some have opted to add a slightly less ambiguous title like "Unconfirmed Payment" which means that the order was "pre-processed" (to prevent losing it) and then when the callback is hit, it updates the order to "Processing" state.
To keep it simple, you could probably just use
PaymentWorldpay->process() ----> Pending
Callback ----> Processing
Hi Guys,
Just (finally) got a login for my clients worldpay account.
I'm a little bit stuck here...
It seems that I can only configure a single URL with worldpay that is where the shopper gets returned AND processes the payment notification (success of failure) there isnt a separate customer return and notification URL. which sucks.
At this point I can either...
- Do all the 'callback' processing in the process() function and tell worldpay to just send the user and payment post notification there.
- call $this->order->process() in the payment callback() function.
I've been trying the first method but having 2 problems. Firstly, i cant seem to get the order to appear in the 'order' table in the database, even if i call the $this->order->process() function, secondly if i set the return/ipn url to be http://myurl.com/store/index.php?contro ... ut_process Worldpay doesnt redirect and i get a callback failure.
Trying option 2 gives me the same frustration, i cant get the order to appear in the DB. so i can set its status to processing...
code attached.
thanks
Just (finally) got a login for my clients worldpay account.
I'm a little bit stuck here...
It seems that I can only configure a single URL with worldpay that is where the shopper gets returned AND processes the payment notification (success of failure) there isnt a separate customer return and notification URL. which sucks.
At this point I can either...
- Do all the 'callback' processing in the process() function and tell worldpay to just send the user and payment post notification there.
- call $this->order->process() in the payment callback() function.
I've been trying the first method but having 2 problems. Firstly, i cant seem to get the order to appear in the 'order' table in the database, even if i call the $this->order->process() function, secondly if i set the return/ipn url to be http://myurl.com/store/index.php?contro ... ut_process Worldpay doesnt redirect and i get a callback failure.
Trying option 2 gives me the same frustration, i cant get the order to appear in the DB. so i can set its status to processing...
code attached.
thanks
Little update
I was looking in the wrong table
anyway, the payment module works, but the customer gets passed back to the callback URL, also i dont seem to be able to properly redirect them to the checkout success Worldpay says im not aloud to do a redirect in this script. which is a total pain...I'll call them tomorrow and find out what the problem is.
Thanks
I was looking in the wrong table
anyway, the payment module works, but the customer gets passed back to the callback URL, also i dont seem to be able to properly redirect them to the checkout success Worldpay says im not aloud to do a redirect in this script. which is a total pain...I'll call them tomorrow and find out what the problem is.
Thanks
Thing is worldpay dont actually redirect the customer anywhere, their system displays the output from checkout_process 'callback' to the user and strictly forbids and redirect codes. I've tried some shenanigans with meta refresh but I just dont think that is the way forward.
from Worldpay's help pages:
All worldpay will allow me to do is upload an HTML page that they display to the shopper with a link back to the shopping cart.
If I put a link to http://mycart.com//store/index.php?cont ... ut_success will this omit any required processing? Is this the page I should link back to?
thanks,
from Worldpay's help pages:
Code: Select all
Q - Can I use callback to redirect shoppers back to my web site?
A - No. All methods of automatic redirection are prohibited.
If you wish to present a custom page to shoppers after a transaction is authorised or cancelled, please see What should I be aware of if I wish to display a customised page to shoppers as a response to a callback?.
If I put a link to http://mycart.com//store/index.php?cont ... ut_success will this omit any required processing? Is this the page I should link back to?
thanks,
You are going to have to revamp your thinking a bit. I am currently trying to get a new version of paypal out there for 0.7.9 final that instead of sending from checkout_confirm -> Paypal it sends back to itself for pre-processing. Then goes to a checkout_pending page that has the actual form call to the outside vendor.
You can read more about it here.
If this method is accepted, then you can use the design to create your module as well. This will pre-process the order and clear the cart before going to the payment processor
You can read more about it here.
If this method is accepted, then you can use the design to create your module as well. This will pre-process the order and clear the cart before going to the payment processor
Hi,
I've had a look at your new Paypal model, this looks good but is kinda out of the way for this contrib I think, as I want this to be something people can use with existing installations. Also it will require me to re-invent the wheel as I think there could be a simpler solution for me.
Currently I've set up a success HTML page that redirects the user to
http://persec.co.uk/store/index.php?con ... ut_process
On the hope that this will clear the cart and redirect the user to checkout_success, however the user is redirect but the cart doesnt seem to clear....
Any ideas why this could be?
The site is http://www.persec.co.uk, worldpay is configured in test mode so feel free to check it out.
test solo card number (from worlpay's docs) : 6334580500000000
thanks
I've had a look at your new Paypal model, this looks good but is kinda out of the way for this contrib I think, as I want this to be something people can use with existing installations. Also it will require me to re-invent the wheel as I think there could be a simpler solution for me.
Currently I've set up a success HTML page that redirects the user to
http://persec.co.uk/store/index.php?con ... ut_process
On the hope that this will clear the cart and redirect the user to checkout_success, however the user is redirect but the cart doesnt seem to clear....
Any ideas why this could be?
The site is http://www.persec.co.uk, worldpay is configured in test mode so feel free to check it out.
test solo card number (from worlpay's docs) : 6334580500000000
thanks
Who is online
Users browsing this forum: No registered users and 38 guests