...
Create Order as Pending
Auto-generate order ID (6 alphanumeric, e.g. ABC123)
Create
PaymentIntent
with StripeAPI keys to be provided offline
amount
- total amount of order in USDCcurrency: 'usd'
automatic_payment_methods: {enabled: true}
Trigger stripe.confirmPayment
return_url
- url of confirmation page
Await Webhook notification. See https://stripe.com/docs/webhooks
Payload spec: https://stripe.com/docs/api/events/object
Action based on status
canceled
Update Order as Cancelled and display https://fioprotocol.atlassian.net/wiki/spaces/DAO/pages/500793345/Dashboard+Checkout#Cancelled
requires_payment_method
Update Order as Declined and display https://fioprotocol.atlassian.net/wiki/spaces/DAO/pages/500793345/Checkout#Purchase-Error-or-Declined
payment_intent.succeeded
Create Payment for amount received
Create Payment for amount of order
Execute on-chain action
On success
Update Order as Success
Display https://fioprotocol.atlassian.net/wiki/spaces/DAO/pages/500793345/Dashboard+Checkout#Success.1
On complete Purchase Error
Create Payment for amount of order back to User
Refund amount collected using https://stripe.com/docs/refunds#issuing
Create Payment for amount refunded
Update Order as Purchase Error
On Partial Success
Create Payment for amount of failed items back to User
Refund amount collected for items which failed usinghttps://stripe.com/docs/refunds#issuing
Create Payment for amount refunded
Any other status
Handling price changes
Preserve FIO pricing and USDC pricing for cart
When payment is received compare total price of cart when saved to what it is at the time when payment notification is received
If price deviation is +/- 25% from saved price do not alter pricing and execute transaction
If price deviation is more than +/- 25% refund the purchase amount to the user and update Order as Purchase Error
Registering
...
Handles on private
...
domains AND not paid with FIO
If cart contains a FCH on a domain owned by the user check domain status (private/public)domain (meaning the domain is not yet registered) and a single handle(s) on that domain:
The registration should be performed using the /register_fio_domain_address call.
If cart contains multiple handles on a new domain or 1 or more handle on an existing private domain:
If owner wallet is a Ledger Wallet registration of FCH on private domain is not allowed
Display error: “At this moment registration of FIO
Handles on private domains
If the FCH being registered is on a private domain (domain registered in the same transaction will be private):
secured by Ledger device are only supported when paid for using FIO Tokens.”
Have the user sign a transaction registering that FCH using pay with FIO functionality (PIN code will be required immediately after they click Purchase)
Set the
max_fee
parameter to 125% of fee obtained from get_fee forregister_fio_address
Once payment is received (e.g. webhook notification from Stripe received):
If domain is being registered in the same purchase, register it first
If registration fails, automatically fail FCH registrations on that domain
Wait at least 5 seconds between registering the domain and first handle on that domain
Re-check current
register_fio_address
feeIf just obtained
register_fio_address
is more than the fee signed by user in the step above fail FCH registration
Send FIO Tokens to user in the amount of just obtained
register_fio_address
If transaction fails with
Insufficient funds to cover fee
:re-check current
register_fio_address
feeSend users the difference between new fee and number of tokens they received
Resubmit the transaction with higher fee
...
On-chain execution of cart items
Item | On-chain call |
---|---|
Register FIO Address | |
Register FIO Domain | |
Renew FIO Domain | |
Add bundles to FIO Address |