---
description: Our libraries allow the integration of QOSPAY into your web application.
---

# Libraries



{% tabs %}
{% tab title="JavaScript" %}
```javascript
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);
});
```
{% endtab %}

{% tab title="Django" %}
```python
def api(request):
                context = {
                    'status':&amp;quot;info&amp;quot;,
                    'text':&amp;quot;Not Set&amp;quot;,
                    'code':&amp;quot;Neutral&amp;quot;,
                }
                return render(request, 'index.html',context)
            def post(request):
                if request.method == &amp;amp;amp;quot;POST&amp;amp;amp;quot;:
                    #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 +&amp;amp;amp;quot;/QosicBridge/user/requestpayment?msisdn=&amp;amp;amp;quot;+msisdn+&amp;amp;amp;quot;&amp;amp;amp;amp;amount=&amp;amp;amp;quot;+amount+&amp;amp;amp;quot;&amp;amp;amp;amp;firstname=&amp;amp;amp;quot;+firstname+&amp;amp;amp;quot;&amp;amp;amp;amp;lastname=&amp;amp;amp;quot;+lastname+&amp;amp;amp;quot;&amp;amp;amp;amp;transref=&amp;amp;amp;quot;+transref_str+&amp;amp;amp;quot;&amp;amp;amp;amp;ClientID=&amp;amp;amp;quot;+clientid
                    data = json.dumps({
                        &amp;amp;amp;quot;msisdn&amp;amp;amp;quot;: msisdn,
                        &amp;amp;amp;quot;amount&amp;amp;amp;quot;: amount,
                        &amp;amp;amp;quot;firstname&amp;amp;amp;quot;:firstname,
                        &amp;amp;amp;quot;lastname&amp;amp;amp;quot;:lastname,
                        &amp;amp;amp;quot;transref&amp;amp;amp;quot; :transref,
                        &amp;amp;amp;quot;clientid&amp;amp;amp;quot;: 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':&amp;amp;amp;quot;success&amp;amp;amp;quot;,
                                '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':&amp;amp;amp;quot;success&amp;amp;amp;quot;,
                                'text':&amp;amp;amp;quot;

            Expires in &amp;amp;amp;lt;span id=&amp;amp;amp;quot;time&amp;amp;amp;quot;&amp;amp;amp;gt;05:00&amp;amp;amp;lt;/span&amp;amp;amp;gt;

            Check Your Phone; Awaiting Confirmation

            &amp;amp;amp;lt;i class=&amp;amp;amp;quot;fa fa-spinner fa-spin&amp;amp;amp;quot; style=&amp;amp;amp;quot;font-size: 60px;&amp;amp;amp;quot;&amp;amp;amp;gt;&amp;amp;amp;lt;/i&amp;amp;amp;gt;&amp;amp;amp;quot;,
                                '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':&amp;amp;amp;quot;danger&amp;amp;amp;quot;,
                                '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':&amp;amp;amp;quot;danger&amp;amp;amp;quot;,
                                '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':&amp;amp;amp;quot;warning&amp;amp;amp;quot;,
                                'text':'Invalid Method;',
                                'code':&amp;amp;amp;quot;-&amp;amp;amp;quot;,
                                'responsecode':'-',
                                'responsemsg':'-',
                                'transref':'-',
                                'comment':'-',
                            }
                            return render(request, 'index.html',context)
```
{% endtab %}

{% tab title="Laravel" %}
{% embed url="https://github.com/QOS-Integated-Center/Qos-bridge-library" %}
{% endtab %}

{% tab title="Python Sdk Community" %}
{% embed url="https://github.com/Tobi-De/qosic-sdk" %}
{% endtab %}

{% tab title="CARD" %}
{% embed url="https://github.com/QOS-Integated-Center/sample-code-javascript-card-integration" %}
{% endtab %}
{% endtabs %}
