Skip to main content

JS SDK Overview

JS SDK

JS Initialization

After receiving your API keys, you need to initialize the Paystar JS SDK on your website.

<script>
!(function () {
var n = (window.Paystar = window.Paystar || []);
if (!n.x) {
(n.x = !0),
(n.m = [
"initialize",
"collectPaymentSource",
"completePayment",
"subscribe",
]),
(n.f = function (t) {
return function () {
var e = Array.prototype.slice.call(arguments);
e.unshift(t), n.push(e), n;
};
});
}
for (var o = 0; o < n.m.length; o++) {
var c = n.m[o];
n[c] = n.f(c);
}
(n.load = function (t, e) {
var a = document.createElement("script");
(a.type = "text/javascript"),
(a.async = !0),
(a.src = "https://js.paystar.io/embedded.loader.js");
var r = document.getElementsByTagName("script")[0];
r.parentNode.insertBefore(a, r), (n._loadOptions = e);
}),
(n.SNIPPET_VERSION = "0.1.0");
})();

Paystar.initialize("YOUR_PUBLIC_CLIENT_IDENTIFIER");
Paystar.load();
</script>

In the Paystar.initialize method, replace YOUR_PUBLIC_CLIENT_IDENTIFIER with the API key you received during account setup. This initialization script will load the Paystar SDK onto your webpage, enabling it to interact with Paystar's services.

After successfully setting up your account and initializing the SDK, you can use Paystar's services to initiate payments, check payment status, manage wallets (customer driven), and enroll in autopay (customer driven).

JS Methods

Initiate Payment Session (Payment Session Flow)

Start Flow (All other flows)

API Overview

TODO: OpenAPI Spec Here