Creating a custom Payment Gateway

776 views
Skip to first unread message

Daniel de Wit

unread,
Oct 31, 2013, 12:32:39 PM10/31/13
to django...@googlegroups.com
Hi everone,

I'm in the process of creating my first Oscar powered shop ( loving it so far ). But i'm afraid I need some help with communicating with my payment service provider ( Sisow.nl )

So far i've managed to create my own basic api for getting a list of available payment options which are shown on the PaymentDetailsView.
When a customer selects a valid payment option and clicks next, the payment preview page is shown as expected. The customer then clicks 'Place Order'.

At this point we arive at the handle_payment method of the custom extension of PaymentDetailsView class. My custom api communicates with the PSP and generates a url for redirection towards the payment portal. I've tested the generated url outside of Oscar and it works.

This is where I get stuck..

How do I:
  1. as the user clicks 'Place order' redirect the user to the url provided by my custom gateway api for the payment process to begin?
    https://www.sisow.nl/Sisow/iDeal/Simulator.aspx?merchantid={myid}&txid={transactionid}&sha1={sha1hash}
  2. after payment is handled, read the response url? Btw: I can provide my own response url
    if response signal is correct, i will add payment source and payment event accordingly. Otherwise I must notify the user about errors.
I tried looking at the oscar paypal, datacash apps. But can't wrap my brain around them.

If someone can tell me how to open the psp page with my url, do I return back to the PaymentDetailView and read a get parameter to verify the payment status from my PSP? I really have no clue where to begin.

Any help with this would be greatly appreciated!

PS: If I manage to get this working I will work on releasing this Sisow PSP app for others to use :) 
( this will allow for Dutch developers to start using Oscar since iDeal payments are the defacto standard in the Netherlands )

David Winterbottom

unread,
Oct 31, 2013, 4:34:21 PM10/31/13
to django-oscar
Oscar supports payment methods that require a redirect.  You need to raise a RedirectRequired exception from within the handle_payment method, configured with the appropriate URL.  The PaymentDetailsView will catch this and redirect the customer - see here:

With other gateways that use redirects, you need to specify or pre-configure success/error callback URLs - I presume that's the same here.  You should then provide your own view class that handles the callback and places the order.  This is a better solution than trying to re-use the existing PaymentDetailsView class.

The Oscar-Paypal library does this - see here:

You can subclass PaymentDetailsView if you want to show a preview screen, but if you don't then it might make sense to simply use the OrderPlacementMixin so your view can easily place an order.

I'm really interested in seeing an Oscar iDeal extension - I know there are other Dutch Oscar developers who are interested in using iDeal too.

Good luck.


--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-oscar/2e2974ee-b471-4545-9a01-fa9f216bb1f1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
David Winterbottom
Head of Programming

Tangent Labs
84-86 Great Portland Street
London W1W 7NR
England, UK

robmo...@gmail.com

unread,
Jan 9, 2014, 7:51:42 AM1/9/14
to django...@googlegroups.com
Hi Daniel,

we need to create an interface between django-oskar and sisow as well. Are you still working on this project?

Rob

Op donderdag 31 oktober 2013 17:32:39 UTC+1 schreef Daniel de Wit:
Reply all
Reply to author
Forward
0 new messages