@lydianpay/sdk-web 1.0.0 → 1.0.2
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/LICENSE +21 -0
- package/README.md +136 -0
- package/dist/lydian.iife.js +12 -12
- package/package.json +30 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lydian
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<h1 align="center">Lydian Checkout Web SDK</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/@lydianpay/sdk-web"><img src="https://img.shields.io/npm/v/@lydianpay/sdk-web.svg" alt="npm version"></a>
|
|
5
|
+
<a href="https://badge.socket.dev/npm/package/@lydianpay/sdk-web"><img src="https://badge.socket.dev/npm/package/@lydianpay/sdk-web" alt="Socket Badge"></a>
|
|
6
|
+
<a href="https://qlty.sh/gh/lydianpay/projects/sdk-web"><img src="https://qlty.sh/gh/lydianpay/projects/sdk-web/maintainability.svg" alt="Maintainability"></a>
|
|
7
|
+
<a href="https://qlty.sh/gh/lydianpay/projects/sdk-web"><img src="https://qlty.sh/gh/lydianpay/projects/sdk-web/coverage.svg" alt="Code Coverage"></a>
|
|
8
|
+
<a href="https://github.com/lydianpay/sdk-web/actions/workflows/github-code-scanning/codeql"><img src="https://github.com/lydianpay/sdk-web/actions/workflows/github-code-scanning/codeql/badge.svg" alt="CodeQL"></a>
|
|
9
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
Accept crypto payments on your site with a drop-in checkout. The Lydian Web SDK
|
|
14
|
+
registers a <code><lydian-checkout></code> web component and a global
|
|
15
|
+
<code>window.Lydian</code> API that walks your customer through paying with a
|
|
16
|
+
connected wallet or QR code across 20+ chains and major stablecoins.
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
**npm**
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @lydianpay/sdk-web
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import '@lydianpay/sdk-web';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Script tag (CDN)**
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<script
|
|
35
|
+
type="module"
|
|
36
|
+
src="https://cdn.jsdelivr.net/npm/@lydianpay/sdk-web@1.0.0/dist/lydian.iife.js"
|
|
37
|
+
></script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Pin a version (e.g. `@1.0.0`) in production so an upstream release can't change
|
|
41
|
+
your checkout unexpectedly.
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
Place the checkout element where you want the UI, then initialize the SDK:
|
|
46
|
+
|
|
47
|
+
```html
|
|
48
|
+
<lydian-checkout></lydian-checkout>
|
|
49
|
+
|
|
50
|
+
<script type="module">
|
|
51
|
+
window.Lydian.init({
|
|
52
|
+
dev: false,
|
|
53
|
+
sandbox: false, // both false → production
|
|
54
|
+
publishableKey: 'pk_live_...',
|
|
55
|
+
walletConnectProjectId: 'your-walletconnect-project-id',
|
|
56
|
+
transaction: {
|
|
57
|
+
amount: 2.45,
|
|
58
|
+
currency: 'USD', // 'USD' or 'TRY'
|
|
59
|
+
descriptor: 'Order #1234',
|
|
60
|
+
referenceNumber: 'your-unique-ref',
|
|
61
|
+
},
|
|
62
|
+
paymentSuccessListener: () => {
|
|
63
|
+
window.location.href = '/thank-you';
|
|
64
|
+
},
|
|
65
|
+
paymentFailedListener: (message) => {
|
|
66
|
+
console.error('Payment failed:', message);
|
|
67
|
+
},
|
|
68
|
+
paymentCanceledListener: () => {
|
|
69
|
+
console.log('Payment canceled');
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
</script>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Configuration
|
|
76
|
+
|
|
77
|
+
`window.Lydian.init(options)`
|
|
78
|
+
|
|
79
|
+
| Option | Type | Required | Description |
|
|
80
|
+
|--------|------|----------|-------------|
|
|
81
|
+
| `publishableKey` | `string` | yes | Your Lydian publishable key (`pk_...`). |
|
|
82
|
+
| `walletConnectProjectId` | `string` | yes | Your [WalletConnect/Reown](https://dashboard.reown.com) project ID, used to power wallet connections. |
|
|
83
|
+
| `transaction` | `Transaction` | yes | The payment to collect (see below). |
|
|
84
|
+
| `dev` | `boolean` | yes | Target the dev environment. |
|
|
85
|
+
| `sandbox` | `boolean` | yes | Target sandbox. With both `dev` and `sandbox` `false`, the SDK uses production. |
|
|
86
|
+
| `paymentSuccessListener` | `() => void` | yes | Called when the payment completes. |
|
|
87
|
+
| `paymentFailedListener` | `(message: string) => void` | yes | Called on failure, with a message. |
|
|
88
|
+
| `paymentCanceledListener` | `() => void` | yes | Called when the customer cancels. |
|
|
89
|
+
| `isEmbedded` | `boolean` | no | Render the checkout inline (embedded) instead of as a modal. |
|
|
90
|
+
|
|
91
|
+
**`Transaction`**
|
|
92
|
+
|
|
93
|
+
| Field | Type | Required | Description |
|
|
94
|
+
|-------|------|----------|-------------|
|
|
95
|
+
| `amount` | `number` | yes | Amount to charge. |
|
|
96
|
+
| `currency` | `'USD' \| 'TRY'` | yes | Fiat currency the amount is denominated in. |
|
|
97
|
+
| `referenceNumber` | `string` | yes | Your unique reference for this payment. |
|
|
98
|
+
| `descriptor` | `string` | no | Human-readable description shown to the customer. |
|
|
99
|
+
|
|
100
|
+
## Updating the transaction
|
|
101
|
+
|
|
102
|
+
Before the customer pays, you can update the amount or currency. This also
|
|
103
|
+
resets the checkout UI to its initial state:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
window.Lydian.updateTransaction({
|
|
107
|
+
amount: 1.45,
|
|
108
|
+
currency: 'USD',
|
|
109
|
+
descriptor: 'Order #1234',
|
|
110
|
+
referenceNumber: 'your-unique-ref',
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Environments
|
|
115
|
+
|
|
116
|
+
| Environment | Flags |
|
|
117
|
+
|-------------|-------|
|
|
118
|
+
| Production | `dev: false, sandbox: false` |
|
|
119
|
+
| Sandbox | `sandbox: true` |
|
|
120
|
+
| Development | `dev: true` |
|
|
121
|
+
|
|
122
|
+
## Supported assets & networks
|
|
123
|
+
|
|
124
|
+
USDT, USDC, ETH, PYUSD, RLUSD, USDe, USDS, USDP, DAI across Ethereum, Polygon,
|
|
125
|
+
Arbitrum, Base, Optimism, Solana, Bitcoin, Celo, Linea, Sonic, Unichain, ZKsync,
|
|
126
|
+
and more. Which assets appear at checkout is controlled by your Lydian account
|
|
127
|
+
configuration.
|
|
128
|
+
|
|
129
|
+
## Links
|
|
130
|
+
|
|
131
|
+
- [npm package](https://www.npmjs.com/package/@lydianpay/sdk-web)
|
|
132
|
+
- [Lydian developer docs](https://developer.lydian.com)
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
[MIT](./LICENSE)
|