mirror of
https://github.com/aljazceru/fiatlink.git
synced 2025-12-17 05:14:19 +01:00
Merge pull request #18 from breez/estimates-and-quotes
estimates vs quotes
This commit is contained in:
102
FLS01/README.md
102
FLS01/README.md
@@ -30,7 +30,7 @@ Steps:
|
||||
1) service needs to provide a quote for the user
|
||||
2) user confirms the order
|
||||
3) service provides payment methods
|
||||
4) user needs to transfer fiat to the service (within specific amount of time?)
|
||||
4) user needs to transfer fiat to the service
|
||||
5) user withdraws the proceeds (amount based on agreed quote)
|
||||
|
||||
#### User wants to spend X amount of fiat
|
||||
@@ -40,7 +40,7 @@ Steps:
|
||||
2) user confirms the order
|
||||
3) service provides payment methods
|
||||
4) user needs to transfer fiat to the service
|
||||
5) user withdraws the proceeds (amount based on execution at the time)
|
||||
5) user withdraws the proceeds
|
||||
### Withdrawal
|
||||
Service provides [lnurlw](https://github.com/lnurl/luds/blob/luds/03.md) to the user that user can claim at their convenience. Control of the payout is enforcable so only the pubkey who previously signed the wallet ownership verification message can be the recipient of the funds.
|
||||
|
||||
@@ -54,6 +54,9 @@ Alternative options:
|
||||
2) user provides pubkey and provider opens a channel and pushes the amount (can be used as a backup for 1.)
|
||||
|
||||
|
||||
### Units
|
||||
All units in the spec are expressed in the smallest denomination - sats and cents.
|
||||
|
||||
## API endpoints draft
|
||||
|
||||
| Name | function | status | type |
|
||||
@@ -67,6 +70,7 @@ Alternative options:
|
||||
| /payout | get payout options | optional | GET |
|
||||
| /payment-options | get supported payment options and currencies | required | GET |
|
||||
|
||||
|
||||
### verify
|
||||
Request a token to be signed by the reciever node as proof of ownership
|
||||
|
||||
@@ -123,19 +127,29 @@ Get a an quote or estimate from the provider based on amount of fiat you want to
|
||||
|
||||
Request:
|
||||
```
|
||||
POST /quote
|
||||
# client wants to spend 1000chf
|
||||
POST /quote
|
||||
|
||||
{
|
||||
"session_id": "d7ef9a88-1ca1-4ac8-bc9e-da3d9824cdc5",
|
||||
"amount_fiat": 1000,
|
||||
"amount_fiat": 100000, # in cents
|
||||
"currency_id":1,
|
||||
"payment_option_id":1
|
||||
}
|
||||
|
||||
# client wants to purchase 0.005btc
|
||||
POST /quote
|
||||
|
||||
{
|
||||
"session_id": "d7ef9a88-1ca1-4ac8-bc9e-da3d9824cdc5",
|
||||
"amount_btc": 5000000 # in sats
|
||||
"currency_id":1,
|
||||
"payment_option_id":1
|
||||
}
|
||||
```
|
||||
|
||||
- `amount_fiat` what the client wants to spend
|
||||
- must be greater than 0 and less than 1000
|
||||
- `amount_fiat` (optional) amount of fiat the client wants to spend (unit cents)
|
||||
- `amount_sats` (optional) amount of bitcoin the client wants to purchase (unit sats)
|
||||
- `currency_id` is the fiat currency the client wants to be quoted in and will be used as payment
|
||||
- must one of the supported currencies from `/payment-options`
|
||||
- `payment_option_id` needs to be one of `/payment-options` and needs to be provided at this step for the fee calculation
|
||||
@@ -145,15 +159,28 @@ Response:
|
||||
```
|
||||
{
|
||||
"quote_id": "8ed13c2a-a8c6-4f0e-b43e-3fdbf1f094a6",
|
||||
"amount_fiat": "1000",
|
||||
"amount_fiat": 100000, # in cents
|
||||
"currency_id": 1,
|
||||
"payment_option_id":1,
|
||||
"amount_sats" : 800000 ,
|
||||
"amount_sats" : 800000, # in sats
|
||||
"is_estimate" : false,
|
||||
"btc_price": 6942000, # in cents
|
||||
"order_fee": 1234, # in cents
|
||||
"expires_on": "2023-09-20T00:25:11.123Z"
|
||||
}
|
||||
```
|
||||
- `amount_sats` the amount of bitcoin the client will return for the fiat amount specified in the quote
|
||||
- `expires_on` until when the order needs to arrive for the quote to be honored
|
||||
`quote_id` id of this quote which needs to be referenced while placing the order
|
||||
|
||||
`amount_sats` the amount of bitcoin the client will return for the fiat amount specified in the quote (unit sats)
|
||||
|
||||
`is_estimate` can be `true` or `false`,at discretion of the provider if he wants to provide a short duration binding quote or estimate
|
||||
|
||||
`order_fee` fee taken by the provider for quotes and estimates, in fiat (unit cents)
|
||||
|
||||
`btc_price` quoted or estimated price (unit cents)
|
||||
|
||||
`expires_on` (optional) until when the payment for order needs to arrive for the quote to be honored
|
||||
|
||||
### order
|
||||
Confirm an order from quote and get payment information in return
|
||||
|
||||
@@ -175,10 +202,10 @@ Response:
|
||||
{
|
||||
"order_id": "8ed13c2a-a8c6-4f0e-b43e-3fdbf1f094a6",
|
||||
"order_status": "placed"
|
||||
"amount_fiat": "1000",
|
||||
"amount_fiat": 100000, # in cents
|
||||
"currency_id": 1,
|
||||
"payment_option_id":1,
|
||||
"amount_sats" : 800000 ,
|
||||
"amount_sats" : 800000, # in sats
|
||||
"expires_on": "2023-09-20T00:25:11.123Z",
|
||||
"payment_info": {
|
||||
"
|
||||
@@ -248,19 +275,23 @@ Response:
|
||||
```
|
||||
{
|
||||
"order_id": "8ed13c2a-a8c6-4f0e-b43e-3fdbf1f094a6": {
|
||||
"amount_fiat": "1000",
|
||||
"amount_fiat": 100000, # in cents
|
||||
"currency_id": 1,
|
||||
"payment_option_id":1,
|
||||
"amount_sats" : 800000 ,
|
||||
"order_status": "finished"
|
||||
"amount_sats" : 800000, # in sats
|
||||
"btc_price": 6942000, # in cents
|
||||
"order_fee": 1234, # in cents
|
||||
"order_status": "finished",
|
||||
"order_status_date": "2023-09-20T00:25:11.123Z"
|
||||
},
|
||||
"order_id": "8ed13c2a-a8c6-4f0e-b43e-3fdbf1f0333a": {
|
||||
"amount_fiat": "1000",
|
||||
"amount_fiat": 100000, # in cents
|
||||
"currency_id": 1,
|
||||
"payment_option_id":1,
|
||||
"amount_sats" : 800000 ,
|
||||
"order_status": "finished"
|
||||
"amount_sats" : 800000, # in sats
|
||||
"btc_price": 6942000, # in cents
|
||||
"order_fee": 1234, # in cents
|
||||
"order_status": "finished",
|
||||
"order_status_date": "2023-09-20T00:25:11.123Z"
|
||||
},
|
||||
}
|
||||
@@ -274,6 +305,7 @@ Response:
|
||||
4) `refunded` - status when fiat payment was refunded
|
||||
|
||||
`order_status_date` datetime of when the status was made
|
||||
`order_fee` fee taken by the provider on the order
|
||||
|
||||
### withdrawal
|
||||
Request lnurlw from the provider. User can provide optional fallback onchain address which will be used if the withdrawal is not claimed before the expiration date.
|
||||
@@ -334,23 +366,23 @@ If no currency_code is specified in request:
|
||||
"option": "SEPA",
|
||||
"id": 1,
|
||||
"fee_rate": 0.005,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 1000, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
},
|
||||
{
|
||||
"option": "SEPA Instant",
|
||||
"id": 2,
|
||||
"fee_rate": 0.01,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 1000, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
|
||||
},
|
||||
{
|
||||
"option": "Credit card",
|
||||
"id": 3,
|
||||
"fee_rate": 0.05,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 2500, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -363,16 +395,16 @@ If no currency_code is specified in request:
|
||||
{
|
||||
"option": "Bank transfer",
|
||||
"id": 5,
|
||||
"fee_rate": 0.01,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"fee_rate": 0.01,
|
||||
"min_amount": 10, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
},
|
||||
{
|
||||
"option": "Credit card",
|
||||
"id": 6,
|
||||
"fee_rate": 0.05,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 10, #unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
|
||||
}
|
||||
]
|
||||
@@ -397,22 +429,22 @@ If currency_code (in this case EUR) is specified in request:
|
||||
"option": "Revolut",
|
||||
"id": 1,
|
||||
"fee_rate": 0.01,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 1000, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
},
|
||||
{
|
||||
"option": "Sepa Instant",
|
||||
"id": 2,
|
||||
"fee_rate": 0.01,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 1000, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
},
|
||||
{
|
||||
"option": "Credit card",
|
||||
"id": 3,
|
||||
"fee_rate": 0.01,
|
||||
"min_amount": 10,
|
||||
"max_amount": 1000
|
||||
"min_amount": 1000, # unit cents
|
||||
"max_amount": 100000 # unit cents
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user