adjust stripe checkout experience

This commit is contained in:
MarconLP 2023-07-13 14:05:28 +02:00
parent ce4911049e
commit f762c04140
No known key found for this signature in database
GPG key ID: A08A9C8B623F5EA5
2 changed files with 32 additions and 5 deletions

View file

@ -80,7 +80,7 @@ const VideoList: NextPage = () => {
}, [closeQueryParam]);
useEffect(() => {
if (checkoutCanceledQueryParam === "false" && closeQueryParam === "false") {
if (checkoutCanceledQueryParam && closeQueryParam === "false") {
setTimeout(() => {
void router.push("/videos").then(() => router.reload());
}, 5000);
@ -152,9 +152,34 @@ const VideoList: NextPage = () => {
)}
</div>
) : (
<span className="text-lg font-semibold text-zinc-700">
You can now close this window
</span>
<div className="flex flex-col">
{checkoutCanceledQueryParam === "true" ? (
<>
<span className="text-lg font-semibold text-zinc-700">
Purchase cancelled
</span>
{closeQueryParam === "true" ? (
<span className="mt-1 text-base text-zinc-500">
You can now close this window
</span>
) : (
<span className="mt-1 text-base text-zinc-500">
You will be redirected shortly
</span>
)}
</>
) : (
<>
<span className="text-lg font-semibold text-zinc-700">
Successfully logged in
</span>
<span className="mt-1 text-base text-zinc-500">
You can now close this window and try to upload the
video again!
</span>
</>
)}
</div>
)}
</>
) : (

View file

@ -50,7 +50,9 @@ export const stripeRouter = createTRPCRouter({
success_url: input.recordModalOpen
? `${baseUrl}/videos?checkoutCanceled=false&close=true`
: `${baseUrl}/videos?checkoutCanceled=false&close=false`,
cancel_url: `${baseUrl}/videos?checkoutCanceled=true`,
cancel_url: input.recordModalOpen
? `${baseUrl}/videos?checkoutCanceled=true&close=true`
: `${baseUrl}/videos?checkoutCanceled=true&close=false`,
subscription_data: {
trial_settings: {
end_behavior: {