Guides
Drop-in payment button
The simplest possible checkout: an HTML form on your page POSTs to your server, your server creates the Trevi payment, then redirects the customer to the hosted payment URL.
Never call POST /pay/create directly from the browser — your API key would be exposed. Always proxy through your own server-side handler.
After the customer pays, Trevi redirects them to redirect_url (passed at create time) and POSTs the final state to callback_url. Use the callback to flip your order state; the redirect is just UX.
Example
# This is a recipe, not a single curl. See the language tabs.Was this page helpful?
