@depay/widgets 6.9.0 → 6.11.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,27 @@ 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
+ #### fee
178
+
179
+ You can configure a fee which will be applied to every payment with it's own dedicated fee receiver address.
180
+
181
+ The fee will be taken from the target token and target amount (after swap, depending on your `accept` configuration).
182
+
183
+ `amount`: Either percentage (e.g. `5%`, or absolute amount as BigNumber string ('100000000000000000') or pure number (2.5)
184
+
185
+ `receiver`: The address that is supposed to receive the fee.
186
+
187
+ ```javascript
188
+ DePayWidgets.Payment({
189
+ accept: [...],
190
+ fee: {
191
+ amount: '3%',
192
+ receiver: '0x4e260bB2b25EC6F3A59B478fCDe5eD5B8D783B02'
193
+ }
194
+ });
195
+ ```
196
+
197
+
177
198
  #### track
178
199
 
179
200
  `track`
@@ -236,21 +257,19 @@ A failed payment tracking will also call the [error callback](#error) with `{cod
236
257
 
237
258
  ##### Additional Polling
238
259
 
239
- In order to ensure a 100% payment tracking coverage, you cant entirely rely on websockets initiated with `track`.
240
-
241
- Hence, if you require better payment tracking coverage, you will also need to implement polling.
260
+ In order to ensure a 100% coverage that users are released and forwarded within your payment flow, you will need to implement polling in addition to tracking.
242
261
 
243
262
  The `track.poll` configuration either takes an `enpoint` or a `method` (similiar to track itself).
244
263
 
245
- It will use the endpoint or the method to request a payment status every 5 seconds.
264
+ It will use the endpoint or the method to request a release every 5 seconds.
246
265
 
247
- You need to make sure to respond to this request with `404` in case the payment has not been finished yet (as reported from the tracking callback)
248
- or `200` if the payment has been finished (as reported from the tracking callback).
266
+ You need to make sure to respond to this request with a status `404` in case the user is not to be released just yet (payment and processing on your side are not complete yet)
267
+ or `200` if the payment has been completed and the processing on your side is done and the user can be released and forwarded withing your payment flow.
249
268
 
250
- In case you want to redirect the user to the next step in your system, the polling needs to respond with `{ forward_to: 'https://example.com/next_step_url' }`.
269
+ In case you want to redirect the user to the next step in your system the poll endpoint needs to respond with a body containing json like: `{ forward_to: 'https://example.com/next_step_url' }`.
251
270
 
252
- It is not enough to rely on setting `forward_to` initially with the tracking request (if you also implement polling),
253
- as the entire reason polling exist is because websockets might fail to report the initially configured `forward_to` to your clients.
271
+ It is not enough to rely on setting `forward_to` initially with the tracking request, you will also need to respond with `forward_to` when implementing polling
272
+ as the entire reason for polling is to cover cases where websockets fail and the initial `forward_to` can not be communicated to the client.
254
273
 
255
274
  #### connected
256
275
 
@@ -643,6 +662,17 @@ alongside values for `start`, `min` and `step`.
643
662
 
644
663
  `step`: The number by wich to increment/decremten changes to the amount.
645
664
 
665
+ `token`: Set to `true` if you want amount selection to be denominated in the token you're selling, e.g.:
666
+
667
+ ```javascript
668
+ DePayWidgets.Sale({
669
+ sell: {...},
670
+ amount: {
671
+ token: true
672
+ }
673
+ });
674
+ ```
675
+
646
676
  #### connected
647
677
 
648
678
  `connected`