> For the complete documentation index, see [llms.txt](https://qosic.gitbook.io/qospay-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://qosic.gitbook.io/qospay-eng/plugins-and-libraries/libraries.md).

# 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 %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://qosic.gitbook.io/qospay-eng/plugins-and-libraries/libraries.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
