calcom/cal.diy · error · NotFoundException

Payment with uid ${uid} not found

Error message

Payment with uid ${uid} not found

What it means

Thrown by EventTypesAtomService.getUserPaymentInfo when atomsRepository.getRawPayment returns null for the given uid. The rawPayment query joins the payment table on uid; if no payment record exists with that uid, the entire payment-info response cannot be constructed and NotFoundException (HTTP 404) is thrown. This is the first guard in a chain of four null checks (payment, booking, eventType, users/team).

Source

Thrown at apps/api/v2/src/modules/atoms/services/event-types-atom.service.ts:315

              ...(teams.length && {
                credentialOwner,
              }),
              userCredentialIds,
              invalidCredentialIds,
              teams,
              isInstalled: !!userCredentialIds.length || !!teams.length || app.isGlobal,
              isSetupAlready,
              ...(app.dependencies && { dependencyData }),
            };
          }
        )
    );
    return apps[0];
  }

  async getUserPaymentInfo(uid: string) {
    const rawPayment = await this.atomsRepository.getRawPayment(uid);
    if (!rawPayment) throw new NotFoundException(`Payment with uid ${uid} not found`);
    const { data, booking: _booking, ...restPayment } = rawPayment;
    const payment = {
      ...restPayment,
      data: data as Record<string, unknown>,
    };
    if (!_booking) throw new NotFoundException(`Booking with uid ${uid} not found`);
    const { startTime, endTime, eventType, ...restBooking } = _booking;
    const booking = {
      ...restBooking,
      startTime: startTime.toString(),
      endTime: endTime.toString(),
    };
    if (!eventType) throw new NotFoundException(`Event type with uid ${uid} not found`);
    if (eventType.users.length === 0 && !eventType.team)
      throw new NotFoundException(`No users found or no team present for event type with uid ${uid}`);
    const [user] = eventType?.users.length
      ? eventType.users
      : [{ name: null, theme: null, hideBranding: null, username: null }];

View on GitHub (pinned to 176037d0af)

Solutions

  1. Verify the uid is a valid payment uid (not a booking uid) and exists in the payment table.
  2. If using Stripe, confirm the payment was created in the same environment (test vs live mode).
  3. Check if the payment was soft-deleted or refunded, which may exclude it from the query.
  4. Trace the uid from the source (webhook payload, checkout session, or booking response) to ensure it's a payment uid.

Example fix

// before: passing booking uid instead of payment uid
const paymentInfo = await api.get(`/v2/atoms/payment-info/${bookingUid}`);

// after: use the correct payment uid from the payment flow
const payment = await api.get(`/v2/payments?bookingUid=${bookingUid}`);
if (!payment?.uid) {
  throw new Error('No payment record found for this booking.');
}
const paymentInfo = await api.get(`/v2/atoms/payment-info/${payment.uid}`);
Defensive patterns

Strategy: validation

Validate before calling

// Verify the payment uid exists before fetching payment info
const verifyPaymentUid = async (api: ApiClient, uid: string): Promise<void> => {
  const payment = await api.get(`/v2/payments/${uid}`).catch(() => null);
  if (!payment) {
    throw new Error(`No payment record found for uid '${uid}'. Verify it is a payment uid, not a booking uid.`);
  }
};

Try / catch

// Handle payment-not-found gracefully
try {
  return await api.get(`/v2/atoms/payment-info/${uid}`);
} catch (err: any) {
  if (err?.response?.status === 404) {
    return { found: false, message: `Payment ${uid} not found.` };
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling the payment-info endpoint with a uid that doesn't exist in the payment table. The uid was from a payment app (e.g. Stripe) test mode that isn't synced to the production database. The payment was refunded and soft-deleted, removing it from the query results.

Common situations: Frontend using a payment uid from a test webhook that wasn't fully processed. Database inconsistency where the payment record was deleted but the booking still references it. Typo or truncation in the uid (uids are typically long alphanumeric strings). Using a booking uid instead of a payment uid.

Related errors


AI-assisted analysis of calcom/cal.diy@176037d0af (2026-08-12). Data as JSON: /api/errors/f75ea9b619e0df59. Report an issue: GitHub.