#cerebro_code
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.
โฑ๏ธ 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.
You should be able to configure this from your Stripe Dashboard when you configure your pricing table:
https://docs.stripe.com/payments/checkout/pricing-table#Create:~:text=redirect customers back to your site after a successful purchase.
there is nothing mentioning "url" or "return"
I have setup in https://dashboard.stripe.com/acct_1SLOqx8WKdJ7QBsC/test/settings/billing/portal Business Information -> redirect link
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
but this does nothing
hey there ๐ taking over for my colleague
do you see this option in your dashboard when configuring the pricing table?
when you create/edit the pricing table, under the 'Payment settings' heading
great!
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
the value I have is: http://localhost:3021/
can you share the ID of your pricing table?
prctbl_1SLPTq8WKdJ7QBsCJSgDdFSv
on our side internally I can see that this is configured to redirect to http://localhost:3021/devinc/devportal on completion
have you tried testing it out? what specifically isn't working?
isn't redirecting
is stuck there
tried a few times already
can you/me submit this as a bug?
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
I always had only one
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
ok, works thanks!
brilliant! thanks for confirming ๐
another question, is there a way to retrieve this list with a single call through the API filtering by email?
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
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?
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
๐คฏ unbelievable, ok thanks!
you can use the Search API to do a customer email search to get customer IDs for the email: https://docs.stripe.com/search#customers-email-search
then from their you could list payments by customer
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
the metadata is set on the Checkout Session object here
this doesn't carry over to the resulting transaction
we have a guide on this for Checkout Sessions here: https://support.stripe.com/questions/using-metadata-with-checkout-sessions
how do I pass the checkout session to the pricing table?
๐ 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
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)
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
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)
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?
I would like to link the email to always the same customer and if doesn't exist, to create it
Note that Stripe doesn't automatically locate a certain Customer ID based on email address. If you have an existing Customer, you should create a customer session on their behalf as shown here: https://docs.stripe.com/payments/checkout/pricing-table#customer-session
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
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