@wikha/sdk 1.1.12 → 1.1.13
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 +11 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,12 +5,11 @@
|
|
|
5
5
|
Import the `WikhaSDK` class and initialize it with your API key, merchant ID, and public key:
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
|
-
import WikhaSDK from 'wikha
|
|
8
|
+
import { WikhaSDK } from '@wikha/sdk';
|
|
9
9
|
|
|
10
10
|
const sdk = new WikhaSDK(
|
|
11
11
|
'YOUR_API_KEY',
|
|
12
|
-
'YOUR_MERCHANT_ID'
|
|
13
|
-
'YOUR_PUBLIC_KEY'
|
|
12
|
+
'YOUR_MERCHANT_ID'
|
|
14
13
|
);
|
|
15
14
|
|
|
16
15
|
// You can also access static enums for convenience
|
|
@@ -24,12 +23,11 @@ You'll need to provide a WikhaPayload object with the necessary payment details.
|
|
|
24
23
|
|
|
25
24
|
```TypeScript
|
|
26
25
|
|
|
27
|
-
import WikhaSDK from 'wikha
|
|
26
|
+
import { WikhaSDK } from '@wikha/sdk';
|
|
28
27
|
|
|
29
28
|
const sdk = new WikhaSDK(
|
|
30
29
|
'YOUR_API_KEY',
|
|
31
|
-
'YOUR_MERCHANT_ID'
|
|
32
|
-
'YOUR_PUBLIC_KEY'
|
|
30
|
+
'YOUR_MERCHANT_ID'
|
|
33
31
|
);
|
|
34
32
|
|
|
35
33
|
async function initiatePayment() {
|
|
@@ -60,13 +58,12 @@ initiatePayment();
|
|
|
60
58
|
# Query transaction status
|
|
61
59
|
|
|
62
60
|
```typescript
|
|
63
|
-
import WikhaSDK from 'wikha
|
|
61
|
+
import { WikhaSDK } from '@wikha/sdk';
|
|
64
62
|
|
|
65
|
-
// Initialize your SDK instance (API Key
|
|
63
|
+
// Initialize your SDK instance (API Key and Merchant ID)
|
|
66
64
|
const sdk = new WikhaSDK(
|
|
67
65
|
'YOUR_API_KEY',
|
|
68
|
-
'YOUR_MERCHANT_ID'
|
|
69
|
-
'YOUR_PUBLIC_KEY'
|
|
66
|
+
'YOUR_MERCHANT_ID'
|
|
70
67
|
);
|
|
71
68
|
|
|
72
69
|
async function checkTransactionStatus(transactionId: string) {
|
|
@@ -96,7 +93,7 @@ checkTransactionStatus('YOUR_TRANSACTION_ID');
|
|
|
96
93
|
#Using Static Enums
|
|
97
94
|
|
|
98
95
|
```typescript
|
|
99
|
-
import WikhaSDK from 'wikha
|
|
96
|
+
import { WikhaSDK, PaymentEventPayload, PaymentType, PaymentStatus, PaymentProviderType, Environment } from '@wikha/sdk';
|
|
100
97
|
|
|
101
98
|
function handlePaymentEvent(event: WikhaSDK.PaymentEventPayload) {
|
|
102
99
|
console.log('Payment Event Received:', event);
|
|
@@ -257,16 +254,15 @@ console.log('Sandbox Environment Value:', WikhaSDK.Environment.sandbox);
|
|
|
257
254
|
</button>
|
|
258
255
|
</div>
|
|
259
256
|
|
|
260
|
-
<script src="https://unpkg.com/
|
|
257
|
+
<script src="https://unpkg.com/@wikha/sdk@latest/dist/wikha-sdk.umd.js"></script>
|
|
261
258
|
<script src="https://code.getmdl.io/1.3.0/material.min.js"></script>
|
|
262
259
|
<script>
|
|
263
260
|
let sdk;
|
|
264
261
|
let transactionId;
|
|
265
262
|
|
|
266
263
|
async function initiatePayment() {
|
|
267
|
-
const apiKey = '
|
|
264
|
+
const apiKey = 'API_KEY'; // Replace with your actual API key
|
|
268
265
|
const merchantId = 'MERCHANT_ID'; // Replace with your actual merchant ID
|
|
269
|
-
const publicKey = 'PUBLIC_KEY'; // Replace with your actual public key
|
|
270
266
|
|
|
271
267
|
const provider = document.getElementById('provider').value;
|
|
272
268
|
const payer_phone = document.getElementById('payer_phone').value;
|
|
@@ -286,7 +282,7 @@ console.log('Sandbox Environment Value:', WikhaSDK.Environment.sandbox);
|
|
|
286
282
|
// You can add optional fields like notify_url and return_url here
|
|
287
283
|
};
|
|
288
284
|
|
|
289
|
-
sdk = new wikha.WikhaSDK(apiKey, merchantId
|
|
285
|
+
sdk = new wikha.WikhaSDK(apiKey, merchantId);
|
|
290
286
|
const responseDiv = document.getElementById('paymentResponse');
|
|
291
287
|
const errorDiv = document.getElementById('paymentError');
|
|
292
288
|
const checkTransactionButton = document.getElementById('checkTransactionButton');
|