Skip to main content

flask_midtrans is a package for integrate midtrans to flask framework

Project description

Flask Midtrans

How to use:

from flask_midtrans import Midtrans
from flask import Flask

# set environments
app = Flask(__name__)
app.config['MIDTRANS_IS_PRODUCTION'] = False
app.config['MIDTRANS_SERVER_KEY'] = 'SB-Mid-server-fRTQ4YyV5mVXB'
app.config['MIDTRANS_CLIENT_KEY'] = 'SB-Mid-client-hdv0voYgqK'

# instance
midtrans = Midtrans(app)

@app.route('/')
def hello_world():
    param = {
        "transaction_details": {
            "order_id": "test-transaction-123",
            "gross_amount": 200000
        }, "credit_card": {
            "secure": True
        }
    }

    # midtrans.snap or midtrans.core
    # https://github.com/Midtrans/midtrans-python-client
    response = midtrans.snap.create_transaction(param)

    # >> response
    #  {'token': 'thistoken', 'redirect_url': 'http://midtrans..'}
    return response['token']

Contributes:

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

flask_midtrans-0.0.1a0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

flask_midtrans-0.0.1a0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file flask_midtrans-0.0.1a0.tar.gz.

File metadata

  • Download URL: flask_midtrans-0.0.1a0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5

File hashes

Hashes for flask_midtrans-0.0.1a0.tar.gz
Algorithm Hash digest
SHA256 097f968f3634958ac800682d726d3363b8cba43d92af334b0f4e9bfdb600b032
MD5 6c8b3d8fee36513f37f7a886be081a8b
BLAKE2b-256 2e28cb6f2b4f11bdf81d73d0a18feab937976e5baa303083d3c08eb9a493f3ae

See more details on using hashes here.

File details

Details for the file flask_midtrans-0.0.1a0-py3-none-any.whl.

File metadata

  • Download URL: flask_midtrans-0.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.5

File hashes

Hashes for flask_midtrans-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 919dec57ed7bc26a3e524d282c07bcd1fcd063e73818ff889bc0f7093cb01ff5
MD5 2c43cac5812ad64d248793479209c8e9
BLAKE2b-256 5014a4307a446784f4b3df86992b4aba26979ee25b1c106c66dbfab7fc85ecc5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page