API - SDK JS

Modifié le  Lun, 20 Oct. à 5:59 H

Use the direct link, you can load QiotaPay.js directly. Once loaded, qiotapay will be available on your website.
Adding the <script> tag loads Qiota’s JavaScript file.You may include this either within your <head> tag or inside the <body> part of your HTML, before the end of the page.
...
<script src= "https://[beta|static].qiota.com/assets/getQiotaPay.js" ></script>
...

Staging URL: https://beta.qiota.com/assets/getQiotaPay.js

Production URL : https://static.qiota.com/assets/getQiotaPay.js 


            
                                                            

The <div> qiota tag container                                                        

The getQiotaPay.js file allows you to render a QiotaPay widget on the client side.
 Configure the container and form where the QiotaPay Widget will add the payment method nonce. Make sure to replace TOKEN CLIENT with your generated client token.


...
<div class= "qiota" >   </div>
...
                                                  

The widget will appear exactly where this <div> tag is included on your page. When the getQiotaPay.js file is loaded, this <div> tag will get populated.
 You should integrate this script before the end body tag.

                       

Create a customer and call widget 

Once get the authorization you need to create a new customer with all values required. You can see here all values required            
var q_token = "09090909";               // required (Qiota client token)
var q_typepay = "CB";                   // required
var q_modepay = 0; // 0=subscription    // required 
var q_urlcallback = "your.domaine.com/qiota/callback";  // required 

var q_customer =  {
    person: {
        title: "mr",                    // required
        name: "Anthony",                // required
        lastname: "LeGrand",            // required
        birthdate : "19800101",         // required
        email: "anthony@thebest.com",   // required
        personAddress: {
            recipientName: 'Jean Dupont',       // required
            line1: '5 rue de la Paix',          // required
            line2: '4eme etage porte droite',   // required
            city: 'Paris',                      // required
            country: 'France',                  // required
            postalCode: '75001',                // required
            phone: '0612345678'                 // required
        },
        metaData:{
            shippingAddress: {
                recipientName: 'Dominique Dupont',
                recipientEmail: 'dominique@dupont.com',
                line1: '21 avenue Gambetta',
                line2: '',
                city: 'Lyon',
                country: 'France',
                postalCode: '69001',
                phone: '0612345678'
            }
        }
    },
};

var q_order = {
    product: {
        partner: q_token,       // required (Qiota client token)
        editor: "687",          // required
        company: "1",           // required
        reference_id: "11111",  // required
        codetarif: "QIOTA",     // required
        description: "Abonnement magazine order : QIOTA",   // required
        amount: 1599,           // required
        category: 6
    }
};

// Create a customer
QiotaPay.createCustomer(q_token, q_customer, function(response) {
    // If there was a problem creating the customer return with error message
    // This could happen if there is a network error or if the authorization is invalid.   
    if(!response.valid){ 
        console.log(response.responseText)
        return;
    }
    // Set up the ID user created.
    const q_idclient = response.user 
    // The QiotaPay widget will be rendered in an html element : <div class="qiota"></div>
    QiotaPay.render(q_token, q_typepay, q_modepay, q_idclient, q_order, q_urlcallback); 
});

                                                      

The qiota div will be populated for login of the user. After login success, the Qiota system checks whether the article exists and whether the access right is still valid, and sends a parameter on the UrlCallBack by the Get method. 



                                               
Response                                                   

Once the QiotaPay complete the process, the system sends on  URLCALLBACK  the informations about Status process : success or error, ID user created, ID transaction created.
With this informations you can notify by email a user that he has been successfully charge.



  • status : 
    • 1 -> success
    • 0 -> error
  • uid : Qiota user ID, usually encoded in Base64
  • tid : Unique transaction ID 
   

Update credit card

For the update of the bank card it is not necessary to create an order.

Once the div qiota has been integrated and the response returned all you have to do is call the QiotaPay.render function with the parameter "updated" set to true as follows 
var q_token = "09090909";               // required (Qiota client token)
var q_typepay = "CB";                   // required
var q_modepay = 0; // 0=subscription    // required 
var q_urlcallback = "your.domaine.com/qiota/callback";  // required 

var q_idclient = '987456'; // Set the Contact ID mahalo  from SSO user created.
var q_customer = {
    person: {
        email: 'anthony@thebest.com',
        idabm: q_idclient
    }
};

QiotaPay.createCustomer(q_token, q_customer, function(response) {
    QiotaPay.render(q_token, q_typepay, q_modepay, q_idclient, null, q_url_callback, {updated: true}); 
});

                                                   

        
                                    
        

    

Cet article a-t-il été utile ?

C'est super !

Merci pour votre commentaire

Désolé ! Nous n'avons pas pu vous être utile

Merci pour votre commentaire

Dites-nous comment nous pouvons améliorer cet article !

Sélectionner au moins l'une des raisons
La vérification CAPTCHA est requise.

Commentaires envoyés

Nous apprécions vos efforts et nous allons corriger l'article