patToken, hand it to the widget, and the user walks away — or your own system cancels the order a minute later. The token stays valid until whatever exp you signed it with, so without a way to revoke it the user can come back later and complete a payment you no longer want.
terminateWidgetSession ends the session server-side. The user is refused the next time they move inside the widget, and any payout attempt against that session is rejected.
Prerequisites: your application’s API Key for Basic auth, and either the operator token you issued or its
jti.Authentication
This mutation is authenticated with your application’s credentials, not a user access token — the sameBasic header you already use for generateUserAccessToken:
app_id:apiSecret pair the server checks. Use the key for the same application whose apiSecret signed the operator token.
You can only terminate sessions belonging to the application you authenticate as. A jti issued by a different application is not affected by your call — you will get a successful response with wasActive: false, and that application’s session keeps running.
Basic auth is not available to applications with PERSONAL status.
Identifying the session
Supply either the operator token or itsjti. At least one is required.
- By token (preferred)
- By jti
Pass the same
patToken you handed to the widget. It is verified against your application’s secret, so a token that is not yours is rejected outright.An already-expired token is still accepted — terminating an expired session is harmless, and it means you do not have to track expiry yourself before calling.The token’s own exp also bounds how long the termination is remembered, which is why this is the better option when you still hold it.jti is treated as an assertion about it — a jti that disagrees with the token’s own is rejected rather than silently ignored, so a mix-up cannot terminate the wrong session.
Arguments
input(TerminateWidgetSessionInput!): identifies the session to terminate.
TerminateWidgetSessionInput fields
Sample mutation
cURL example
Sample response
Response fields
wasActive: false is a success, not a failure. It is the normal answer when the user never opened the widget — which is also the safest moment to cancel. Terminating a session that was never opened is fully supported and is the recommended way to call off a payment you have already handed over.When termination is refused
Termination is idempotent — terminating an already-terminated session succeeds. It is refused in exactly two cases, each meaning the money question is already settled:
Other errors you may see:
What the user sees
Termination takes effect on the user’s next navigation or refresh inside the widget. It does not close a screen that is already rendered. When they next move, they are shown a “Session ended” message naming your application and telling them to close the window and start again from your product. If they get as far as confirming a payment, that confirmation is refused with the same message, and the payout is rejected server-side withWidgetSessionTerminated (WIDGET-005, 410).
How long a termination is remembered
A terminated session is refused for as long as it could otherwise have been used:- Terminated by token — until the token’s own
exp, and never less than one hour. - Terminated by
jtialone — for 30 days. Nothing bounds how long you may sign an operator token for, so without anexpto read the termination is kept well past any plausible session lifetime.
Next steps
Set up your server
Generate the
patToken and the jti this mutation takes.Embed the widget
Script tag, init call, button binding.
Embedded Widgets overview
How widget sessions, OAuth grants, and pre-approved transaction tokens fit together.
Idempotency
Why every money-moving call needs a unique
jti.