@depay/widgets 4.2.2 → 5.0.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
@@ -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 that you need 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`
@@ -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`
@@ -775,6 +777,20 @@ DePayWidgets.Sale({
775
777
  });
776
778
  ```
777
779
 
780
+ #### tokenImage
781
+
782
+ `tokenImage`
783
+
784
+ Allows to set the token image used in the widget to represent the purchased token:
785
+
786
+ ```javascript
787
+ DePayWidgets.Sale({
788
+
789
+ tokenImage: 'https://depay.fi/favicon.png'
790
+
791
+ });
792
+ ```
793
+
778
794
  #### style
779
795
 
780
796
  `style`
@@ -1026,23 +1042,6 @@ DePayWidgets.Donation({
1026
1042
  });
1027
1043
  ```
1028
1044
 
1029
- #### ensured
1030
-
1031
- `ensured`
1032
-
1033
- 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).
1034
-
1035
- 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)
1036
-
1037
- ```javascript
1038
- DePayWidgets.Donation({
1039
-
1040
- ensured: (transaction)=> {
1041
- // called when payment transaction has been confirmed X times by the network
1042
- }
1043
- });
1044
- ```
1045
-
1046
1045
  #### failed
1047
1046
 
1048
1047
  `failed`
@@ -1299,7 +1298,7 @@ test:cypress:debug
1299
1298
  Test and debug single cypress file:
1300
1299
 
1301
1300
  ```
1302
- yarn test:cypress:debug --spec "cypress/integration/Donation/overview.js"
1301
+ yarn test:cypress:debug --spec "cypress/integration/Payment/approve.js"
1303
1302
  ```
1304
1303
 
1305
1304
  ### Release new versions to npm