#ruul_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!
âąď¸ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1214881376231497789
đ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
Hi
the error message of the request API call is quiet explicit:
Missing required param: customer.
You need to pass the customer attribute:
https://docs.stripe.com/api/payment_methods/attach
I'm already passing the customer attribute
the problem here is
when the user is created we create a customer corresponding to that user
const customer = await this.paymentService.createCustomer(
email,
${firstName} ${lastName}
);
await this.collections.teams.updateOne(
{ _id: teamId },
{ $set: { stripeCustomerId: customer.id } }
);
however we don't have anything stored in mongo for stripeCustomerId which makes it an issue with the part here
not the actual call to purchase
/**
- Creates stripe customer
- @param email string : customer email
- @param name string : customer name
- @param testClockId string : test clock id
- @returns customer object
*/
public async createCustomer(
email: string,
name: string,
testClockId?: string
): Promise<Stripe.Customer> {
return this.stripe.customers.create({
email: email,
name: name,
...(testClockId && { test_clock: testClockId }),
});
}
there should've been a request to create a customer for Svetlana.Li@livingspaces.com today
or yesterday depending on the timezone
but I don't see it in v1/customers
can you please confirm if it's the case, then it's a problem on our end
I just created a new user with raceki1383@mcuma.com but I don't see a log created for that either
I'm already passing the customer attribute
Sorry but no, you are not passing it. If you are passing it you'll see it in the request body paylaod:
https://dashboard.stripe.com/test/logs/req_9s7kSYwx7OqgFY
ok I see it req_8VvRJwwnjU0RE0
this request is the creation request of the customer
/**
- Purchase subscription
- @param customer customer id
- @param price stripe price id
- @param paymentMethodId id of the payment method (optional)
- @param quantity number of items (optional)
- @param trialDays trial days (optional)
- @returns subscription object
*/
public async purchaseSubscriptionWithPaymentMethodPresent(
customer: string,
price: string,
paymentMethodId: string,
quantity?: number,
trialDays?: number
): Promise<Stripe.Subscription> {
return this.stripe.subscriptions.create({
customer,
items: [{ price, ...(quantity && { quantity }) }],
default_payment_method: paymentMethodId,
...(trialDays && { trial_period_days: trialDays }),
});
}
this is the method that we use
The issue is that you are not passing the customer in the request payload of the request req_9s7kSYwx7OqgFY
I'm trying to tell that the customer parameter is null/undefined
and that's why its failing
the problem here is not the request itself but
there wasn't a customer created for that user I mentioned earlier
I'm trying to tell that the customer parameter is null/undefined
and that's why its
You need to double check your integration why it's not sending the correct customer id.
the id is missing
Mayeb it is missing in your database/integration
but you need to make sure that you are sending it to Stripe APIs
I'm just trying to clarify if there's a failed customer creation request for Svetlana.Li@livingspaces.com
it's probably something weird on our side but
just to make sure
because the user I created just now got a customer id from the exact same method
Yes you need to double check/debug your integration and make sure to send the customer Id and not undefined
I understand but can you confirm if there isn't a request to create a stripe customer for Svetlana.Li@livingspaces.com
What you can do is to make a search API on that email and double check if there is a customer or not:
https://docs.stripe.com/api/customers/search
https://docs.stripe.com/search#query-fields-for-customers
thanks
Happy to help!