Skip to main content

django-alipay2

提供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:

    # 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
    }
  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
        seller_email='your_seller_email@domain.com',
        # reference_id='1' # 可选
    )
    return redirect('alipay_redirect', out_no=payment.out_no)

Metadata

Release files for django-alipay2 1.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-alipay2 1.1.8
File Size Uploaded Provenance Actions
django-alipay2-1.1.8.tar.gz 18.8 kB Without provenance Details for django-alipay2-1.1.8.tar.gz

Release files / django-alipay2-1.1.8.tar.gz

Download URL django-alipay2-1.1.8.tar.gz
Size 18.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fe6d65ad54be840b211faabf60bd0d98006d9bc7a6b58e19b21c115d01dc26b6
BLAKE2b-256 checksum
How to use checksums
e13b0ee9bddd2261db6da9334ae5a06200b2216e5e51aea0c49d7c757fe3e5a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.16

Security for django-alipay2 1.1.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.8 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page