pi-spi-sdk 0.1.1 → 0.1.2
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 +36 -8
- package/package.json +18 -15
package/README.md
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The Interoperable Platform for the Instant Payment System (π-SPI) is a regional payment infrastructure designed and operated by the Central Bank of West African States (BCEAO).
|
|
6
6
|
|
|
7
|
-
It enables instant fund transfers between different financial institutions across the region, including banks, electronic money issuers, microfinance institutions, and payment
|
|
8
|
-
|
|
7
|
+
It enables instant fund transfers between different financial institutions across the region, including banks, electronic money issuers, microfinance institutions, and payment service providers.
|
|
9
8
|
|
|
10
9
|
## Installation
|
|
11
10
|
|
|
@@ -16,13 +15,12 @@ npm install pi-spi-sdk
|
|
|
16
15
|
# or
|
|
17
16
|
yarn add pi-spi-sdk
|
|
18
17
|
```
|
|
19
|
-
π-SPI enables **cross-border transactions** within the West African Economic and Monetary Union (UEMOA), which spans eight countries: Benin, Burkina Faso, Côte d'Ivoire, Guinea-Bissau, Mali, Niger, Senegal, and Togo.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
π-SPI operates on a single currency, the XOF (West African CFA Franc), and processes payments in real-time with instant confirmation. It also enables **cross-border transactions** within the West African Economic and Monetary Union (UEMOA), which spans eight countries: Benin, Burkina Faso, Côte d'Ivoire, Guinea-Bissau, Mali, Niger, Senegal, and Togo.
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
Payments can flow between traditional bank accounts across UEMOA countries, from bank accounts to mobile money wallets like MTN, Orange Money, and Moov, from mobile wallets back to bank accounts, and even between mobile money wallets regardless of which provider each person uses.
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
To use this SDK in a production ready application, you need to be connected to a certified PI-SPI participant or PSP.
|
|
26
24
|
|
|
27
25
|
## Usage example
|
|
28
26
|
|
|
@@ -30,7 +28,7 @@ The infrastructure operates on a single currency, the XOF (West African CFA Fran
|
|
|
30
28
|
import { PiSpiSDK } from 'pi-spi-sdk';
|
|
31
29
|
|
|
32
30
|
const sdk = new PiSpiSDK({
|
|
33
|
-
baseUrl: 'https://sandbox.api.pi-bceao.
|
|
31
|
+
baseUrl: 'https://sandbox.api.pi-spi.bceao.int/piz/v1',
|
|
34
32
|
accessToken: 'your-oauth2-access-token',
|
|
35
33
|
});
|
|
36
34
|
|
|
@@ -48,7 +46,7 @@ const payment = await sdk.paiements.create({
|
|
|
48
46
|
|
|
49
47
|
## Features
|
|
50
48
|
|
|
51
|
-
This SDK provides full TypeScript support with types generated from the official OpenAPI specification, ensuring type safety throughout your integration. It includes secure authentication through OAuth2 and mTLS, comprehensive coverage of all SPI endpoints, and custom error classes with detailed messages for easier debugging. The codebase
|
|
49
|
+
This SDK provides full TypeScript support with types generated from the official OpenAPI specification, ensuring type safety throughout your integration. It includes secure authentication through OAuth2 and mTLS, comprehensive coverage of all SPI endpoints, and custom error classes with detailed messages for easier debugging. The codebase also includes developer-friendly utilities and constants to streamline your implementation.
|
|
52
50
|
|
|
53
51
|
## Utilities & Constants
|
|
54
52
|
|
|
@@ -162,6 +160,36 @@ await sdk.paiements.list({
|
|
|
162
160
|
});
|
|
163
161
|
```
|
|
164
162
|
|
|
163
|
+
#### QR Codes
|
|
164
|
+
|
|
165
|
+
Generate EMV-compliant QR codes directly from the SDK.
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
// Generate raw payload string
|
|
169
|
+
const payload = sdk.qr.payload({
|
|
170
|
+
alias: '3497a720-ab11-4973-9619-534e04f263a1',
|
|
171
|
+
countryCode: 'CI',
|
|
172
|
+
qrType: 'STATIC',
|
|
173
|
+
referenceLabel: 'MA_BOUTIQUE_01',
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Generate SVG with official PI-SPI logo
|
|
177
|
+
const svg = await sdk.qr.svg({
|
|
178
|
+
alias: '3497a720-ab11-4973-9619-534e04f263a1',
|
|
179
|
+
countryCode: 'CI',
|
|
180
|
+
qrType: 'DYNAMIC',
|
|
181
|
+
referenceLabel: 'TX-12345',
|
|
182
|
+
amount: 5000
|
|
183
|
+
}, { size: 300 });
|
|
184
|
+
|
|
185
|
+
// Validate external QR code content
|
|
186
|
+
const check = sdk.qr.validate(someQrString);
|
|
187
|
+
if (check.valid) {
|
|
188
|
+
console.log("Valid QR for:", check.data?.alias);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
165
193
|
#### Aliases
|
|
166
194
|
|
|
167
195
|
```typescript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-spi-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "TypeScript SDK for the π-SPI Business API. Built by lomi. for the West African fintech community",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,6 +18,13 @@
|
|
|
18
18
|
"LICENSE",
|
|
19
19
|
"CHANGELOG.md"
|
|
20
20
|
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc",
|
|
23
|
+
"dev": "tsc --watch",
|
|
24
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\" \"*.{json,md}\" \"scripts/**/*.{js,ts}\"",
|
|
25
|
+
"prepublish": "pnpm run generate && pnpm run build",
|
|
26
|
+
"generate": "node scripts/pre-generate.js && openapi --input ./openapi.json --output ./src/generated --client axios --useOptions && node scripts/post-generate.js"
|
|
27
|
+
},
|
|
21
28
|
"keywords": [
|
|
22
29
|
"pi-spi",
|
|
23
30
|
"spi",
|
|
@@ -60,22 +67,18 @@
|
|
|
60
67
|
"node": ">=18.0.0"
|
|
61
68
|
},
|
|
62
69
|
"dependencies": {
|
|
63
|
-
"axios": "^1.
|
|
64
|
-
"dotenv": "^16.
|
|
65
|
-
"form-data": "^4.0.
|
|
70
|
+
"axios": "^1.13.2",
|
|
71
|
+
"dotenv": "^16.6.1",
|
|
72
|
+
"form-data": "^4.0.5",
|
|
73
|
+
"qrcode": "^1.5.4"
|
|
66
74
|
},
|
|
67
75
|
"devDependencies": {
|
|
68
76
|
"@types/form-data": "^2.5.2",
|
|
69
|
-
"@types/node": "^20.
|
|
77
|
+
"@types/node": "^20.19.25",
|
|
78
|
+
"@types/qrcode": "^1.5.6",
|
|
70
79
|
"openapi-typescript-codegen": "^0.29.0",
|
|
71
|
-
"prettier": "^3.2
|
|
72
|
-
"typescript": "^5.
|
|
73
|
-
|
|
74
|
-
"scripts": {
|
|
75
|
-
"build": "tsc",
|
|
76
|
-
"dev": "tsc --watch",
|
|
77
|
-
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\" \"*.{json,md}\" \"scripts/**/*.{js,ts}\"",
|
|
78
|
-
"prepublish": "pnpm run generate && pnpm run build",
|
|
79
|
-
"generate": "node scripts/pre-generate.js && openapi --input ./openapi.json --output ./src/generated --client axios --useOptions && node scripts/post-generate.js"
|
|
80
|
+
"prettier": "^3.6.2",
|
|
81
|
+
"typescript": "^5.9.3",
|
|
82
|
+
"vitest": "^4.0.16"
|
|
80
83
|
}
|
|
81
|
-
}
|
|
84
|
+
}
|