---
title: "Comment by Kartik N V J K on \"Letting visitors try my AI video generator without an account, without going broke\" | Hashnode"
description: "Spending the allowance before the provider call, and setting the refunded flag in the same D1 batch as the refund itself, is how I'd build it too. I couldn't wo"
url: "https://hashnode.com/posts/letting-visitors-try-my-ai-video-generator-without-an-account-without-going-broke/6ae08be1fe019808d44cf5b8/comment/6ae1feb23cbb4b197b976363"
---

[Discussion](https://hashnode.com/posts/letting-visitors-try-my-ai-video-generator-without-an-account-without-going-broke/6ae08be1fe019808d44cf5b8)

Comment [Letting visitors try my AI video generator without an account, without going broke](https://hashnode.com/posts/letting-visitors-try-my-ai-video-generator-without-an-account-without-going-broke/6ae08be1fe019808d44cf5b8)

[Kartik N V J K](https://hashnode.com/@kartik-nvj)

[Oct 28](https://hashnode.com/posts/letting-visitors-try-my-ai-video-generator-without-an-account-without-going-broke/6ae08be1fe019808d44cf5b8/comment/6ae1feb23cbb4b197b976363)

Spending the allowance before the provider call, and setting the refunded flag in the same D1 batch as the refund itself, is how I'd build it too. I couldn't work out one case from the post. When a job stuck in processing gets closed out on the guest's next try, is that an unknown outcome with no refund, or do you check with the provider first?

[Milos Tu](https://hashnode.com/@milostu)

[Nov 5](https://hashnode.com/posts/letting-visitors-try-my-ai-video-generator-without-an-account-without-going-broke/6ae08be1fe019808d44cf5b8/comment/6ae1feb23cbb4b197b976363#reply-6aec3d3c369b0451fc7b78c8)

Good catch, the post skipped that. It doesn't check with the provider first. When the guest tries again, a job that's been stuck for a few minutes gets closed as failed. If the provider never gave me a task ID, nothing ran, so the allowance goes back. If it did, the allowance stays spent, because otherwise closing the tab would earn a free extra try.

The weak spot is a job that really did fail at the provider while the tab was closed: that guest loses the try. One status check before closing would fix that. I already ask the provider first on the paid video path, so I should do the same here. It hasn't come up in production yet, but it's the fairer design.
