Overview
The purpose of this document is to describe changes being made to the Registration Site to accommodate the dApp.
API
Get pricing
This call is intended to return current pricing of FIO Addresses and Domains based on Wallet Profile provided.
GET /get-pricing/{referralCode}
Request
Parameter | Format | Required | Description |
---|---|---|---|
referralCode | String | Yes | Wallet profile referral code |
Response
Group | Parameter | Format | Required | Description |
---|---|---|---|---|
success | boolean | Yes | true if successful | |
pricing->fio | domain | Int | No | FIO Domain price in SUFs. Only returned if FIO Domain registration is enabled and “Price according to rate of exchange” is checked in wallet profile. |
pricing->fio | address | Int | No | FIO Address price in SUFs. Only returned if FIO Address registration is enabled and “Price according to rate of exchange” is checked in wallet profile. |
pricing->usdt | domain | Double | No | FIO Domain price in USDT. Only returned if FIO Domain registration is enabled in wallet profile. |
pricing->usdt | address | Double | No | FIO Domain price in USDT. Only returned if FIO Address registration is enabled in wallet profile. |
Example
{ "success": true "pricing" : { fio: { "domain": 400000000000, "address": 20000000000 }, usdt: { "domain": 40.00, "address": 2.00 }, error: false }
Buy FIO Tokens
If a wallet wants to implement it’s own registration of FIO Domains and Addresses, e.g. to accommodate shopping cart or registrations on a private domain, they will be able to purchase enough FIO Tokens to purchase specific number of FIO Addresses or FIO Domains. Using this method, as opposed to purchasing a specific amount of FIO Tokens is preferred as the Registration site will adjust the amount of tokens to be sufficient for the fees, in case there is a fee change between a quote and processing of crypto payment.
Upon payment, the Registration site will transfer FIO Tokens to publicKey
and notify webhook
POST /buy-fio-tokens
Request
Parameter | Format | Required | Description |
---|---|---|---|
referralCode | String | Yes | Wallet profile referral code |
domainRegistrations | Int | Yes | Number of FIO Domain registrations |
addressRegistrations | Int | Yes | Number of FIO Address registrations |
publicKey | String | Yes | FIO public key for the ownership of the FIO Tokens |
redirectUrl | String | No | This url will be shown to users upon redirection from Coinbase payment screen. Irrelevant if you are showing payment screens inside app. |
apiToken | String | Yes | API Token configured in Wallet Profile |
webHook | String | No | Webhook which needs to be notified when payment is processed |
Example
{ "referralCode": "fio", "domainRegistrations": 0, "addressRegistrations": 5, "publicKey": "FIO86zM5iJAdsEgF3ggWJDM4SGgTFBVpx63cuBM4SxBEvBFewNyrv", "apiToken": "", "webHook": "https://www/example.com/webhook" }
Response
Same as https://developers.fioprotocol.io/pages/api/fio-reg-api/#post-/buy-address
Processing
Validate
Parameters as in https://developers.fioprotocol.io/pages/api/fio-reg-api/#post-/buy-address
Check if “Allow FIO Token Purchases” in wallet profile is not checked
Return
success
: false anderror
: “Not allowed for this referralCode.”
Ignore
domainRegistrations
andaddressRegistrations
are not validated against wallet profile, meaning this call will work even if domain sale or address sale is disabled.
Once request is received:
Once payment is received:
FIO Tokens required is re-computed (see above)
If payment was received within 60 minutes of request and amount is +/- 10%
The amount of FIO is adjusted to new number
Status is set to Success
Else
The amount of FIO is not adjusted to new number
Status is set to PriceChange
Tokens are transferred
Webhook fires
Webhook payload
Parameter | Format | Required | Description |
---|---|---|---|
extern_id | String | Yes | Coinbase order ID |
publicKey | String | Yes | FIO public key for the ownership of the FIO Tokens |
amount | Int | Yes | Amount of FIO Tokens in SUFs being transferred |
status | boolean | Yes | Success or PriceChange |
Wallet Profile
Add “Allow FIO Token Purchases” check box. If selected:
That wallet profile will enable Buy FIO Tokens
FIO Address/Domain pricing is reset and “Price according to rate of exchange” is checked.
If user attempts to enter price or uncheck the “Price according to rate of exchange” box, “Allow FIO Token Purchases” is unchecked.