Base44 payment succeeded, but the customer was not upgraded

Updated · by Zane

Why a successful payment does not upgrade anyone

Paying and upgrading are two separate steps. The payment happens on Stripe's page. Your app only changes the customer's access if something writes to your Base44 data afterwards, such as setting a status field to paid.

Base44's documentation describes two ways that write can happen. The first is the success page: after checkout, the page checks the payment and updates the account while the customer is still logged in. The second is a webhook, which is a request Stripe sends to a URL of your app whenever a payment event happens. Base44's own guide says to confirm payment on the success page instead of relying on webhooks alone.

Know which one your app uses before you start. Ask the Base44 chat: "After a Stripe payment, which code updates the customer's access, and where is it?"

Paying and upgrading are two steps: after Stripe takes the payment, something in the app, the success page or a webhook, has to write the new status to your Base44 data. The delivery status Stripe shows for the webhook (no endpoint, 400, 404 or 500, 401 or 403, or 200) tells you which case you are in.

Step 1: look at the payment in Stripe

  1. Open the Stripe Dashboard and check that the test/live switch matches the payment you are chasing.
  2. Open Payments and find the charge. Click it and note the customer email.
  3. Open Workbench, then Webhooks. If the list is empty, you are in case 1 below. If an endpoint exists, open it and go to the Event deliveries tab.

Event deliveries lists each event as Delivered, Pending or Failed. Click one to see the HTTP status code your function answered with. That code decides which case you are in.

Case 1: no webhook, and the success page never ran

If Stripe has no endpoint, nothing tells your backend about the payment. The upgrade then depends only on the success page. That page runs only if the customer lands on it and is logged in. Base44's troubleshooting notes list the same cause for blank or broken pages after payment: success and cancel URLs that point somewhere other than your published domain, and a success page that is not reachable for signed-in users.

  • Test on the published app. Base44 says checkout only runs on the published app, not the editor preview.
  • Make sure the success URL is your published domain and the page loads for a logged-in customer.
  • Decide whether to add a webhook for customers who pay and close the tab. If you do, ask the Base44 chat to build the webhook function, then register its URL in Stripe.

Case 2: the webhook shows Failed, with a 4xx or 5xx code

Open the function in Base44 under Dashboard, then Code, then Functions. Select it and scroll to Logs. Read the red lines first and match them to the status in Stripe.

A 400 and a signature error

The function rejected the request. The usual causes are the wrong signing secret, test and live secrets swapped, or code that turns the body into JSON before checking the signature. Stripe needs the raw body for the check. The full fix is in Stripe webhook signature verification failed.

A 404 or a 500

Base44's troubleshooting page says a 500 on a webhook POST usually means the URL is wrong, and recommends using the app's default Base44 link as the base URL, even if you have a custom domain. The function URL has the form https://<your-app-domain>/functions/<function-name>. Compare it character by character with the endpoint URL saved in Stripe.

A 401 or 403

A webhook call has no logged-in user. If the function requires one, it will refuse Stripe. I could not find a Base44 setting described for this, so if you see 401 or 403, paste the Stripe response and the function code into the Base44 chat and ask whether the function allows calls from outside.

Case 3: the webhook shows Delivered, but the user is not upgraded

The function answered 200 and the data still did not change. Base44's documentation points to two causes.

  • No user, so no permission. Direct HTTP calls such as webhooks have no authenticated user context. To read or write data without the entity's access rules applying, Base44 says to use asServiceRole. Code that runs as an ordinary user can be blocked by those rules.
  • The wrong record, or none. The webhook has to find the right customer. The safest way is to pass your own record id as client_reference_id when the Checkout Session is created. Stripe describes it as a way to reconcile the session with your internal systems. Matching on email alone breaks when the customer pays with a different address.

Also check which events your endpoint is subscribed to. checkout.session.completed fires when a Checkout payment completes. Subscription renewals and cancellations arrive as other events, such as invoice.paid and customer.subscription.deleted. An endpoint subscribed to the wrong event never triggers your update.

Here is the shape of a working handler. It is a sketch, not Base44 output: the entity name is invented, and your field names will differ. I could not confirm from Base44's docs that a backend function may update the built-in User record for another person, so this writes to your own entity instead.

Webhook function sketch
import Stripe from "npm:stripe";
import { createClientFromRequest } from "npm:@base44/sdk";
import { secrets } from "base44:runtime";

// Sketch only. Base44's docs do not ship a Stripe webhook example,
// so check the names against the Base44 SDK reference before using it.
export default async function (req: Request): Promise<Response> {
  const stripe = new Stripe(secrets.get("STRIPE_SECRET_KEY")!);
  const body = await req.text(); // raw text, not req.json()

  let event: Stripe.Event;
  try {
    event = await stripe.webhooks.constructEventAsync(
      body,
      req.headers.get("Stripe-Signature")!,
      secrets.get("STRIPE_WEBHOOK_SECRET")!,
    );
  } catch {
    return new Response("bad signature", { status: 400 });
  }

  if (event.type === "checkout.session.completed") {
    const session = event.data.object as Stripe.Checkout.Session;
    // The id of YOUR record, set as client_reference_id when checkout was created
    const recordId = session.client_reference_id;
    if (!recordId) return new Response("missing reference", { status: 400 });

    const base44 = createClientFromRequest(req);
    // A webhook has no logged-in user, so write with the service role
    await base44.asServiceRole.entities.Subscription.update(recordId, {
      status: "active",
      stripe_customer_id: session.customer as string,
    });
  }
  return Response.json({ received: true });
}

Return a 2xx response quickly. Stripe's guidance is to send the success status before slow work.

Test the fix

  1. Stay in Stripe test mode. Base44 gives you a test card under Dashboard, then Integrations, then Stripe, using Try a test payment.
  2. Pay on the published app, not the preview.
  3. In Stripe, confirm the event shows a 200 response.
  4. In the Base44 data view, confirm the record changed.
  5. Log in as that customer and confirm the paid screen appears.

Customers who already paid

Stripe retries failed deliveries for up to three days in live mode. Test-mode events are retried three times over a few hours. After the fix, open an older failed event and click Resend. Stripe says this works for up to 15 days after the event was created. Past that, set the status by hand in your data view.

Related

The general version of this problem, with Supabase-based apps, is Stripe payment succeeded but the user is still on the Free plan. The ideas carry over, though Base44 has its own backend instead of Supabase.

FAQ

Can I upgrade the user from the success page instead of a webhook?

For a first version, yes, and Base44's own payments guide leans that way: it says the success page should verify the payment and update the account while the user is still logged in. The weak spot is a customer who pays and closes the tab before the success page loads. A webhook covers that case. Whichever you use, confirm the payment with Stripe, never from the URL alone.

Does the Base44 Stripe setup create a webhook for me?

Base44's Stripe documentation does not describe webhook setup, and it only says that if you use webhooks, the URL must be correct and the endpoint deployed and responding. So treat any webhook as something your app has to add through a backend function, and check Stripe's webhook list to see whether one exists.

Why does it work in test mode but not for real customers?

Test and live mode are separate in Stripe. Each has its own webhook endpoint and its own whsec_ signing secret. A common gap is that the endpoint and secret exist only for test mode, so live events go nowhere or fail the signature check.

Do customers who already paid need refunds?

Usually not. Once the cause is fixed, resend the failed events from Stripe, or set the status by hand for older ones. They get what they paid for.

Checklist

Still stuck?

Send me the app link and what's broken. The first look is free and you get a fixed quote before I touch anything.

Related guides