@paywallex/node 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,6 +39,22 @@ const session = await paywallex.checkoutSessions.create({
|
|
|
39
39
|
|
|
40
40
|
Les montants sont en XOF entiers : `2500` veut dire 2 500 F.
|
|
41
41
|
|
|
42
|
+
### Paiements partagés (plateformes)
|
|
43
|
+
|
|
44
|
+
Indiquez la part de chaque vendeur par son @identifiant : elle part sur son solde dès que l'argent de la vente est disponible chez vous. Vous gardez le reste, frais Paywallex déduits.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
const session = await paywallex.checkoutSessions.create({
|
|
48
|
+
currency: "XOF",
|
|
49
|
+
amount: 20000,
|
|
50
|
+
splits: [
|
|
51
|
+
{ destination: "@chezpapa", amount: 15000, description: "Commande 1042" },
|
|
52
|
+
{ destination: "@livraison-rapide", amount: 2000 },
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
// session.splits[0].status : "pending", puis "paid" (événement payment_split.paid)
|
|
56
|
+
```
|
|
57
|
+
|
|
42
58
|
## Vérifier un webhook
|
|
43
59
|
|
|
44
60
|
Vérifiez la signature avant de traiter un événement. Le SDK compare en temps constant et refuse un horodatage de plus de 5 minutes.
|
|
@@ -87,7 +103,7 @@ Le SDK réessaie 2 fois en cas de coupure réseau, de `429` ou d'erreur `5xx`, e
|
|
|
87
103
|
Pour rejouer vous-même une requête sans risque, donnez votre propre clé :
|
|
88
104
|
|
|
89
105
|
```ts
|
|
90
|
-
await paywallex.refunds.create({ payment: "…" }, { idempotencyKey:
|
|
106
|
+
await paywallex.refunds.create({ payment: "…" }, { idempotencyKey: `remboursement-${order.id}` });
|
|
91
107
|
```
|
|
92
108
|
|
|
93
109
|
## Ce que couvre le SDK
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.1.0";
|
|
2
2
|
/** Erreur de l'API : testez `code` (stable), jamais le message. */
|
|
3
3
|
export declare class PaywallexError extends Error {
|
|
4
4
|
readonly status: number;
|
|
@@ -42,6 +42,24 @@ export type LineItem = {
|
|
|
42
42
|
unit_amount: number;
|
|
43
43
|
quantity?: number;
|
|
44
44
|
};
|
|
45
|
+
/** DV7 : part d'un vendeur (paiements partagés). La plateforme garde le reste, frais Paywallex déduits. */
|
|
46
|
+
export type SplitInput = {
|
|
47
|
+
destination: string;
|
|
48
|
+
amount: number;
|
|
49
|
+
description?: string;
|
|
50
|
+
};
|
|
51
|
+
export type PaymentSplit = Obj & {
|
|
52
|
+
destination: string;
|
|
53
|
+
destination_name: string | null;
|
|
54
|
+
amount: number;
|
|
55
|
+
currency: string;
|
|
56
|
+
description: string | null;
|
|
57
|
+
status: "pending" | "paid" | "failed" | "canceled";
|
|
58
|
+
amount_paid: number;
|
|
59
|
+
amount_reversed: number;
|
|
60
|
+
failure_reason: string | null;
|
|
61
|
+
paid_at: number | null;
|
|
62
|
+
};
|
|
45
63
|
export type CheckoutSessionCreate = {
|
|
46
64
|
currency: "XOF";
|
|
47
65
|
amount?: number;
|
|
@@ -54,6 +72,7 @@ export type CheckoutSessionCreate = {
|
|
|
54
72
|
cancel_url?: string;
|
|
55
73
|
expires_at?: number;
|
|
56
74
|
payment_methods?: string[];
|
|
75
|
+
splits?: SplitInput[];
|
|
57
76
|
[k: string]: unknown;
|
|
58
77
|
};
|
|
59
78
|
export type CheckoutSession = Obj & {
|
|
@@ -62,8 +81,10 @@ export type CheckoutSession = Obj & {
|
|
|
62
81
|
amount: number;
|
|
63
82
|
currency: string;
|
|
64
83
|
payment_id: string | null;
|
|
84
|
+
splits?: PaymentSplit[];
|
|
65
85
|
};
|
|
66
86
|
export type Payment = Obj & {
|
|
87
|
+
splits?: PaymentSplit[];
|
|
67
88
|
amount: number;
|
|
68
89
|
amount_charged: number;
|
|
69
90
|
fee: number;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Côté serveur uniquement : ne mettez jamais une clé secrète pwx_sk_… dans un navigateur ou une app mobile.
|
|
3
3
|
// Référence : https://api.paywallex.app/api/developer/openapi-v1.json. Signé : Superagent (DV3, 24 oct. 2026).
|
|
4
4
|
import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
5
|
-
export const VERSION = "1.
|
|
5
|
+
export const VERSION = "1.1.0";
|
|
6
6
|
/** Erreur de l'API : testez `code` (stable), jamais le message. */
|
|
7
7
|
export class PaywallexError extends Error {
|
|
8
8
|
status;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paywallex/node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "SDK serveur officiel de l'API Paywallex /v1 : sessions de paiement Mobile Money, remboursements, litiges, abonnements, webhooks signés.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|