@voxepay/checkout 0.5.4 → 0.5.5
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/dist/api/client.d.ts +2 -2
- package/dist/index.cjs.js +5 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/voxepay-checkout.min.js +1 -1
- package/dist/voxepay-checkout.min.js.map +1 -1
- package/dist/voxepay.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/client.ts +4 -4
- package/src/components/modal.ts +1 -1
- package/src/types.ts +3 -3
- package/src/voxepay.ts +2 -7
package/src/api/client.ts
CHANGED
|
@@ -103,11 +103,11 @@ export interface ResendOTPRequest {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
export class VoxePayApiClient {
|
|
106
|
-
private apiKey
|
|
106
|
+
private apiKey?: string;
|
|
107
107
|
private bearerToken?: string;
|
|
108
108
|
private baseUrl: string;
|
|
109
109
|
|
|
110
|
-
constructor(apiKey
|
|
110
|
+
constructor(apiKey?: string, baseUrl?: string, bearerToken?: string) {
|
|
111
111
|
this.apiKey = apiKey;
|
|
112
112
|
this.bearerToken = bearerToken;
|
|
113
113
|
this.baseUrl = baseUrl || DEFAULT_BASE_URL;
|
|
@@ -128,7 +128,7 @@ export class VoxePayApiClient {
|
|
|
128
128
|
'Accept': 'application/json',
|
|
129
129
|
};
|
|
130
130
|
|
|
131
|
-
if (includeApiKey) {
|
|
131
|
+
if (includeApiKey && this.apiKey) {
|
|
132
132
|
headers['X-API-Key'] = this.apiKey;
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -161,7 +161,7 @@ export class VoxePayApiClient {
|
|
|
161
161
|
|
|
162
162
|
if (authType === 'bearer' && this.bearerToken) {
|
|
163
163
|
headers['Authorization'] = `Bearer ${this.bearerToken}`;
|
|
164
|
-
} else if (authType === 'api-key') {
|
|
164
|
+
} else if (authType === 'api-key' && this.apiKey) {
|
|
165
165
|
headers['X-API-Key'] = this.apiKey;
|
|
166
166
|
}
|
|
167
167
|
// authType === 'none' → no auth header added
|
package/src/components/modal.ts
CHANGED
|
@@ -825,7 +825,7 @@ export class VoxePayModal {
|
|
|
825
825
|
expiresAt: va.expires_at,
|
|
826
826
|
};
|
|
827
827
|
} else {
|
|
828
|
-
throw { code: 'SDK_ERROR', message: 'SDK not properly initialized. Missing
|
|
828
|
+
throw { code: 'SDK_ERROR', message: 'SDK not properly initialized. Missing required organizationId.' };
|
|
829
829
|
}
|
|
830
830
|
|
|
831
831
|
this.state.bankTransferDetails = details;
|
package/src/types.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Configuration for initializing VoxePay
|
|
7
7
|
*/
|
|
8
8
|
export interface VoxePayConfig {
|
|
9
|
-
/**
|
|
10
|
-
apiKey
|
|
9
|
+
/** Optional API key (not required for public transfer/status flow) */
|
|
10
|
+
apiKey?: string;
|
|
11
11
|
/** Your VoxePay organization ID */
|
|
12
12
|
organizationId: string;
|
|
13
13
|
/** API base URL (defaults to https://devpay.voxepay.app) */
|
|
@@ -94,7 +94,7 @@ export interface CheckoutOptions {
|
|
|
94
94
|
onBankTransferRequested?: () => Promise<BankTransferDetails>;
|
|
95
95
|
/** @internal SDK config passed from VoxePaySDK to modal */
|
|
96
96
|
_sdkConfig?: {
|
|
97
|
-
apiKey
|
|
97
|
+
apiKey?: string;
|
|
98
98
|
organizationId: string;
|
|
99
99
|
baseUrl?: string;
|
|
100
100
|
paymentLinkSlug?: string;
|
package/src/voxepay.ts
CHANGED
|
@@ -29,14 +29,9 @@ class VoxePaySDK {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Initialize VoxePay with your configuration
|
|
32
|
-
* @param config - Configuration object with
|
|
32
|
+
* @param config - Configuration object with required organizationId and optional settings
|
|
33
33
|
*/
|
|
34
34
|
init(config: VoxePayConfig): void {
|
|
35
|
-
if (!config.apiKey) {
|
|
36
|
-
console.error('[VoxePay] API key is required. Get your API key from the VoxePay dashboard: Settings > API Keys');
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
35
|
if (!config.organizationId) {
|
|
41
36
|
console.error('[VoxePay] Organization ID is required. Find it in your VoxePay dashboard.');
|
|
42
37
|
return;
|
|
@@ -182,7 +177,7 @@ class VoxePaySDK {
|
|
|
182
177
|
* Get the SDK version
|
|
183
178
|
*/
|
|
184
179
|
get version(): string {
|
|
185
|
-
return '0.
|
|
180
|
+
return '0.5.4';
|
|
186
181
|
}
|
|
187
182
|
|
|
188
183
|
/**
|