The document you've linked to is for the Order Status page, part of the checkout that appears after the order is made.
Since you've added the code, what's not working? What testing have you done?
I think that the code will work in the `~/checkouts/*`
No. It will run on the order status / thankyou views.
This would require the use of the Plus plan. Checkout template access isn't available for smaller plans.
If not using the Plus plan whatever you're doing will need to run on the Order Status / Thankyou page.