#John-paymentmethod-retrieve
1 messages ยท Page 1 of 1 (latest)
Hi there! Can you share your code snippet where you are making that request?
Sounds like you may be looping?
Something on your end is triggering it multiple times.
static async findWithPaymentMethod({
paymentMethodID
}: { paymentMethodID: string }) {
const self = this;
if (!System.Util.isStringWithCharacters(paymentMethodID)) throw new System.ModuleError(self, 'ISICP-102', `Invalid payment method ID.`);
try {
return await stripe.paymentMethods.retrieve(paymentMethodID)
.catch(err => {
throw new System.ModuleError(self, 'ISICP-405', `Unable to find customer.`, err);
});
}
catch (err) {
throw new System.ModuleError(self, 'ISICP-406', `Unable to find customer.`, err);
}
}
That's the function that references the stripe library
here's the code referencing it
const stripePaymentMethod = await StripeCustomer.findWithPaymentMethod({ paymentMethodID })
.catch(err => {
SuperUser.notify({ message: `ClickFunnels merchant registration FAILED, unable to find customer in Stripe with Payment Method ID: ${JSON.stringify(err)}` });
throw new ModuleError(self, 'SASUCF-11', `Unable to create Merchant Profile.`, err);
})
No loops.
What is triggering stripePaymentMethod?
There's an inbound HTTP request to our webhook from the ClickFunnels application.
Our webhook is receiving customer data that was generated by the ClickFunnels -> Stripe integration. We are then taking the PaymentMethod from that request to find the cus_ ID for the customer that was created, then saving that customer ID to our application
The data coming from ClickFunnels doesn't contain the Stripe customer ID. It only contains the payment method ID. So we're having lookup the customer that was created, by using the paymentMethod.retrieve() function
I'll check the ClickFunnels webhook log to see if it's sending dozens of requests to us, which is the only way that this code could be invoked dozens of times. There's no other loops or other code that iterates.
Here's what the stripe logs show:
Can you provide me one of those request IDs?
What do you mean by "failed"?
req_mCguwf4yIB9hMo <-- this one succeeded, but we're seeing rate limit errors in our logs
These requests all appear identical.
The top request has a customer object
Both of those are successful requests. One is a customer update and one is a customer retrieval. Neither of those are paymentmethod retrievals.
So those requests don't align with the above code that you are talking about.
Those GET requests are hitting our "retrieve a customer" endpoint: https://stripe.com/docs/api/customers/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Interesting. Ok, one moment. Need to do an assessment of some different processes here.
Brb.
๐
Thanks btw!