#ariancydeo
1 messages · Page 1 of 1 (latest)
Hi 👋
Let's start with a clarification, when you say you get the "secret key" are you referring to the latest_invoice.payment_intent.client_secret value?
Hey there
.paymentKey(Objects.nonNull(sub.getPendingSetupIntentObject()) ? sub.getPendingSetupIntentObject().getClientSecret() : sub.getLatestInvoiceObject().getPaymentIntentObject().getClientSecret())
it's rather PendingSetupIntentObject or LatestInvoiceObject
Okay, yes different naming conventions depending on the language and Setup Intent (likely due to a trial period) but essentally the same thing
That's good.
Sometimes people expose their API secret keys without being aware that it gives full access to your Stripe account. So I wanted to make sure that wasn't the case.
Now, on to your question. We actually have a somewhat different integration that is designed to specifically address your issue (changing amount to charge based on payment method type).
It's so good that you worry about our security, kudos to you
We now have an integration that allows you to collect the Payment Method details, create the PM, and inspect it before creating the Subscription. This would allow you to apply a different Price based on type used.
https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
hm, let me explain a bit more in detail the flow we have
we have a shop page, which basically consists of 3 steps.
Step number 1, we ask for user's data like Firstname, Lastname, email, and some other.
Next, step 2, shows a list of prices, we have different prices for our product, for example
Price 1 - Upfront - $1000
Price 2 - 2 Installments - $500 (recurring monthly, two times)
Price 3 - 4 Installments - $250 (recurring monthly, four times)
Based on which price user selects, we then create a PaymentIntent for Upfront price since it's gonna be a one-off payment, or create a Subscription for Prices with installments. Once the user goes to Step 3, that's where the form from Stripe it's shown, and Card is selected by default. PaymentIntent for Upfront, or Subscription for installments, are created, form is showing, but PaymentIntent has an amount of originalPrice+3% fee, also Subscription has the same originalPrice + 3% fee. In Step 3, if user changes the Payment Method, I cannot update Subscription (haven't tried to modify the PaymentIntent yet, but most probably that won't be updated as well)
Hello! I'm taking over and catching up...
Hello Rubeus
Yeah, you need to modify the order of operations you're performing on your backend. Your customer-facing flow can stay the same though.
Instead of creating the Payment Intent or Subscription first, you need to collect the customer's payment info first, so you can see what it is.
Once you have the Payment Method you can determine if you want the 3% fee or not, then create the Payment Intent or Subscription accordingly.
hm, correct me if im wrong please
you mean, we should ask the customer to kinda select how does he/she want to pay, after selecting a plan, and only after we have that we then proceed with PaymentIntent or Subscription based on user price selection
for example, in our flow, when user selects a plan, we then show some payment options and make the user select one, and soon as we have that information only then we create PaymentIntent or Subscription?
Yeah, the customer-facing flow stays exactly the same. What changes is when you create the Payment Intent or Subscription.
You do that only after collecting the payment details, so you know if you should include the fee or not when you do so.
This approach is documented here: https://stripe.com/docs/payments/accept-a-payment-deferred
this is shown only after sending the clientSecret from backend to frontend (we have it like this currently)
so, collection the payment details, do we need something like this?
I'll check on the documentation for more details
because it is not quite clear for me, these Payment Elements what they are
Yeah, the whole point of the docs I sent you to is that you can use the Payment Element first, without a client secret.
You render the Payment Element, collect payment info, create a Payment Method, and then create a Payment Intent or Subscription instead of doing it the other way around.
I see
Thank you very much for clarification
and sorry for me being so confused, but it's clear now
have a good day/night, and thank you once again for your help
No worries, happy to help!