#[LBG] India-subscription
1 messages · Page 1 of 1 (latest)
Hi! How are you creating your subscriptions? With Checkout Sessions or directly with a Subscription ?
Directly with a sub
Then you can only pass recurring prices when creating the subscription. However you could create an invoice item for the customer first, and then when you create the subscription, that item will be automatically added to the invoice object of the subscription.
My goal is to create a recurring subscription with a one time initial fee
That the customer would confirm on frontend
If you want the one time initial fee to be included in the first invoice of the subscription, then use the solution I described above. If you want it to be a separate payment, then create a new PaymentIntent for this.
Sure:
- Create an invoice item for the customer, for with the one time fee amount
- Then create the subscription like you would normally do
- The invoice item you created in step 1 will be automatically added to the first invoice of the subscription you created in step 2
And to create a new invoice item: https://stripe.com/docs/api/invoiceitems/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Isn't this a shortcut ?
cus_LdFsYATgpYdkxa
Seems to work
True, you could use that too!
req_C6KPrYkz7uwYmP
Do you confirm that I need to build a PaymentElement (I want it custom) to collecte credit card information and confirm the subscription AND the initial payment intent ?
yes that's correct. we have a guide on how to do this here: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
Checking on it
Will the credit card collected be set to be the default payment method of the subscription ?
no, you need to do that yourself. this is explained in step 8
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#default-payment-method
The payment methods that are displayed to the customer depends on the ones activated right ?
If we activated credit card (default), googlepay and apple only, and if we use PaymentElement (we don't use Card Element), then only those 3 payment methods can appear ?
Yes, that's correct. Though a customer will never see both Apple Pay and Google Pay at the same time, because they work in different browsers (Google Pay is chrome only, and Apple Pay is Safari only).
Yes sure
Also note that if the customer doesn't have a card in their Google/Apple wallet, they won't see the Google/Apple button.
Exactly.
Ok
Still working on confirming the payment
Should we use stripe.confirmPayment and not stripe.confirmCardPayment event though it is a credit card to confirm because we are using PaymentElement and not CardElement ?
If you are using the Payment Element, then you need to use confirmPayment
Ok, what is the difference between stripe.confirmPayment and stripe.confirmCardPayment ?
If you are using the Card Element, you need to use confirmCardPayment. But this would only accept the card payment method, and nothing else (so no Google/Apple pay).
can we choose the language of the custom payment Element ?
The Payment Element should automatically display the correct language for the customer. But if needed you can change it yourself by passing a options.local parameter when initializing Stripe https://stripe.com/docs/js/initializing#init_stripe_js-options
Ok
Do you confirm that we can copy paste the code and it should work ?
(just changed the return URL)
Yes, assuming you are using a similar HTML, so that const form = document.getElementById('payment-form'); exists with a submit button on your page.
Why is the ConfirmPayment displaying all thoses params in the URl ?
We only added stripe=ok to test
I think i sax on the Stripe doc that the client secret should not appear in the URL
Nevermind
yes Stripe automatically adds query parameters to the return URL, as mentioned here: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment
If you don't need this then you can safely ignore the query parameters.
Great
There is also redirect_status=succeeded
In the URL params
Does this tells us that de payment intent went OK or it's only for the redirection ?
if you are redirected to the page, it means the payment succeeded. otherwise if there was an error, you would stay on the Payment Element page.
Ok so if we are redirected, it means the initial fee was paid, the subscription is created, and the payment method is saved ?
Even after a 3DS ?
What if the card has insuficient funds after a 3DS ?
Ok so if we are redirected, it means the initial fee was paid, the subscription is created, and the payment method is saved ?
Yes!
What if the card has insuficient funds after a 3DS ?
You can try that with a test card with one of our test cards, for example 4000000000009995 https://stripe.com/docs/testing#declined-payments
In this case you won't be redirected, and you can display an error message to the customer on the page.
Ok i'll try this
Can we add fields to the payment Element ?
Like asking the name
No you can't add fields to the Payment Element itself, but you could add your own inputs on the page to collect extra information if needed.
I'm asking because when using stripe Checkout :
But when using Payment Element :
There is no name on the payment method
Might be this right ?
hey @waxen current, I'm taking over from @jaunty saddle just give me a couple of minutes to catch up
Hello @dapper phoenix
https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-fields-billingDetails-name
Concerning billing details you can't enforce collecting those info in the options, you can only specifyneverto avoid collecting them. By default the value isautowhich means it depends on the Payment Method that the user chooses
I can't collect a name for the card number ?
as @jaunty saddle stated above unfortunately you can't with PaymentElement, but you can add your own inputs to collect all sorts of other data you need
Not having an owner name on the payment method will not affect the payments?
It depends on the Payment Method Types
Credit cards
In credit cards it's not necessary
is it possible to make a payment intent off_session with a payment method (credit card) that has been authenticated with 3DS fews seconds ago ?
you could always do that, but we can't guarantee that the issuer bank would not require authentication (3DS) again at any point
At the end of this step, once redirected, you fetch the pi_ status to check if it has succeeded
yes
Why doing so if the customer is redirected ONLY IF it has succeeded ?
this is in the case you're not using webhooks, which is not what we really recommend
???
@waxen current what's the question?
@jaunty saddle confirmed that once redirected it means the payment has succeeded
true! never hurts to check I suppose, since you want to be sure before provisioning access to your product to the customer.
Ok
Does stripe.confirmPayment generates a webhook event ?