...
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 register_fio_domain and/or register_fio_address for every item in cart using designated account
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% reprice send FIO to User’s account at new rate of exchangerefund the purchase amount to the user and update Order as Purchase Error
Registering FCHs on private domain when not paid with FIO
...