How to use AJAX API to display purchase options in the purchase flow?

Hello everyone. I was wondering how can I use the AJAX API in general. Do I use it in a script tag, app blocks, or somewhere else?

I want to display purchase options in the purchase flow like the instructions about building deferred purchase options: https://shopify.dev/apps/purchase-options/deferred/modeling#building-deferred-purchase-options-in-your-app

I know this might be a newbie question but I couldn’t find anything in the docs that explain this. I would be really appreciated it if anyone can answer.

You can follow the docs here to see its use cases: https://shopify.dev/api/ajax