Skip to main content

alipay for django

Project description

提供django下alipay直接支付接口

Quick start

  1. Install:

    pip install django_alipay2
    
  2. Add “alipay” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        'alipay',
    ]
    
  3. [Optional] Include the alipay URLconf in your project urls.py like this:

    url(r'^alipay/', include('alipay.urls')),
    
  4. Migrate:

    python manage.py migrate
    
  5. Add config ‘ALIPAY’ to settings.py like this:

    ALIPAY = {
        'sandbox': True,  # use sandbox client if True
        'pid': 'real alipay pid',
        'key': 'real alipay key',
        'seller': 'your_seller_email@domain.com',
        'gateway': 'https://mapi.alipay.com/gateway.do?',
        'SERVER_URL': 'http://my.server.com',  # for alipay return and notify
    }
    
  6. Create alipay redirect:

    import uuid
    payment = AlipayPayment.objects.create(
        out_no=uuid.uuid4(),
        subject='充值',
        body='1年365元',
        amount_total=0.01,
        user=None, # 可以指定user
        # reference_id='1' # 可选
    )
    return redirect('alipay_redirect', out_no=payment.out_no)
    

Project details


Release history Release notifications

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

History Node

0.10.2

History Node

0.10.1

History Node

0.10.0

History Node

0.9.5

History Node

0.9.4

History Node

0.9.3

History Node

0.9.2

History Node

0.9.1

This version
History Node

0.9.0

History Node

0.8.1

History Node

0.8.0

History Node

0.7.0

History Node

0.6.0

History Node

0.5.0

History Node

0.4.0

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-alipay2-0.9.0.tar.gz (9.6 kB) Copy SHA256 hash SHA256 Source None Sep 14, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page