Terminal Payments
Create connection token
Creates a short-lived Stripe Terminal SDK connection token.
Pass the returned secret to the Stripe Terminal SDK’s fetchToken callback to initialize a terminal session. Tokens are single-use and short-lived — always request a fresh token; never cache.
If no payment-account relationship is provided, the organization’s default payment account is used. Optionally scope the token to a specific location via the location relationship.
SDK initialization example (Dart):
await StripeTerminal.instance.initialize(
fetchToken: () async {
final res = await dio.post('/api/v1/connection-tokens', data: {
'data': {'type': 'connection-tokens', 'attributes': {}},
});
return res.data['data']['attributes']['secret'];
},
);