@depay/widgets 4.3.0 → 5.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  You can either load the `@depay/widgets` package via CDN:
4
4
 
5
5
  ```
6
- <script src="https://integrate.depay.fi/widgets/v3.js"></script>
6
+ <script src="https://integrate.depay.fi/widgets/v5.js"></script>
7
7
  ```
8
8
 
9
9
  or you install `@depay/widgets` via the package manager of your choice and ship it as part of your application bundle:
@@ -58,7 +58,7 @@ In order to receive decentralized payments on any blockchain you need to have yo
58
58
  ### Quick start
59
59
 
60
60
  ```
61
- <script src="https://integrate.depay.fi/widgets/v3.js"/>
61
+ <script src="https://integrate.depay.fi/widgets/v5.js"/>
62
62
  ```
63
63
 
64
64
  ```
@@ -174,6 +174,42 @@ DePayWidgets.Payment({
174
174
 
175
175
  Checkout [DePay Web3 Payments](https://github.com/DePayFi/depay-web3-payments#pay-into-smart-contracts) and [DePay Router Smart Contract](https://github.com/DePayFi/depay-evm-router) for more details.
176
176
 
177
+ #### track
178
+
179
+ `track`
180
+
181
+ Allows to track payment confirmation via DePay to enable integration into web applications.
182
+
183
+ ```javascript
184
+ DePayWidgets.Payment({
185
+
186
+ track: {
187
+ endpoint: '/track/payments' // your endpoint to forward the payment tracking to the payments api
188
+ }
189
+ })
190
+ ```
191
+
192
+ Once the payment has been submitted by the widget, it will call the configured endpoint with:
193
+
194
+ ```
195
+ POST /track/payments
196
+ BODY:
197
+ {
198
+ "blockchain": "ethereum",
199
+ "transaction": "0x4311a9820195c2a5af99c45c72c88848ed403a4020863c913feed81d15855ae4",
200
+ "sender": "0x769794c94e9f113e357023dab73e81dbd6db201c",
201
+ "nonce": 103,
202
+ "after_block": 13230369
203
+ }
204
+ ```
205
+
206
+ Your endpoint needs to make sure to forward this to the [payment tracking api](https://depay.fi/documentation/api#payments).
207
+
208
+ Also make sure to add `token`, `amount` and `confirmations` when forwarding the request to the payments api.
209
+ Those values are supposed to be set by your backend not the widget nor the fronted because any user could set these values to their liking otherwise, having you confirm payment amounts and tokens that you didn't intend to receive!
210
+
211
+ Make sure you read the [Payment Tracking API](https://depay.fi/documentation/api#payments) for further details on how to integrate payment tracking.
212
+
177
213
  #### connected
178
214
 
179
215
  `connected`
@@ -242,23 +278,6 @@ DePayWidgets.Payment({
242
278
  })
243
279
  ```
244
280
 
245
- #### ensured
246
-
247
- `ensured`
248
-
249
- A function that will be called once the payment has been confirmed enough times to consider it's "ensured" (e.g. 12 confirmations on Ethereum).
250
-
251
- The widget will call this function passing a transaction as single argument (see: [depay-web3-wallets](https://github.com/depayfi/depay-web3-wallets#transaction) for more details)
252
-
253
- ```javascript
254
- DePayWidgets.Payment({
255
-
256
- ensured: (transaction)=> {
257
- // called when payment transaction has been confirmed X times by the network
258
- }
259
- })
260
- ```
261
-
262
281
  #### failed
263
282
 
264
283
  `failed`
@@ -520,7 +539,7 @@ In order to sell tokens in a decentralized way, that token needs to have a liqui
520
539
  ### Quick start
521
540
 
522
541
  ```
523
- <script src="https://integrate.depay.fi/widgets/v3.js"/>
542
+ <script src="https://integrate.depay.fi/widgets/v5.js"/>
524
543
  ```
525
544
 
526
545
  ```javascript
@@ -648,23 +667,6 @@ DePayWidgets.Sale({
648
667
  });
649
668
  ```
650
669
 
651
- #### ensured
652
-
653
- `ensured`
654
-
655
- A function that will be called once the payment has been confirmed enough times to consider it's "ensured" (e.g. 12 confirmations on Ethereum).
656
-
657
- The widget will call this function passing a transaction as single argument (see: [depay-web3-wallets](https://github.com/depayfi/depay-web3-wallets#transaction) for more details)
658
-
659
- ```javascript
660
- DePayWidgets.Sale({
661
-
662
- ensured: (transaction)=> {
663
- // called when payment transaction has been confirmed X times by the network
664
- }
665
- });
666
- ```
667
-
668
670
  #### failed
669
671
 
670
672
  `failed`
@@ -899,7 +901,7 @@ In order to receive decentralized donation payments on any blockchain you need t
899
901
  ### Quick start
900
902
 
901
903
  ```
902
- <script src="https://integrate.depay.fi/widgets/v3.js"/>
904
+ <script src="https://integrate.depay.fi/widgets/v5.js"/>
903
905
  ```
904
906
 
905
907
  ```javascript
@@ -1040,23 +1042,6 @@ DePayWidgets.Donation({
1040
1042
  });
1041
1043
  ```
1042
1044
 
1043
- #### ensured
1044
-
1045
- `ensured`
1046
-
1047
- A function that will be called once the payment has been confirmed enough times to consider it's "ensured" (e.g. 12 confirmations on Ethereum).
1048
-
1049
- The widget will call this function passing a transaction as single argument (see: [depay-web3-wallets](https://github.com/depayfi/depay-web3-wallets#transaction) for more details)
1050
-
1051
- ```javascript
1052
- DePayWidgets.Donation({
1053
-
1054
- ensured: (transaction)=> {
1055
- // called when payment transaction has been confirmed X times by the network
1056
- }
1057
- });
1058
- ```
1059
-
1060
1045
  #### failed
1061
1046
 
1062
1047
  `failed`
@@ -1270,7 +1255,7 @@ DePay Connect allows you to have your users connect their crypto wallet to your
1270
1255
  Returns connected `account`, `accounts` and `wallet` in return.
1271
1256
 
1272
1257
  ```
1273
- <script src="https://integrate.depay.fi/widgets/v3.js"/>
1258
+ <script src="https://integrate.depay.fi/widgets/v5.js"/>
1274
1259
  ```
1275
1260
 
1276
1261
  ```javascript
@@ -1313,7 +1298,7 @@ test:cypress:debug
1313
1298
  Test and debug single cypress file:
1314
1299
 
1315
1300
  ```
1316
- yarn test:cypress:debug --spec "cypress/integration/Donation/overview.js"
1301
+ yarn test:cypress:debug --spec "cypress/integration/Payment/approve.js"
1317
1302
  ```
1318
1303
 
1319
1304
  ### Release new versions to npm