fexed stripe webhook
This commit is contained in:
parent
4421acd052
commit
ca019ae28d
1 changed files with 11 additions and 4 deletions
|
|
@ -350,14 +350,21 @@ export const SubscriptionTab: React.FC<SubscriptionTabProps> = ({ mandateId }) =
|
|||
|
||||
if (sessionId && !verifyCalledRef.current) {
|
||||
verifyCalledRef.current = true;
|
||||
verifyCheckout(sessionId)
|
||||
.then((result) => {
|
||||
const _pollUntilActive = async (retries = 5, delayMs = 2000) => {
|
||||
try {
|
||||
const result = await verifyCheckout(sessionId);
|
||||
if (result.status === 'activated') {
|
||||
setCheckoutMessage({ type: 'success', text: 'Abonnement wurde aktiviert.' });
|
||||
setJustPaid(false);
|
||||
return;
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
} catch { /* handled below via retry */ }
|
||||
if (retries > 0) {
|
||||
await new Promise(r => setTimeout(r, delayMs));
|
||||
await _pollUntilActive(retries - 1, delayMs);
|
||||
}
|
||||
};
|
||||
_pollUntilActive();
|
||||
}
|
||||
} else if (params.get('canceled') === 'true') {
|
||||
setCheckoutMessage({ type: 'info', text: 'Checkout abgebrochen. Ihr bestehendes Abonnement bleibt aktiv.' });
|
||||
|
|
|
|||
Loading…
Reference in a new issue