QOSPAY
FrançaisAnglais
  • Aperçu
    • Création Compte
    • Connexion à votre Compte
    • Vérification des Transactions sur le Dashboard QosPay
    • Retrait depuis le Tableau de Bord QosPay
  • API Documentation
    • Introduction
    • API Teste informations
    • Sécurité
    • Paiement
    • Disbursements (Déposit)
    • Statut de la transaction
    • Callback
    • Liste de réponse
  • Checkout
    • Checkout
    • Carte
    • Status de la transaction
  • Plugins et bibliothèques
    • Wordpress Plugin
    • librairie
Propulsé par GitBook
Sur cette page
  1. Plugins et bibliothèques

librairie

Nos librairies permettent l'intégration de QOSPAY dans votre application web.

var settings = {
  "url": "https://api.qosic.net/QosicBridge/user/requestpayment",
  "method": "POST",
  "timeout": 0,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Basic UVNVU1I0MjU6S2pkVzM0NnNxVHI4ZE50S09VNVc="
  },
  "data": JSON.stringify({
    "msisdn": "22960000000",
    "amount": "100",
    "firstname": "Fabro",
    "lastname": "Nathi",
    "transref": "f13408",
    "clientid": "YourClientId"
  }),
};

$.ajax(settings).done(function (response) {
  console.log(response);
});
def api(request):
                context = {
                    'status':"info",
                    'text':"Not Set",
                    'code':"Neutral",
                }
                return render(request, 'index.html',context)
            def post(request):
                if request.method == "POST":
                    #keys
                    context = 'http://ip_link'
                    headers = {'content-type':'application/json'}
                    url = context + '/QosicBridge/user/requestpayment'
                    raw_url = url;
                    msisdn = request.POST['msisdn']
                    amount = request.POST['amount']
                    firstname = request.POST['firstname']
                    lastname = request.POST['lastname']
                    clientid = request.POST['clientid']
                    transref = (randint(1000000, 9999999))##integer
                    transref_str = str(transref) ##to string
                    server_pass = 'server_pass'
                    server_user = 'server_user'
                    url = context +"/QosicBridge/user/requestpayment?msisdn="+msisdn+"&amount="+amount+"&firstname="+firstname+"&lastname="+lastname+"&transref="+transref_str+"&ClientID="+clientid
                    data = json.dumps({
                        "msisdn": msisdn,
                        "amount": amount,
                        "firstname":firstname,
                        "lastname":lastname,
                        "transref" :transref,
                        "clientid": clientid,
                        })

                    # return HttpResponse(str(url)) ###--##TEST##--##

                    r = requests.post(url, auth=(server_user, server_pass), headers=headers, data=data,timeout=20)
                    # //load the json to a string
                    resp = json.loads(r.text)

                    # return HttpResponse(str(resp['transref']))
                    if r.status_code == 200:
                            data = r.json() ##response from server
                            # return HttpResponse(str(url))
                            # return HttpResponse(pprint(data))#console
                            # return HttpResponse(print(data)) #console
                            context = {
                                'status':"success",
                                'text':'Status is OKAY',
                                'code':r.status_code,
                                'responsecode':resp['responsecode'],
                                'responsemsg':resp['responsemsg'],
                                'transref':resp['transref'],
                                'comment':resp['comment']+', '+clientid,
                                'clientid':clientid,

                                'server_link':raw_url,
                                'server_user':server_user,
                                'server_pass':server_pass,
                            }
                            return render(request, 'index.html',context)
                    elif r.status_code == 202:
                            context = {
                                'status':"success",
                                'text':"

            Expires in <span id="time">05:00</span>

            Check Your Phone; Awaiting Confirmation

            <i class="fa fa-spinner fa-spin" style="font-size: 60px;"></i>",
                                'code':r.status_code,
                                'responsecode':resp['responsecode'],
                                'responsemsg':resp['responsemsg'],
                                'transref':resp['transref'],
                                'comment':resp['comment'],
                                'clientid':clientid,
                            }
                            return render(request, 'index.html',context)
                    elif r.status_code == 401:
                            context = {
                                'status':"danger",
                                'text':'Unauthorized',
                                'code':r.status_code,
                                'responsecode':resp['responsecode'],
                                'responsemsg':resp['responsemsg'],
                                'transref':resp['transref'],
                                'comment':resp['comment'],
                            }
                            return render(request, 'index.html',context)
                    else:
                            context = {
                                'status':"danger",
                                'text':'Failed',
                                'code':r.status_code,
                                'responsecode':resp['responsecode'],
                                'responsemsg':resp['responsemsg'],
                                'transref':resp['transref'],
                                'comment':resp['comment'],
                            }
                            # return JsonResponse({'error': 'Some error'}, status=400)
                            return render(request, 'index.html',context)
                else:
                            context = {
                                'status':"warning",
                                'text':'Invalid Method;',
                                'code':"-",
                                'responsecode':'-',
                                'responsemsg':'-',
                                'transref':'-',
                                'comment':'-',
                            }
                            return render(request, 'index.html',context)

PrécédentWordpress Plugin

Dernière mise à jour il y a 1 an

LogoGitHub - QOS-Integated-Center/sample-code-javascript-card-integrationGitHub
LogoGitHub - Tobi-De/qosic-sdk: An unofficial python sdk for the QosIc (https://www.qosic.com) platform.GitHub
LogoGitHub - QOS-Integated-Center/Qos-bridge-libraryGitHub