Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: No such customer: 'cus_....' #612

Open
insivika opened this issue Feb 22, 2024 · 1 comment
Open

Error: No such customer: 'cus_....' #612

insivika opened this issue Feb 22, 2024 · 1 comment

Comments

@insivika
Copy link

insivika commented Feb 22, 2024

Bug report

firestore-stripe-payments

Describe the bug

I followed the instructions on how to set up and intigrate the extension with my firebase instance. I was able to add the product and see it being created in the firebase database which tells me the integration was successful. However when I make a request to create a check out session I get the following error:

No such customer: 'cus_PaXYUcDLJWD3Lo

What's odd is that I dont see any customer created on the stripe dashboard so I'm not even sure how it knows about his customer id.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Below is my code, I've set up a controller that returns the url via a rest request:

import { Users } from '../firebase.js';

export const createCheckoutUrl = async ({ userId, priceId, successUrl, cancelUrl }) => {
  return new Promise((resolve, reject) => {
    Users.doc(userId) // Use the provided userId instead of currentUser.uid
      .collection('checkout_sessions')
      .add({
        price: priceId,
        success_url: successUrl,
        cancel_url: cancelUrl,
      })
      .then((docRef) => {
        // Wait for the CheckoutSession to get attached by the extension
        const checkoutSessionListener = docRef.onSnapshot((snap) => {
          const { error, url } = snap.data();
          if (error) {
            // Show an error to your customer and
            // inspect your Cloud Function logs in the Firebase console.
            console.log(`An error occurred: ${error.message}`);
            reject(new Error(`An error occurred: ${error.message}`));
          }
          if (url) {
            console.log('url ==>', url);
            // Resolve the promise with the URL if available
            resolve(url);
            // Stop listening to further changes
            checkoutSessionListener();
          }
        });
      })
      .catch((error) => {
        // Handle any errors occurred during the process
        console.log(error);
        reject(error);
      });
  });
};

Expected behavior

I expect to get the url from the created session

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

I was successfully able to get sessions using the official stripe extension.

@Bkdeets
Copy link

Bkdeets commented May 9, 2024

Hey any update on this issue? Experiencing the same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants