alipay for django
Project description
提供django下alipay直接支付接口
Quick start
Install:
pip install django_alipay2
Add “alipay” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'alipay', ]
[Optional] Include the alipay URLconf in your project urls.py like this:
url(r'^alipay/', include('alipay.urls')),
Migrate:
python manage.py migrate
Add config ‘ALIPAY’ to settings.py like this:
# account below is for sandbox ALIPAY = { 'pid': '2088101122136241', 'key': '760bdzec6y9goq7ctyx96ezkz78287de', 'seller_email': 'overseas_kgtest@163.com', 'gateway': 'https://openapi.alipaydev.com/gateway.do?', 'server_url': 'http://localhost:8000' # RSA specified 'rsa_public_raw_key': '', 'sign_type': 'RSA', } # you may add an 'api_provider' to support multiple seller ALIPAY = { 'api_provider': 'some_package.sub_package.get_alipay_alipay' # input:seller_email, output:AlipayAPI }
Create alipay redirect:
import uuid payment = AlipayPayment.objects.create( out_no=uuid.uuid4(), subject='充值', body='1年365元', amount_total=0.01, user=None, # 可以指定user seller_email='your_seller_email@domain.com', # reference_id='1' # 可选 ) return redirect('alipay_redirect', out_no=payment.out_no)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-alipay2-1.1.8.tar.gz
(18.8 kB
view details)
File details
Details for the file django-alipay2-1.1.8.tar.gz
.
File metadata
- Download URL: django-alipay2-1.1.8.tar.gz
- Upload date:
- Size: 18.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe6d65ad54be840b211faabf60bd0d98006d9bc7a6b58e19b21c115d01dc26b6 |
|
MD5 | 610e17be633896c81e164314798a78f5 |
|
BLAKE2b-256 | e13b0ee9bddd2261db6da9334ae5a06200b2216e5e51aea0c49d7c757fe3e5a9 |