@thepayulink/checkout 2.0.0 → 2.0.1
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/index.d.ts +36 -41
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,66 +1,61 @@
|
|
|
1
|
-
|
|
1
|
+
// Type definitions for @thepayulink/checkout
|
|
2
|
+
|
|
3
|
+
export interface PayuLinkPrefill {
|
|
2
4
|
name?: string;
|
|
3
5
|
/** 10-digit Indian mobile number. */
|
|
4
6
|
contact?: string;
|
|
5
7
|
email?: string;
|
|
6
8
|
}
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/** The signed handoff. Send this to YOUR server and verify it there. */
|
|
11
|
+
export interface PayuLinkSuccess {
|
|
12
|
+
payulink_order_id: string;
|
|
13
|
+
payulink_payment_id: string;
|
|
14
|
+
/** HMAC_SHA256(order_id + "|" + payment_id, key_secret) — verify server-side. */
|
|
15
|
+
payulink_signature: string;
|
|
16
|
+
utr?: string | null;
|
|
17
|
+
/** PAISE */
|
|
18
|
+
amount?: number;
|
|
12
19
|
}
|
|
13
20
|
|
|
14
|
-
export interface
|
|
15
|
-
/**
|
|
21
|
+
export interface PayuLinkOptions {
|
|
22
|
+
/** Your PUBLISHABLE key: pl_live_… / pl_test_…. Never a key_secret. */
|
|
23
|
+
key: string;
|
|
24
|
+
/** Gateway base URL. Default https://payulink.io/api */
|
|
16
25
|
apiBase?: string;
|
|
17
|
-
/**
|
|
18
|
-
assetBase?: string;
|
|
19
|
-
/** Business name shown on the left panel. */
|
|
26
|
+
/** Overrides the merchant name shown in the header. */
|
|
20
27
|
name?: string;
|
|
21
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
/** Optional public key, sent as the `x-payulink-key` request header. */
|
|
26
|
-
key?: string;
|
|
28
|
+
/** Accent colour, e.g. { color: '#38BDF8' } */
|
|
29
|
+
theme?: { color?: string };
|
|
30
|
+
/** Status poll interval in ms. Default 2500. */
|
|
31
|
+
pollMs?: number;
|
|
27
32
|
}
|
|
28
33
|
|
|
29
|
-
export interface
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
/** Amount in rupees. Required unless `orderId` is given. */
|
|
37
|
-
amount?: number;
|
|
38
|
-
/** What the customer is paying for. */
|
|
39
|
-
item?: string;
|
|
40
|
-
/** Optional sub-line under the price summary. */
|
|
41
|
-
note?: string;
|
|
42
|
-
prefill?: PayulinkPrefill;
|
|
43
|
-
/** Called on a successful payment. */
|
|
44
|
-
handler?: (result: PayulinkSuccess) => void;
|
|
45
|
-
/** Called when the modal is dismissed without paying. */
|
|
34
|
+
export interface PayuLinkOpenOptions extends Partial<PayuLinkOptions> {
|
|
35
|
+
/** Required. Created by YOUR server via POST /v1/orders. */
|
|
36
|
+
order_id: string;
|
|
37
|
+
prefill?: PayuLinkPrefill;
|
|
38
|
+
/** Called on success with the signed handoff. */
|
|
39
|
+
handler?: (result: PayuLinkSuccess) => void;
|
|
40
|
+
/** Called if the customer closes the checkout without paying. */
|
|
46
41
|
onDismiss?: () => void;
|
|
47
|
-
/** Called if the order can't be opened (e.g. unknown/expired orderId). */
|
|
48
42
|
onError?: (error: Error) => void;
|
|
49
43
|
}
|
|
50
44
|
|
|
51
|
-
export interface
|
|
52
|
-
/** Programmatically close the modal. */
|
|
45
|
+
export interface PayuLinkHandle {
|
|
53
46
|
close(): void;
|
|
54
47
|
}
|
|
55
48
|
|
|
56
|
-
export default class
|
|
57
|
-
constructor(options
|
|
58
|
-
open(
|
|
59
|
-
static open(options:
|
|
49
|
+
export default class PayuLink {
|
|
50
|
+
constructor(options: PayuLinkOptions);
|
|
51
|
+
open(options: PayuLinkOpenOptions): PayuLinkHandle;
|
|
52
|
+
static open(options: PayuLinkOptions & PayuLinkOpenOptions): PayuLinkHandle;
|
|
60
53
|
}
|
|
61
54
|
|
|
62
55
|
declare global {
|
|
63
56
|
interface Window {
|
|
64
|
-
|
|
57
|
+
PayuLink: typeof PayuLink;
|
|
58
|
+
/** Back-compat alias for pre-2.x <script> embeds. */
|
|
59
|
+
PayulinkCheckout: typeof PayuLink;
|
|
65
60
|
}
|
|
66
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thepayulink/checkout",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "PayuLink Checkout — open a server-created order in the browser with your publishable key.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/payulink-checkout.cjs",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "node build.mjs"
|
|
25
|
+
"build": "node build.mjs",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [
|
|
28
29
|
"payulink",
|