Skip to main content

SaferPay integration for django-payments

Project description

django-payments-saferpay

PyPI - Version PyPI - Python Version

A Django Payments plugin that integrates Saferpay payment provider with Django Payments.

Features

  • Easy integration with Django Payments framework
  • Support for Saferpay payment processing
  • Sandbox mode for testing
  • Simple configuration

Installation

pip install django-payments-saferpay

Configuration

Basic Setup

Add the Saferpay payment variant to your Django settings:

PAYMENT_VARIANTS = {
    "saferpay": (
        "django_payments_saferpay.provider.SaferpayProvider",
        {
            "customer_id": "your-customer-id",
            "terminal_id": "your-terminal-id",
            "username": "your-username",
            "password": "your-password",
            "sandbox": True,  # Set to True for testing, False for production
        }
    )
}

Configuration Options

Option Description Required
customer_id Your Saferpay customer ID Yes
terminal_id Your terminal ID from Saferpay Yes
username The username for Saferpay API authentication Yes
password The password for Saferpay API authentication Yes
sandbox Boolean flag to enable or disable sandbox mode (default: True) No

Environment Variables

For security, it's recommended to store sensitive data in environment variables:

import os

PAYMENT_VARIANTS = {
    "saferpay": (
        "django_payments_saferpay.provider.SaferpayProvider",
        {
            "customer_id": os.environ.get("SAFERPAY_CUSTOMER_ID"),
            "terminal_id": os.environ.get("SAFERPAY_TERMINAL_ID"),
            "username": os.environ.get("SAFERPAY_API_USERNAME"),
            "password": os.environ.get("SAFERPAY_API_PASSWORD"),
            "sandbox": True,
        }
    )
}

Sandbox Testing Environment

The project includes a sandbox application that demonstrates a simple implementation of Django Payments with the SaferPay payment variant. You can use it to:

  • See a complete working implementation example
  • Test your SaferPay credentials
  • Experiment with different payment flows

Setting Up the Sandbox

  1. Navigate to the sandbox directory:

    cd sandbox
    
  2. Create an environment file (.envrc) with your Saferpay credentials:

    export PAYMENT_HOST=localhost:8000
    export SAFERPAY_CUSTOMER_ID=your-customer-id
    export SAFERPAY_TERMINAL_ID=your-terminal-id
    export SAFERPAY_API_PASSWORD=your-password
    export SAFERPAY_API_USERNAME=API_username_here
    
  3. Load the environment variables:

    source .envrc
    

    (Or if you have direnv installed, it will load automatically)

  4. Set up and run the sandbox server:

    uv venv                          # Create virtual environment
    source .venv/bin/activate        # Activate virtual environment
    uv pip install ..                # Install the package
    python manage.py migrate         # Set up the database
    python manage.py runserver       # Start the server
    
  5. Open your browser and navigate to:

    http://localhost:8000/create-payment/
    

Documentation

For more detailed information, refer to:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

django-payments-saferpay is distributed under the terms of the BSD 3-Clause license.

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_payments_saferpay-0.0.4.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_payments_saferpay-0.0.4-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file django_payments_saferpay-0.0.4.tar.gz.

File metadata

  • Download URL: django_payments_saferpay-0.0.4.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for django_payments_saferpay-0.0.4.tar.gz
Algorithm Hash digest
SHA256 40a83544a8f2f90f8f0b7467c6221b78c7f2cfa21da7182aa5b7abb68213f407
MD5 f33fb7db639a6d36cb464e47f09bf3a7
BLAKE2b-256 a94c5c33a9d4b6634f5acf6275c77382f32d840ef633beed306b5acfe775a870

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_payments_saferpay-0.0.4.tar.gz:

Publisher: test-and-release.yml on epfl-cede/django-payments-saferpay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_payments_saferpay-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for django_payments_saferpay-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 83c4ecc6995239d56ffe7834d6f82aa536ee6d201f2c9f139c4f77fc5434cc51
MD5 d67f65c5fb21a830d4225f4790d693c2
BLAKE2b-256 45c7df30f69f82bf853d26971ff8e0d06deb0205cdf5f26078170ec97978012a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_payments_saferpay-0.0.4-py3-none-any.whl:

Publisher: test-and-release.yml on epfl-cede/django-payments-saferpay

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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