Not allow user to change email on Stripe Checkout Session - stripe-payments

I am using stripe for my app subscription needs. I have some webhooks which are called when an invoice is paid, failed etc now this webhooks send the customer_email and i use that to do some other tasks. Now the problem is that a user is able to change the email on checkout_session
I don't want the user to be able to change this. I tried disabling the option from the customer-portal dashboard on stripe but that didn't work either.
Changing this email calls the webhook with wrong email resulting in lost subscription etc. I can't seem to find the option to disable this.

Currently you cannot disable changing the email address in the Checkout Session. You would probably want to use the customer's id as the unique reference (instead of relying on the customer's email).
Disabling the ability to update their email address as shown in the second screenshot, only disables that function in the customer portal.

Related

Stripe create Subscription with payment method in one go instead of two

for my subscription based product I want to have a possibility to subscribe and enter payment details at once with stripe and struggle with that with the api.
In https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements I see an option to create a subscription with payment_behavior='default incomplete' and then enter the details to confirm the payment intent. So far so good. However if I create the subscription like that even before the customer confirms payment details stripe already generates an invoice which is not really what I want before final confirmation by customer.
Options I see:
create setupintent, have this filled by customer via elements and then have the customer subscribe. Technically works nicely but for a sales and customer perspective is not good as it has two steps thus probably reduces conversion.
create the subscription in the background before final subscription confirmation by customer and use the clientsecret of it to pass back to browser and then have customer enter his payment data and submit that and finish the setup of subscription and payment info. Technically works - however I realize that when I create the subscription to get the clientsecret to pass to elements before the customer enters his payment data and confirms the subscription the subscription is not only created but an invoice too - which would be really, i.e. an invoice created before customers really confirms the contract
create setupintent and submit it via elements and in metadata of it add the info of product that customers wants so that when the paymentmethod gets created and I get webhook event I do the booking of the product given in metainfo. May however mean the customer gets to success page but the webhook has not notified yet and thus the customer is not really subscrubed at the point in time but gets a success message he is
same as 3 except do not pass info via metadata but via successUrl parameters which refers to and endpoint at my backend which upon being called after setupintent was setup will do the subscription and then redirect to my frontend which shows success page. That seems like a error prone workaround however.
Create a workflow which is a 2 step sign up and asks for paymentinfo, sets that up and then brings customer to a final confirmation page where the submit triggers subscription creation. Seems a bit complicated from a user flow, but so far probably the best option?
Any better options?
Cheers
Tom
ps: Interestingly enough on discord stripe support told me #2 is the way to go - find it hard to believe ...
As far as I know, there isn't a workaround for this unfortunately. It is just how Subscriptions API is designed by Stripe. You can learn more about that here where they talk about "how subscriptions work".

Stripe Payment Link success link to include email

I can't seem to figure out how to include email into stripe checkout success redirect.
I setup stripe check out payment link (from UI), simple subscription. Once payment is successful, I would like to redirect customer to my WebApp, but I do need to include customer's email.
Unfortunate redirect includes literal {CUSTOMER_EMAIL}, instead of real email. How can I mend it?
CUSTOMER_EMAIL is not available. Only CHECKOUT_SESSION_ID. You can find how to use CHECKOUT_SESSION_ID to retrieve the Customer info from Stripe Doc. But that would require you to write some code
get '/order/success' do
session = Stripe::Checkout::Session.retrieve(params[:session_id])
customer = Stripe::Customer.retrieve(session.customer)
You can't use the email on redirect. The only field available is the checkout session id. You can use a tool to get the checkout session data from the checkout session id like shown here: https://attribut.io/docs/stripe/stripe-checkout-session-data-from-payment-links/.
Otherwise you need to create a server to to do that for you.

Get customer email address following stripe payment from payment link in pipedream webhook

I'm using pipedream to link stripe to mailerlite.
Customers can buy my product via a stripe payment link, which requires that they enter an email address.
I want to kick off my pipedream workflow when the payment has succeeded, and I want to access that email address.
In setting up the integration I've tried listening for the following events:
charge.succeeded
payment_intent.succeeded
checkout.session.completed
order.payment_succeeded
and submitting a payment in test mode, but not a single one of them contains the email address I entered when I submitted the payment.
How can I achieve my goal? Is there another event I should be looking for instead?
Thanks for any help offered!
Originally I was testing the webhook by going to Payments (in test mode) and submitting a new one. No email address was being sent along with the charge.succeeded event, which was the event I really needed to look for.
However once I created a product (in test mode, again) and gave it a payment link, and tested that with one of the test card numbers then bought it via the link, the event I received did have the email address I used to purchase it along with it.

Can I find if a user subscription is active or not with their email in stripe?

I am trying to create subscription for my app. My plan is to :
(1)Ask email and phone , save it in their pc.
(2)show details about 2 subscription plans (monthly,yearly)
(3)creating a button for both and sharing subscription link created by stripe (automatically stripe does that)
(4)Check user have active subscription either in monthly or yearly.
(5)if yes continue to app, else show the page with details.
Now I want to know how to know that if that user have active subscription or not with only their email and phone number.(without stripe customer id)
And also I don't want to use html , js in my app that's why I am choosing python for this.
Thanks in advance whoever going to help me.
You can list Customers in the Stripe API and filtering by the email parameter. This will give you an array of Customers with that email address.
You can then list Subscriptions on those Customers using the customer parameter.
You can use auto-pagination to iterate through the "pages" of lists you get back from the API (the limit parameter on list API calls defaults to 10).

Prevent duplicate subscriptions with Stripe Checkout

Consider the following course of events:
A user selects one of multiple subscription options on my website and clicks the "pay" button.
They're redirected to the Stripe Checkout page but don't complete the payment yet.
They somehow manage to get back to the page where they select the subscription while keeping the Stripe Checkout page open. (I know this is somewhat contrived but technically possible.)
They choose a different subscription option and click on "pay" again.
A second checkout session is created and another Stripe Checkout page opens.
Now they complete payments on both checkout pages.
How can I prevent this? Is there a way to cancel a checkout session? When I create a checkout session for a subscription, I don't receive a payment intent that I could cancel. There also doesn't seem to be a way to cancel checkout sessions directly.
I don't know of a way to prevent the scenario you described as the customer in question is explicitly deciding to pay you twice for two different subscriptions.
That said, if your use case requires a customer to have only a single Subscription you could add logic on your end that would do the following:
Set up a webhook endpoint to listen for customer.subscription.created events.
Whenever a new Subscription is created list the Subscriptions belonging to the Customer.
If the Customer has more than one active Subscription cancel the newest one(s) and refund the associated payments. You may also want to send the customer an email letting them know what happened.

Resources