arcpaykit 0.2.0 → 0.3.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 CHANGED
@@ -1,6 +1,9 @@
1
1
  # arcpaykit
2
2
 
3
- Official ArcPay JavaScript SDK for accepting stablecoin payments.
3
+ Official ArcPay JavaScript/TypeScript SDK for accepting stablecoin payments.
4
+
5
+ [![npm version](https://badge.fury.io/js/arcpaykit.svg)](https://www.npmjs.com/package/arcpaykit)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
7
 
5
8
  ## Installation
6
9
 
@@ -17,6 +20,10 @@ import { ArcPay } from "arcpaykit";
17
20
 
18
21
  const arcpay = new ArcPay("your-api-key");
19
22
 
23
+ // Verify API connectivity
24
+ const ping = await arcpay.ping();
25
+ console.log(ping.status); // "ok"
26
+
20
27
  // Create a payment (happy path - recommended)
21
28
  const payment = await arcpay.payments.create({
22
29
  amount: "100.00",
@@ -26,7 +33,7 @@ const payment = await arcpay.payments.create({
26
33
  });
27
34
 
28
35
  // Redirect customer to checkout
29
- console.log(payment.checkout_url); // https://pay.arcpaykit.com/checkout/pay_...
36
+ console.log(payment.checkout_url); // https://arcpay.systems/checkout/pay_...
30
37
 
31
38
  // That's it! ArcPay handles:
32
39
  // - Merchant wallet (uses your default)
@@ -56,7 +63,16 @@ new ArcPay(apiKey: string, baseUrl?: string)
56
63
  ```
57
64
 
58
65
  - `apiKey`: Your ArcPay API key
59
- - `baseUrl`: Optional base URL (defaults to `https://pay.arcpaykit.com`)
66
+ - `baseUrl`: Optional base URL (defaults to `https://arcpay.systems`)
67
+
68
+ ### ping()
69
+
70
+ Verify API connectivity.
71
+
72
+ ```typescript
73
+ const result = await arcpay.ping();
74
+ // { status: "ok", timestamp: "2024-01-02T10:00:00.000Z" }
75
+ ```
60
76
 
61
77
  ### Payments
62
78
 
@@ -181,6 +197,12 @@ import { ArcPay } from "arcpaykit";
181
197
 
182
198
  const arcpay = new ArcPay(process.env.ARCPAY_API_KEY!);
183
199
 
200
+ // Verify connectivity first
201
+ const ping = await arcpay.ping();
202
+ if (ping.status !== "ok") {
203
+ throw new Error("Cannot connect to ArcPay API");
204
+ }
205
+
184
206
  // Create payment (simple - recommended)
185
207
  const payment = await arcpay.payments.create({
186
208
  amount: "50.00",
@@ -225,7 +247,7 @@ const payment = await arcpay.payments.createAdvanced({
225
247
  ```typescript
226
248
  const arcpay = new ArcPay(
227
249
  "your-api-key",
228
- "https://staging.arcpaykit.com"
250
+ "https://staging.arcpay.systems"
229
251
  );
230
252
  ```
231
253
 
@@ -243,9 +265,14 @@ try {
243
265
 
244
266
  ## REST API
245
267
 
246
- The SDK is a thin wrapper around the ArcPay REST API. You can also use the REST API directly if needed. See the [ArcPay API documentation](https://docs.arcpaykit.com) for more details.
268
+ The SDK is a thin wrapper around the ArcPay REST API. You can also use the REST API directly if needed. See the [ArcPay API documentation](https://arcpay.systems/docs) for more details.
269
+
270
+ ## Support
271
+
272
+ - 📚 [Documentation](https://arcpay.systems/docs)
273
+ - 💬 [Discord Community](https://discord.gg/arcpay)
274
+ - 🐛 [Report Issues](https://github.com/ArcPayKit/gateway/issues)
247
275
 
248
276
  ## License
249
277
 
250
278
  MIT
251
-
package/dist/client.d.ts CHANGED
@@ -1,6 +1,16 @@
1
+ export interface PingResponse {
2
+ status: string;
3
+ timestamp: string;
4
+ version?: string;
5
+ }
1
6
  export declare class ArcPayClient {
2
7
  private apiKey;
3
8
  private baseUrl;
4
9
  constructor(apiKey: string, baseUrl?: string);
5
10
  request<T = any>(path: string, options?: RequestInit): Promise<T>;
11
+ /**
12
+ * Ping the ArcPay API to verify connectivity
13
+ * @returns Promise with status and timestamp
14
+ */
15
+ ping(): Promise<PingResponse>;
6
16
  }
package/dist/client.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArcPayClient = void 0;
4
4
  class ArcPayClient {
5
- constructor(apiKey, baseUrl = "https://pay.arcpaykit.com") {
5
+ constructor(apiKey, baseUrl = "https://arcpay.systems") {
6
6
  this.apiKey = apiKey;
7
7
  this.baseUrl = baseUrl;
8
8
  }
@@ -21,5 +21,37 @@ class ArcPayClient {
21
21
  }
22
22
  return res.json();
23
23
  }
24
+ /**
25
+ * Ping the ArcPay API to verify connectivity
26
+ * @returns Promise with status and timestamp
27
+ */
28
+ async ping() {
29
+ const start = Date.now();
30
+ try {
31
+ const res = await fetch(`${this.baseUrl}/api/health`, {
32
+ method: "GET",
33
+ headers: {
34
+ "Authorization": `Bearer ${this.apiKey}`,
35
+ }
36
+ });
37
+ if (res.ok) {
38
+ return {
39
+ status: "ok",
40
+ timestamp: new Date().toISOString(),
41
+ version: "1.0.0"
42
+ };
43
+ }
44
+ return {
45
+ status: "error",
46
+ timestamp: new Date().toISOString()
47
+ };
48
+ }
49
+ catch (error) {
50
+ return {
51
+ status: "error",
52
+ timestamp: new Date().toISOString()
53
+ };
54
+ }
55
+ }
24
56
  }
25
57
  exports.ArcPayClient = ArcPayClient;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,20 @@
1
+ import { PingResponse } from "./client";
1
2
  import { Payments } from "./payments";
2
3
  export declare class ArcPay {
3
4
  payments: Payments;
5
+ private client;
4
6
  constructor(apiKey: string, baseUrl?: string);
7
+ /**
8
+ * Ping the ArcPay API to verify connectivity
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const result = await arcpay.ping();
13
+ * console.log(result.status); // "ok"
14
+ * ```
15
+ */
16
+ ping(): Promise<PingResponse>;
5
17
  }
6
- export type { CreatePaymentRequest, CreatePaymentResponse, Payment, ConfirmPaymentRequest, ConfirmPaymentResponse, FailPaymentRequest, FailPaymentResponse, ExpirePaymentRequest, ExpirePaymentResponse, } from "./payments";
18
+ export type { CreatePaymentRequest, SimpleCreatePaymentRequest, CreatePaymentResponse, Payment, ConfirmPaymentRequest, ConfirmPaymentResponse, FailPaymentRequest, FailPaymentResponse, ExpirePaymentRequest, ExpirePaymentResponse, } from "./payments";
19
+ export type { PingResponse } from "./client";
7
20
  export default ArcPay;
package/dist/index.js CHANGED
@@ -5,8 +5,20 @@ const client_1 = require("./client");
5
5
  const payments_1 = require("./payments");
6
6
  class ArcPay {
7
7
  constructor(apiKey, baseUrl) {
8
- const client = new client_1.ArcPayClient(apiKey, baseUrl);
9
- this.payments = new payments_1.Payments(client);
8
+ this.client = new client_1.ArcPayClient(apiKey, baseUrl);
9
+ this.payments = new payments_1.Payments(this.client);
10
+ }
11
+ /**
12
+ * Ping the ArcPay API to verify connectivity
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const result = await arcpay.ping();
17
+ * console.log(result.status); // "ok"
18
+ * ```
19
+ */
20
+ ping() {
21
+ return this.client.ping();
10
22
  }
11
23
  }
12
24
  exports.ArcPay = ArcPay;
package/package.json CHANGED
@@ -1,12 +1,27 @@
1
1
  {
2
2
  "name": "arcpaykit",
3
- "version": "0.2.0",
4
- "description": "Official ArcPay JavaScript SDK",
3
+ "version": "0.3.0",
4
+ "description": "Official ArcPay JavaScript SDK for accepting stablecoin payments",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "license": "MIT",
9
- "keywords": ["payments", "web3", "stablecoin", "arcpay"],
11
+ "keywords": [
12
+ "payments",
13
+ "web3",
14
+ "stablecoin",
15
+ "arcpay",
16
+ "crypto",
17
+ "usdc",
18
+ "eurc",
19
+ "blockchain"
20
+ ],
21
+ "homepage": "https://arcpay.systems",
22
+ "bugs": {
23
+ "url": "https://github.com/ArcPayKit/gateway/issues"
24
+ },
10
25
  "scripts": {
11
26
  "build": "tsc",
12
27
  "prepublishOnly": "npm run build"
@@ -16,7 +31,9 @@
16
31
  },
17
32
  "repository": {
18
33
  "type": "git",
19
- "url": "https://github.com/arcpay/gateway.git"
34
+ "url": "https://github.com/ArcPayKit/gateway.git"
35
+ },
36
+ "engines": {
37
+ "node": ">=16.0.0"
20
38
  }
21
- }
22
-
39
+ }