Skip to main content

Flask-SimplePay

OTP SimplePay integration with Flask

Usage

Initialize the extension with Flask and Flask-SQLAlchemy instances.

from flask import Flask
from flask_simplepay import SimplePay
from flask_sqlalchemy import SQLAlchemy


app = Flask(__name__)
db = SQLAlchemy(app)
simple = SimplePay(app, db)
    

if __name__ == '__main__':
    app.run()

To start payment, a Transaction is needed. After adding the transaction and commiting the session, the /simple/start/<int:transaction_id> endpoint starts the payment procedure. When the payment process is finished, the /simple/back endpoint is called. To define the behaviour upon the callback, extend the TransactionMixin class and override the back() method. Return value should be anything a Flask route method would return.

from flask import render_template
from flask_simplepay import TransactionMixin


class Transaction(db.Model, TransactionMixin):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    
    def back(self):
        return render_template(self.result, transaction=self)

The Transaction model class should be provided at initialization as transaction_class argument.

Metadata

Release files for Flask-SimplePay 1.9

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

Source distribution (sdist)

Source distribution for Flask-SimplePay 1.9
File Size Uploaded Provenance
Flask-SimplePay-1.9.tar.gz 6.2 kB Without provenance Details

Release files / Flask-SimplePay-1.9.tar.gz

Download URL Flask-SimplePay-1.9.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6184ed8941b2a8bdb26b26f419e22d86c2bb2582318cc7a261639b593ae0bdd8
BLAKE2b-256 checksum
How to use checksums
d36b03b6b168c9fc27e09f5a72aa52041897d8e1d62dbcf041503fb2cf9c866e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.0

Security for Flask-SimplePay 1.9

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.

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