Skip to main content

Django app for connecting to Iranian payment gateways.

Project description

What’s this?

You can use this app to create payments in your django project via Iranian gateways. (Right now only Zarinpal is available but the rest are coming soon)

How does it work?

You ask app for a new payment and it will give you a link on your own site that you can redirect user to it in order to have a payment.

http://img.majidonline.com/pic/321293/1.png http://img.majidonline.com/pic/321294/2.png http://img.majidonline.com/pic/321295/3.png

Installation

  1. pip install django-pardakht

  2. Add pardakht to your INSTALLED_APPS

  3. python manage.py migrate

  4. Add pardakht urls to your project’s urls.

from pardakht import urls as pardakht_urls
urlpatterns = [
    ...

    url(r'^<SOME_URL>/', include(pardakht_urls)),

    ...
]
  1. For any gateway you use, add GATEWAY_MERCHANT_ID in your project settings. For example if you are going to use zarinpal, You need to add ZARINPAL_MERCHANT_ID in your settings with value set to your zarinpal merchant ID.

Usage

Every payment you create takes 5 parameters.

  1. price: Price of the payment.

  2. description: Short description about this payment. Necessary for some gateways such as Zarinpal.

  3. return_function: A callable object (function) that will get called after payment is done with the payment object as it’s input. It’s optional and can be None.

  4. return_url: A url for user to come back where he left off on your site. It’s optional and can be None.

  5. login_required: Must be True if user who is paying should be authenticated. If you’re going to use this you have to set LOGIN_URL in project settings.

To create a payment:

from pardakht import handler
result = handler.create_payment(
    price,
    description,
    return_function,
    return_url,
    login_required
)

This will create a payment and returns a dict containing payment object and a link to pay it:

result['payment']   #  Created payment object
result['link']      #  Link for paying this payment that you should redirect your user to

Extra notes

This app handles all steps of payment including UI parts.

It uses semantic-ui so if you want to use it you need to serve app’s static files.

But of course you can override templates to use your own templates with your own UI design.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-pardakht-1.3.1.tar.gz (2.0 MB view details)

Uploaded Source

File details

Details for the file django-pardakht-1.3.1.tar.gz.

File metadata

File hashes

Hashes for django-pardakht-1.3.1.tar.gz
Algorithm Hash digest
SHA256 24a50d6767ca1f4a5547df23b95e46b409f26830db1893868fca558411d0dcf4
MD5 004bbd147460e7cd5f43f293aa9e5ca1
BLAKE2b-256 7eec9466df83f3bd507cf7b3adde32cf16746fec6d167621ced5086b5d5e8353

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page