التداول

#23
by Rayan545454 - opened

from flask import Flask, request, jsonify
import requests

app = Flask(name)

@app .route('/create_payment', methods=['POST'])
def create_payment():
data = request.json
amount = data.get('amount')

headers = {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/x-www-form-urlencoded'
}

payload = {
    'entityId': 'YOUR_ENTITY_ID',
    'amount': amount,
    'currency': 'SAR',
    'paymentType': 'DB',
    'merchantTransactionId': 'txn_' + str(amount),
}

response = requests.post('https://test.oppwa.com/v1/checkouts', data=payload, headers=headers)
return jsonify(response.json())

if name == 'main':
app.run(debug=True)

Sign up or log in to comment