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
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
flask_midtrans-0.0.1a0.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for flask_midtrans-0.0.1a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 919dec57ed7bc26a3e524d282c07bcd1fcd063e73818ff889bc0f7093cb01ff5 |
|
MD5 | 2c43cac5812ad64d248793479209c8e9 |
|
BLAKE2b-256 | 5014a4307a446784f4b3df86992b4aba26979ee25b1c106c66dbfab7fc85ecc5 |