Verify a restricted checkout for the same holder who logged in.
A restricted basket contains alcohol and must be verified without reusable age flags.
import {
createCheckoutVerification,
pollCheckoutVerification,
} from '@union-networks/verification';
const checkout = await createCheckoutVerification(
{
serviceId: 'example-shop',
assertionJws,
requiredChecks: ['age_over_18'],
restrictedResourceIds: ['wine-001'],
ttlSeconds: 120,
},
{ issuerBaseUrl: 'https://issuer.egress.live' },
);
if (checkout.requiresVerification && checkout.verification) {
renderQr(checkout.verification.qrPayload);
const finalCheckout = await pollCheckoutVerification(
{
checkoutId: checkout.checkout.checkoutId,
serviceId: 'example-shop',
assertionJws,
},
{ issuerBaseUrl: 'https://issuer.egress.live' },
);
if (finalCheckout.checkout.status !== 'completed') {
removeRestrictedItems(finalCheckout.checkout.failureReason);
}
}