@pacspace-io/sdk 0.6.0 → 0.7.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 +6 -5
- package/dist/client.js +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,8 +42,8 @@ const checkpoint = await pac.balance.checkpoint('cust_123', {
|
|
|
42
42
|
|--------|------|---------|-------------|
|
|
43
43
|
| `apiKey` | `string` | **required** | Your Balance API key (`pk_live_*` or `pk_test_*`) |
|
|
44
44
|
| `baseUrl` | `string` | auto-routed | API base URL (overrides auto-routing if provided) |
|
|
45
|
-
| `sandboxUrl` | `string` |
|
|
46
|
-
| `productionUrl` | `string` | `https://
|
|
45
|
+
| `sandboxUrl` | `string` | Sandbox URL from your PacSpace dashboard | Custom sandbox URL (used for `pk_test_*` keys) |
|
|
46
|
+
| `productionUrl` | `string` | `https://app.pacspace.io` | Custom production URL (used for `pk_live_*` keys) |
|
|
47
47
|
| `chainId` | `number` | auto-detected | Default chain ID (296 for sandbox, 295 for production) |
|
|
48
48
|
| `maxRetries` | `number` | `2` | Max retries on transient errors |
|
|
49
49
|
| `timeout` | `number` | `30000` | Request timeout in ms |
|
|
@@ -216,15 +216,16 @@ try {
|
|
|
216
216
|
|
|
217
217
|
The SDK automatically routes requests to the correct API endpoint based on your API key prefix:
|
|
218
218
|
|
|
219
|
-
- `pk_test_*` → Sandbox API (`
|
|
220
|
-
- `pk_live_*` → Production API (`https://
|
|
219
|
+
- `pk_test_*` → Sandbox API (the Sandbox URL shown in your PacSpace dashboard, or `sandboxUrl` when configured)
|
|
220
|
+
- `pk_live_*` → Production API (`https://app.pacspace.io`)
|
|
221
221
|
|
|
222
222
|
### Examples
|
|
223
223
|
|
|
224
224
|
**Sandbox (automatic):**
|
|
225
225
|
```typescript
|
|
226
226
|
const pac = new PacSpace({ apiKey: 'pk_test_...' });
|
|
227
|
-
// Automatically uses sandbox API URL
|
|
227
|
+
// Automatically uses the SDK's configured/default sandbox API URL.
|
|
228
|
+
// Pass sandboxUrl if your dashboard provides a different Sandbox URL.
|
|
228
229
|
```
|
|
229
230
|
|
|
230
231
|
**Production (automatic):**
|
package/dist/client.js
CHANGED
|
@@ -9,7 +9,7 @@ const DEFAULT_SANDBOX_URL = 'https://api-sandbox-wnizuypena-uw.a.run.app';
|
|
|
9
9
|
/**
|
|
10
10
|
* Default production API base URL.
|
|
11
11
|
*/
|
|
12
|
-
const DEFAULT_PRODUCTION_URL = 'https://
|
|
12
|
+
const DEFAULT_PRODUCTION_URL = 'https://app.pacspace.io';
|
|
13
13
|
/**
|
|
14
14
|
* Default request timeout in milliseconds.
|
|
15
15
|
*/
|
|
@@ -194,7 +194,7 @@ class HttpClient {
|
|
|
194
194
|
const headers = {
|
|
195
195
|
'X-Api-Key': this.apiKey,
|
|
196
196
|
'Content-Type': 'application/json',
|
|
197
|
-
'User-Agent': '@pacspace-io/sdk/0.
|
|
197
|
+
'User-Agent': '@pacspace-io/sdk/0.7.0',
|
|
198
198
|
};
|
|
199
199
|
if (options?.dashboardToken) {
|
|
200
200
|
headers.Authorization = `Bearer ${options.dashboardToken}`;
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const verify_1 = require("./webhooks/verify");
|
|
|
8
8
|
/** Default sandbox API base URL. */
|
|
9
9
|
const DEFAULT_SANDBOX_URL = 'https://api-sandbox-wnizuypena-uw.a.run.app';
|
|
10
10
|
/** Default production API base URL. */
|
|
11
|
-
const DEFAULT_PRODUCTION_URL = 'https://
|
|
11
|
+
const DEFAULT_PRODUCTION_URL = 'https://app.pacspace.io';
|
|
12
12
|
/**
|
|
13
13
|
* PacSpace SDK — the official TypeScript client for the PacSpace Balance API.
|
|
14
14
|
*
|
package/package.json
CHANGED