Your Tauri app has a “Buy” button. Where should it take the customer: a window inside the app, or their browser? And once they’ve paid, how do they get back to the app, unlocked, without copying anything by hand?
This guide builds the flow with Stripe Checkout or a Payment Link, in Tauri 2: open the checkout in the browser from Rust, register a custom scheme with the deep link plugin, receive the link on macOS, Windows and Linux, and unlock the app with a license key created by Stripe’s webhook.
The same flow works with Stripe Managed Payments, Stripe’s merchant of record, where Lemon Squeezy stores are moving: create the Checkout Session with managed_payments[enabled]=true and everything below stays the same. See Stripe Managed Payments vs Lemon Squeezy and license keys for Managed Payments.
Open the checkout in the browser, not a webview
Tauri makes it tempting to open checkout.stripe.com in a new WebviewWindow. Don’t:
- Saved payment details are in the browser. The customer’s autofill, password manager, Apple Pay, Google Pay and Link session live there. A fresh webview has none of them.
- Trust. People pay in their browser, with an address bar that shows
checkout.stripe.com. A window without one asking for a card number looks like phishing. - Bank authentication (3D Secure) can open a banking app or a popup, which a real browser handles better.
Open it with the opener plugin instead. Build the URL in Rust, so the webview can ask for a checkout but can’t choose what gets opened:
use tauri_plugin_opener::OpenerExt;
const PAYMENT_LINK: &str = "https://buy.stripe.com/test_00g5kB9xY";
#[tauri::command]
fn buy(app: tauri::AppHandle, email: Option<String>) -> Result<(), String> {
let mut url = url::Url::parse(PAYMENT_LINK).map_err(|e| e.to_string())?;
if let Some(email) = email {
url.query_pairs_mut().append_pair("prefilled_email", &email);
}
app.opener()
.open_url(url.as_str(), None::<&str>)
.map_err(|e| e.to_string())
}
url is the url crate, which Tauri already depends on: add it with cargo add url. Payment Links accept a few URL parameters, like prefilled_email and client_reference_id, to fill in what the app already knows. If your backend creates Checkout Sessions instead, pass the email as customer_email, and have the command fetch the session’s URL.
Calling openUrl from JavaScript works too, but then the capability has to allow URLs, and any script running in your webview could open them. A command with a fixed URL is a smaller surface.
Register a custom scheme
To bring the customer back, register a scheme like acmephoto://: links using it open your app, wherever they’re clicked. Add the deep link plugin:
npm run tauri add deep-link
And declare the scheme in your config, so the bundler writes it into the macOS Info.plist, the Windows registry entries of the installer, and the Linux .desktop file:
{
"plugins": {
"deep-link": {
"desktop": {
"schemes": ["acmephoto"]
}
}
}
}
Two platform details save an afternoon of debugging:
- macOS only knows the scheme from the bundled app’s
Info.plist. Deep links don’t reachtauri dev: test them with a built app in/Applications. - Windows and Linux can register the scheme at runtime, which makes it work in development. Call
register_all()insetup, in debug builds.
tauri::Builder::default()
.plugin(tauri_plugin_deep_link::init())
.setup(|app| {
#[cfg(all(debug_assertions, any(windows, target_os = "linux")))]
{
use tauri_plugin_deep_link::DeepLinkExt;
app.deep_link().register_all()?;
}
Ok(())
})
Receive the link on every OS
Each system delivers the link differently:
- macOS sends it to the running app, or launches the app and then sends it.
- Windows and Linux start a second instance of your app, with the URL in its command line arguments.
The second case needs the single instance plugin, with its deep-link feature, so the new instance hands the URL to the running one and quits:
[dependencies]
tauri-plugin-single-instance = { version = "2", features = ["deep-link"] }
Register it first, before the other plugins:
use tauri::Manager;
use tauri_plugin_deep_link::DeepLinkExt;
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
if let Some(window) = app.get_webview_window("main") {
let _ = window.set_focus();
}
}))
.plugin(tauri_plugin_deep_link::init())
.plugin(tauri_plugin_opener::init())
.setup(|app| {
let handle = app.handle().clone();
app.deep_link().on_open_url(move |event| {
for url in event.urls() {
if url.scheme() == "acmephoto" && url.host_str() == Some("purchased") {
on_purchased(&handle);
}
}
});
Ok(())
})
.invoke_handler(tauri::generate_handler![buy])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
With the deep-link feature, the URL a second instance receives is passed to on_open_url in the first one, on every system. When the link is what launched the app, app.deep_link().get_current() returns it at startup.
Treat every deep link as untrusted input. Any web page can link to acmephoto://purchased, and any program can open it. Never unlock anything because a link says the customer paid: use it to bring the app forward and show the right screen, nothing more.
Come back after payment
After payment, Stripe redirects to a page on your website: set it in the Payment Link’s “After payment” settings, or as the success_url of a Checkout Session. That page thanks the customer and links back to the app:
<h1>Thanks for buying Acme Photo!</h1>
<p>Your license key is on its way to your inbox.</p>
<a href="acmephoto://purchased">Open Acme Photo</a>
Browsers ask before opening an app from a link, and some customers will close the tab first. Say on the page what to do in that case: open the app, and enter the key from the email.
Unlock the app with a license key
The payment happened at Stripe, but your app still has to learn that this customer paid, on this computer. The deep link can’t prove it, as anyone can create one. Something that can’t be forged has to:
- Stripe tells your backend about the payment with a webhook,
checkout.session.completed. - Your backend creates a license key for the customer, and emails it.
- The deep link brings the app forward, on the activation screen.
- The customer pastes the key, and the Rust core validates it with your license server.
With LicenseManager, steps 1 and 2 need no backend: connect your Stripe account, map your Stripe price to a policy, and each payment creates a license and emails its key. In the app, the deep link handler only has to show the activation screen when the app isn’t activated yet:
use tauri::Emitter;
use tauri_plugin_licensemanager::{LicenseState, LicensemanagerExt};
fn on_purchased(app: &tauri::AppHandle) {
if app.license().state() != LicenseState::Active {
let _ = app.emit("show-activation", ());
}
}
The Tauri SDK validates the key the customer enters, ties it to the computer, and keeps the app unlocked offline. How to add license keys to a Tauri app covers that side.
Handle the cases around it
- The customer closes the checkout. Nothing changed: keep the Buy button visible.
- The customer buys from your website, not the app. Same email, same key, same activation screen.
- The customer pays on their phone. The key works on any computer, up to the license’s machine limit.
- Delayed payment methods, like some bank transfers. The license is created once the payment succeeds, which can take days. Say so on the thank you page.
- A lost key. Let customers find it again by email in a self-service portal, without writing to you.
- Subscriptions. Renewals, failed payments and cancellations happen at Stripe; the license has to follow them. See Stripe subscriptions.
Wrapping up
Open Stripe in the browser from a Rust command, not in a webview. Register a scheme with the deep link plugin, use the single instance plugin so Windows and Linux route the link to the running app, and treat every link as untrusted. Unlock the app with a license key created from Stripe’s webhook, never with the link itself.
For everything around the checkout, from pricing to signing, see how to sell a Tauri app. The Electron version of this guide is Stripe Checkout in an Electron app, and the Paddle one is Paddle Checkout in a Tauri app.



