Developers
Add the Pay with uCrypto button
One script tag on your checkout page draws a "Pay with uCrypto" button. When the customer presses it, they go to the uCrypto page where they confirm the payment.
1. Create a redemption intent on your server
Call POST /v1/redemption_intents with your API key, as in the
quick start. The intent carries the amount, the token unit,
your order reference and your return address. Never create intents in the browser: your
API key must stay on your server.
2. Put the tag on your checkout page
Put this tag where the button should appear, with the intent's id:
<script src="https://ucrypto.co/embed/pay-button.js" data-intent="INTENT_ID"></script>
3. That is all
The button opens /pay/INTENT_ID on the same address the script came from.
Make a new intent, and a new tag, for each checkout: an intent can be paid only once.
Good to know
-
The amount comes only from the intent. The script reads just
data-intent; any other attribute, such as an amount, is ignored. -
If
data-intentis missing or is not an intent id, no button is drawn and the script writes an error to the browser console. - Put the button on a page open in the browser window itself, not inside an iframe: the payment page refuses to open in a frame.
-
If your page has a Content-Security-Policy, add
https://ucrypto.cotoscript-src. Nostyle-srcchange is needed.