#cerebro_code

1 messages ยท Page 1 of 1 (latest)

naive valveBOT
#

๐Ÿ‘‹ 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.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— 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/1433378194378985554

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

nimble ocean
acoustic perch
#

there is nothing mentioning "url" or "return"

#

but this does nothing

naive valveBOT
lavish pollen
#

hey there ๐Ÿ‘‹ taking over for my colleague

#

do you see this option in your dashboard when configuring the pricing table?

acoustic perch
#

where is that suppossed to be?

#

ok found it

#

I'll try thanks!

lavish pollen
#

when you create/edit the pricing table, under the 'Payment settings' heading

#

great!

acoustic perch
#

this doesn't work, just tried twice, refreshing the pricing table with cache disabled in Chrome

#

I edited the pricing table twice too and the value is saved here

lavish pollen
#

can you share the ID of your pricing table?

acoustic perch
#

prctbl_1SLPTq8WKdJ7QBsCJSgDdFSv

lavish pollen
#

have you tried testing it out? what specifically isn't working?

acoustic perch
#

isn't redirecting

#

is stuck there

#

tried a few times already

#

can you/me submit this as a bug?

lavish pollen
#

ah I see

#

let me see if I can reproduce

#

hmm ok it's working for me

#

we can investigate as a possible bug, but first would you mind sharing the cs_test_123 ID?

#

actually all good, I found it

#

ok I think the issue is that you used a different pricing table for this test: prctbl_1SLPTq8WKdJ7QBsCJSgDdFSv

#

ah sorry my mistake, that's the same one

acoustic perch
#

I always had only one

lavish pollen
#

ah I see the issue

#

it's because you need to set this for each item in your pricing table

#

if you open the pricing table and go back to the update/edit UI, and look again under the 'Payment settings' heading, you should see a separate tab for each option customers can choose

#

the completion behaviour needs to be configured separately for each

acoustic perch
#

ok, works thanks!

lavish pollen
#

brilliant! thanks for confirming ๐Ÿ™‚

acoustic perch
#

another question, is there a way to retrieve this list with a single call through the API filtering by email?

lavish pollen
#

I'm afraid not

the List Charges API doesn't support a customer email parameter

the closest thing to that is listing Charges by customer ID: https://docs.stripe.com/api/charges/list#list_charges-customer

but if you have duplicate customers (i.e. the same email for multiple customer IDs) then this wouldn't return the full list associated with that email

acoustic perch
#

charges doesn't return the payments you see at the top of my screenshot

#

those are returned with Stripe.paymentIntents.search

#

but I can't filter these by email, is there a way?

lavish pollen
#

not really

you could perform the filtering on your side by listing all and parsing through the list for the specific email value, but that would still involve listing all

acoustic perch
#

๐Ÿคฏ unbelievable, ok thanks!

lavish pollen
#

then from their you could list payments by customer

acoustic perch
#

OK, thanks that seems to work!
Another question: I have metadata stored to the "15 min" product, you can see is the only product with the title "15 min" and it was saved yesterday and I have a few transactions today, none with the metadata filled in

lavish pollen
#

the metadata is set on the Checkout Session object here

#

this doesn't carry over to the resulting transaction

naive valveBOT
lavish pollen
acoustic perch
#

how do I pass the checkout session to the pricing table?

bold furnace
#

๐Ÿ‘‹ Hi there, I'm taking over for my colleague. Let me catch up

#

I don't believe you can configure the Checkout Session created from a Pricing Table, beyond what the Dashboard provides

acoustic perch
#

I basically need to add extra info to the product

#

why the metadata is not there? it would be so useful...

#

and the solution provided by your colleague won't work either, because the product is defined separately, I basically need to know what was bought, the title is not enough nor the description (these are things read by the customer, I need information specifically for my app and not the customer on each product)

bold furnace
#

Just so we're on the same page, what information exactly do you need to access, and when? ๐Ÿ™‚

#

If a customer has purchased a certain price, you will be able to access that, its associated product and its metadata via the API. Though just not in a checkout.session.completed event most likely, as the metadata wouldn't be expanded there

acoustic perch
#

I need to go back to another question I did earlier, where your colleague said I could filter payment intents on customers, I can do this yes, but the payments/transactions you see in my screenshot, those don't have a customer, even though the email is listed in that column, here is the proof:
PAYMENT INTENTS {
"object": "search_result",
"data": [
{
"id": "pi_3SNsED8WKdJ7QBsC0bq6sAVA",
"object": "payment_intent",
"amount": 200,
"amount_capturable": 0,
"amount_details": {
"tip": {}
},
"amount_received": 200,
"capture_method": "automatic_async",
"client_secret": null,
"confirmation_method": "automatic",
"created": 1761816789,
"latest_charge": "py_3SNsED8WKdJ7QBsC0K7BCNr8",
"livemode": false,
"metadata": {},
"next_action": null,
"on_behalf_of": null,
"payment_details": {
"customer_reference": null,
"order_reference": "prod_TKEdVlXOCzMI8u"
},
"payment_method": {
"id": "pm_1SNsED8WKdJ7QBsCVXZYARPh",
"object": "payment_method",
"allow_redisplay": "limited",
"bancontact": {},
"billing_details": {
"address": {
"city": null,
"country": "BE",
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "unity-sandbox-admin@tweddle.com",
"name": "admin",
"phone": null,
"tax_id": null
},
"created": 1761816789,
"metadata": {},
"type": "bancontact"
},
"payment_method_types": [
"bancontact"
],
"presentment_details": {
"presentment_amount": 236,
"presentment_currency": "eur"
},
},

#

I need the metadata of the product there (this is the answer to your question)

#

so when I filter on customer ID, the payload I just pasted doesn't appear in the response

#

this is the code that produce that payload:
const paymentIntent = await Stripe.paymentIntents.search({ query: status:"succeeded", limit: 10, expand: ['data.payment_method'] }, { stripeAccount })
console.log('PAYMENT INTENTS', JSON.stringify(paymentIntent, null, 2))

#

I basically need all products bought by a single user/customer

#

in my app, according to what the user bought, we give certain access, but I can't hardcode the products in my app, I need to hardcode metadata like minutes, days (they pay to use the app or certain features per minute or per days)

bold furnace
#

Alright, and from the information you gave above, you're passing in the customer-email into the pricing table, and wanting to automatically create a new Customer each time?

acoustic perch
#

I would like to link the email to always the same customer and if doesn't exist, to create it

bold furnace
acoustic perch
#

ok got it

#

what about finding the bought products (subscriptions and one-off payments) later in our backend?

#

so far I need to make all these calls
const invoice = await Stripe.invoices.list({ customer, limit: 1, status: 'paid' }, { stripeAccount })
console.log('INVOICE', JSON.stringify(invoice, null, 2))
const charge = await Stripe.charges.list({ customer, limit: 1, status: 'succeeded' }, { stripeAccount })
console.log('CHARGES', JSON.stringify(charge, null, 2))
// customer:"${customer}" AND
const paymentIntent = await Stripe.paymentIntents.search({ query: status:"succeeded", limit: 10, expand: ['data.payment_method'] }, { stripeAccount })
console.log('PAYMENT INTENTS', JSON.stringify(paymentIntent, null, 2))

#

but metadata is not there for products

bold furnace
#

So if you have the Checkout Session ID, you can retrieve it, with expand: ['line_items.data.price.product'] that will show the product and its metadata

acoustic perch
#

if I use customer id in paymentIntents.search I don't see these payments

#

is this because I didn't link them to a customer?