payluk-escrow-inline-checkout 0.2.3 → 0.2.4
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 +28 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,6 +48,32 @@ async function onPayClick() {
|
|
|
48
48
|
|
|
49
49
|
## React Usage
|
|
50
50
|
|
|
51
|
+
```tsx
|
|
52
|
+
import { initEscrowCheckout } from 'payluk-escrow-inline-checkout';
|
|
53
|
+
|
|
54
|
+
export default function ClientEscrowInit() {
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
initEscrowCheckout({
|
|
57
|
+
publicKey: 'pk_live_*************************',
|
|
58
|
+
});
|
|
59
|
+
}, []);
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
export default function RootLayout({ children }: Readonly<{children: React.ReactNode}>) {
|
|
66
|
+
return (
|
|
67
|
+
<html lang="en">
|
|
68
|
+
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
|
69
|
+
<ClientEscrowInit />
|
|
70
|
+
{children}
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
51
77
|
```tsx
|
|
52
78
|
import React from 'react';
|
|
53
79
|
import { useEscrowCheckout } from 'payluk-escrow-inline-checkout/react';
|
|
@@ -72,7 +98,7 @@ export function CheckoutButton() {
|
|
|
72
98
|
};
|
|
73
99
|
|
|
74
100
|
return (
|
|
75
|
-
<button onClick={handleClick}
|
|
101
|
+
<button onClick={handleClick}>
|
|
76
102
|
Pay Now
|
|
77
103
|
</button>
|
|
78
104
|
);
|
|
@@ -150,7 +176,7 @@ import { useEscrowCheckout } from 'payluk-escrow-inline-checkout/react';
|
|
|
150
176
|
## Error Handling
|
|
151
177
|
|
|
152
178
|
Common issues:
|
|
153
|
-
- **Not initialized:** Ensure `initEscrowCheckout({
|
|
179
|
+
- **Not initialized:** Ensure `initEscrowCheckout({ publicKey })` is called before `pay(...)`.
|
|
154
180
|
- **Browser-only:** Do not call `pay(...)` on the server.
|
|
155
181
|
- **Network/API errors:** If the session endpoint fails, `pay(...)` will reject with the error message from your backend (if any).
|
|
156
182
|
|
package/package.json
CHANGED