#ToxicMint-duplicates

1 messages · Page 1 of 1 (latest)

craggy oxide
#

Hi there, are you calling this immediately after creation?

cinder jasper
#

Yup!

#

Well,

#

in the app.post method for creating payment intent

#

Oh, the typo of ```js
query: 'name:test name',

is just me troubleshooting, I've tried all manner of quote combinations
craggy oxide
#

So it may be okay for your use case

cinder jasper
#
app.post("/create-payment-intent", async (req, res) => {


    const customers = await stripe.customers.search({
        query: 'name:\"test name\"',
    });

    console.log(customers);

    res.send(customers);
    
});

Had all the payment intent code commented out, deleted for space here

craggy oxide
#

I believe you want query: "name:'test name'" if I remember correctly

#

I can double check

cinder jasper
craggy oxide
#

Oh that should work fine

cinder jasper
#

I've even been trying it with raw cURL requests and haven't had any luck with a response

grim ridge
#

what is the problem?

#

because you mostly say "doesn't work"

cinder jasper
#

I'm not getting any entries back in the data array when I'm calling a search

grim ridge
#

The Search API is not instant, so it depends how long ago you created those first

cinder jasper
#

I originally wanted to search on a metadata value, searching on name and email were just me trying to narrow down whether it was syntax problems or not

#

How long is the delay typically on the Search API?

grim ridge
#

usually a few minutes but sometimes it's more backed up (which we're looking into right now)

#

I wouldn't use the Search API for your example/use-case personally since you could still get duplicates as it's not real time

cinder jasper
#

What would be the best way to go about preventing customers with duplicate metadata values then, if not Search then create if missing?

grim ridge
#

Caching this in your own database instead

cinder jasper
#

We mostly are already, we're just looking for how we keep track of certain things for the accounting department

#

But looking now, I can see a metadata field in PaymentIntent, which should do exactly what I'm hoping for

grim ridge
#

awesome!

cinder jasper
#

Thanks! So far loving stripe from a developer side, way better documentation that what we were battling with before.