Encaissez en quelques lignes
1Vue d'ensemble
📦
📱
🔑
🌗
⚠️
2Installation
<body> <!-- ... --> <script src="https://cdn.quick-wallet.com/sdks/js/v1.0.0/index.min.js"></script> </body>
💡
Politique de sécurité de contenu
script-src https://cdn.quick-wallet.com connect-src https://api.quick-wallet.com font-src https://cdn.quick-wallet.com img-src https://docs.quick-wallet.com
3Bouton de paiement
Le conteneur
<div id="quickwallet-button-container"></div>
L'initialisation
const checkout = new QuickWalletSDK();
await checkout.initialize({
apiKey: "qw_live_votre_cle_publique",
amount: 15000,
currency: "XOF",
description: "Commande #A-1042",
onPaymentInited: (payment) => {
console.log("référence de la demande", payment.verificationHash);
},
onSuccess: (transaction) => {
window.location.href = "/merci?ref=" + transaction.reference;
},
onFailure: (transaction) => {
console.warn("paiement non abouti", transaction.status);
},
onError: (error) => {
console.error(error.type, error.message);
},
});
💡
4Initialisation automatique
<div
data-quickwallet-auto-init="true"
data-quickwallet-config='{
"apiKey": "qw_live_votre_cle_publique",
"amount": 15000,
"currency": "XOF",
"description": "Commande #A-1042",
"buttonText": "Payer maintenant",
"color": "#4c5aef",
"onSuccess": "maBoutique.onPaid",
"onFailure": "maBoutique.onFailed",
"onError": "maBoutique.onError"
}'
></div>
window.maBoutique = {
onPaid: (transaction) => console.log("payé", transaction.reference),
onFailed: (transaction) => console.warn("échec", transaction.status),
onError: (error) => console.error(error.message),
};
💡
5Configuration
| Option | Type | Requis | Description |
|---|---|---|---|
apiKey |
string |
||
amount |
number |
||
currency |
string |
||
description |
string |
||
onSuccess |
function |
||
onFailure |
function |
||
onError |
function |
||
onPaymentInited |
function |
||
onClose |
function |
||
buttonText |
string |
||
buttonContainer |
Element |
||
metadata |
string |
||
color |
string |
||
colors |
object |
||
theme |
string |
||
lang |
string |
||
closeOnSuccess |
boolean |
||
verbose |
boolean |
🔒
6Apparence
Isolation
Jetons de couleur
| Jeton | Clair | Sombre | Role |
|---|---|---|---|
background |
#ffffff |
#18181b |
|
surface |
#fafafa |
#212124 |
|
surfaceLight |
#f4f4f5 |
#27272a |
|
text |
#18181b |
#fafafa |
|
textSecondary |
#52525b |
#a1a1aa |
|
textTertiary |
#a1a1aa |
#71717a |
|
border |
#e4e4e7 |
#2e2e33 |
|
borderLight |
#f4f4f5 |
#3f3f46 |
|
overlay |
rgba(9, 9, 11, 0.55) |
rgba(0, 0, 0, 0.7) |
Couleurs semantiques
| Jeton | Valeur | Role |
|---|---|---|
primary |
#4c5aef |
|
success |
#16a34a |
|
error |
#ef4444 |
|
warning |
#f59e0b |
|
info |
#3b82f6 |
Exemple
const qw = new QuickWalletSDK();
await qw.initialize({
apiKey: "qw_live_votre_cle_publique",
amount: 15000,
currency: "XOF",
description: "Commande #A-1042",
colors: {
primary: "#0f766e",
light: {
background: "#fffdf7",
surface: "#f7f3e8",
border: "#e7dcc4",
},
dark: {
background: "#0b0f0e",
surface: "#141a19",
border: "#22302d",
},
},
onSuccess: (tx) => console.log(tx),
onFailure: (tx) => console.warn(tx),
onError: (err) => console.error(err),
});
Typographie
🎨
7Méthodes
| Signature | Description |
|---|---|
updateConfig(patch) |
|
getInfo() |
|
getTransactionStatus() |
|
setLanguage("fr" | "en") |
|
setTheme("light" | "dark") |
|
destroy() |
checkout.updateConfig({ amount: 22500, description: "Commande #A-1043" });
const status = await checkout.getTransactionStatus();
console.log(status.status, status.reference);
checkout.setLanguage("en");
checkout.destroy();
⚠️
8Flux de paiement
1
2
3
4
🔒
9API & endpoints
POST
/payins/session
x-api-key
POST
/payins/widget-init
x-qw-session
POST
/payins/widget-check
x-qw-session
🌐
En-têtes
| Header | Value |
|---|---|
x-api-key |
qw_live_… — /payins/session
|
x-qw-session |
token — widget-init,
widget-check
|
x-custom-lang |
fr | en |
Content-Type |
application/json |
Appel direct
const base = "https://api.quick-wallet.com/api/v1";
// 1. Une session, avec la clé publique.
const opened = await fetch(base + "/payins/session", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "qw_live_votre_cle_publique",
"x-custom-lang": "fr",
},
body: JSON.stringify({
amount: 15000,
currency: "XOF",
description: "Commande #A-1042",
}),
}).then((response) => response.json());
const session = opened.data.token;
// 2. Le paiement, avec le jeton de session. Le montant vient de la session.
const started = await fetch(base + "/payins/widget-init", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-qw-session": session,
},
body: JSON.stringify({ phoneCode: "+229", phoneNumber: "0161101180" }),
}).then((response) => response.json());
// 3. Le statut, sans corps.
const current = await fetch(base + "/payins/widget-check", {
method: "POST",
headers: { "x-qw-session": session },
}).then((response) => response.json());
// Après initialize(), le SDK gère le jeton lui-même.
const info = await checkout.apiRequest("/payins/widget-check", "POST");
10Erreurs
| Type | Quand |
|---|---|
INITIALIZATION_ERROR |
|
MERCHANT_DATA_LOAD_ERROR |
|
PAYMENT_INIT_ERROR |
|
TRANSACTION_STATUS_CHECK_ERROR |
|
POLLING_ERROR |
|
MODAL_ERROR |
11Démo
💬