#max_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.
⏱️ 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/1313843333122228244
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
👋 happy to help
Hi 🙂
I'm not sure I understand your ask
I have a few questions. I'll start from the top:
With Stripe, we are trying to search for customer's payments using the API and matching to the customer email in our database. However, if the email entered in Stripe contains captiol letters - and those don't match the casing of the email in our system - we aren't able to find the customer with the api. Is there something else we could do here?
yes you can have multiple options the easiest would be to check on your side by doing a "toLowerCase" on both email addresses this way you are sure to get the right match
another thing you can do is to add on the customer some metadata with the ID of its corresponding match in your system
this way you could easily map them
The problem with that approach is that it requires us to retrieve all emails from the database to our system then check locally which is more time consuming than matching directly.
How can we automatically add metadata to payments when they are made?
How can we automatically add metadata to payments when they are made?
how are you integrating with Stripe? are you using Checkout Sessions?
Can we pass metadata through the payment gateway? So when the payment is made it adds an ID/email that we can search for via api in metadata? And can this also be done when sending payment links (For example, https://buy.stripe.com/237589235?prefilled_email=raychie2033@gmail.com&metadata={submissionID=1234}
Yes, using checkout sessions and also payment links
you can set payment_intent_data.metadata on the PaymentLink/Checkout Session
and when you get the checkout.session.completed event you can set the metadata from the PaymentIntent on the Customer
Can we then search for entries in the database by metadata key?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yes you can use metadata to find customers
So can I pass metadata into the payment intent (for example, email: test@gmailcom)
Then search for that payment intent by metadata? The link above is for customers, does same apply for PaymentIntents??
yes
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok great, I'll be back in 2 mins
actually this might be best https://docs.stripe.com/payment-links/url-parameters#streamline-reconciliation-with-a-url-parameter
no
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Does a payment link create a checkout session? Is that how it works?
yes exactly
So can we search for payment_intent using the client_reference_id?
no
you would have to use the checkout.session.completed event to get the client_reference_id and if you want you can then copy it to the metadata of the PaymentIntent or customer or subscription depending on what you're trying to achieve exactly
Another thing,
When finding payments of a single email, it has multiple customer_ID’s which requires us to loop through all the customer_id’s transactions to find the payment
Is there a better way of doing this?
I wouldn't think so, it's possible for a single email to be associated with multiple Customers and each customer can have multiple payments
PaymentLinks always create CheckoutSessions, that's what they are(a reusable link that creates CheckoutSessions when interacted with)
Ok thanks.
Another thing - is there a way to easily migrate all customers to a new subscription product?
Currently, some are on a lower subscription fee and we want to change all of those to the main subscription product. Does this need to be done manually?
generally you write some scripts to call https://docs.stripe.com/billing/subscriptions/upgrade-downgrade for each Subscription and change them to the new Price/Plan.
we have a new-ish migration toolkit but I don't think it specifically covers this use case yet, not really sure to be honest, but the API approach does work
https://docs.stripe.com/billing/subscriptions/toolkit-reference#within-Stripe-accounts
We don't want to change the subscription product but rather the product that the members are on. For example,
We have £30 every 28 days
We have £20 every month
We want all members to be on the product £30 every 28 days
same thing, that means changing the Subscription's items to use the new Price object that is £30 every 28 days
Sorry 2 mins, just looking
So is a 'subscription item' a product? We have lots of products, we want to clean up by removing all that aren't £30 every 28 days. This can be done via this api?
no, those are different objects. The SubscriptionItem is the "thing" the subscription is billing for, which is a certain quantity of a certain recurring Price. A Price defines the currency amount and recurring period. The Price is connected to a Product that describes what the actual thing being sold is (i.e. the description).
So the price is the product?
It's the product we need to change
No, a Price and a Product are different things(a Product can have multiple Prices since it can be sold at different prices or at different intervals). It's the Price that a Subsctiption is subscribed to.
Can we do this in bulk or does it need to be one-by-one?
you can write a script that calls the API in a loop , for example
Sure.
like I mentioned we have this toolkit thingy released somewhat recently that is at least adjacent to this and allow for some bulk actions; I don't think it specifically addresses migrating existing subscriptions to new prices(which is indeed a common feature request and I wish I had had a better answer than just calling the API for each one), but maybe it does, I haven't played around with it at all myself https://docs.stripe.com/billing/subscriptions/import-subscriptions-toolkit
Ok, I'll take a look at that too. Thanks 🙂
And last thing,
Do you have any documentation that can help with the following?
- Best practices for creating subscription products to be used in our new app
- Best way to map payments such as setup-fees which have multiple possible amounts and subscriptions to a user in logged-in state in new app
For context, members may want to add additional features to their subscription what's the best process for this? And for one off payments too, have you got any info on best practices?
I don't have anything specific for 1 (maybe https://docs.stripe.com/products-prices/how-products-and-prices-work ?) , for 2 maybe consider https://docs.stripe.com/billing/invoices/subscription#first-invoice-extra for setup fees and one-time extras
Ok, thanks a lot. You've been very helpful 🙂