Embedding SDK for the subscription payment widget
GET /Cards/Sbp/embed.js
The same file as on the payment domain: the mode follows the URL it was loaded
from. In this flow mount() takes only token — there is no invoice here, the
subscription session is addressed instead. methods narrows the server set of
payment methods (the server order is kept; an empty intersection keeps the whole
set and calls onError with code: 'method_unavailable'), webview marks the shop
app WebView. The subscription SDK does not pass lang.
<div id="bind"></div>
<script src="https://subs-sandbox.digitalspb.com/Cards/Sbp/embed.js"></script>
<script>
SbpWidget.mount('#bind', {
token: '8c0c8870d6fb4ee8a995ae183a44b928', // the AuthorizeUrl tail from CreateSubscription
brand: { name: 'Warm Corner', primary: '#c2410c' },
onSuccess: function () { location.href = '/subscribed'; },
onExpired: function () {},
onError: function (e) {}
});
</script>⚠️ onSuccess means the initial step succeeded: the first-period payment with
a binding for recurring charges or, when the first payment is deferred, an SBP
binding without a charge. The browser event does not replace
the server notifications; onExpired, onError and closing the widget do not prove
that no money was taken.