Skip to main content

Order tracking

After displaying the provider buy widget to the user, MetaMask tracks the associated order.

important

If an order has been placed, the widget should only execute the redirection URL when the /orders/{orderId} endpoint is ready to return information. If a call to the endpoint says the order doesn't exist, MetaMask dismisses it and never shows it to the user. The provider is responsible for waiting for the endpoint readiness before performing the redirection. This redirection must happen automatically without requiring user action

If no order is placed, nothing happens and the user returns to MetaMask.

If an order is placed, MetaMask keeps refreshing its status and information until it reaches one of the following final states:

  • CREATED - Only to be used with the off-ramp flow. Once a user finishes off-ramping with the provider widget an order must be in this state when auto-redirecting back to MetaMask. This signifies the order is awaiting the user to send crypto to the off-ramp deposit wallet.
  • PENDING - This is the first visible status on the UI. It means the user has completed all actions and is about to be redirected back to MetaMask automatically. Once redirection occurs an order must at least be in this status if not one of the following.
  • COMPLETED - The purchase is successful.
  • FAILED - The purchase can't be finalized due to an error.
  • CANCELLED - The order is manually cancelled by the user or provider.
important

MetaMask keeps refreshing the order until it reaches a final state. The provider is responsible for detecting and handling orders stuck in a PENDING state. If the order is in the CREATED state polling will only occur when the user loads/refreshed the page/app.

MetaMask On-Ramp Order Tracking