#Sapna Verma

1 messages · Page 1 of 1 (latest)

storm oceanBOT
spiral lava
#

👋 happy to help

#

how are you making the payment?

#

are you creating a separate Payment Intent?

fringe cypress
#

just using customer api to create a customer and creating a subscription using subscription API

#

thats all

spiral lava
#

I am allowing the customer to make a payment before the trial ends
what does that mean?

fringe cypress
#

The card details are entered by the customer before the trial ends.

#

but the subscription will be started at the end of the trial

#

shall i use trial_end parameter to take a timestamp

spiral lava
#

I'm not sure I follow

#

when the trial ends a new invoice is generated and automatically paid using the Payment Method that was saved upon subscription creation

fringe cypress
#

the trial_end timestamp will be used for the end of trial and payment - right?

#

just confirming

#

will the paymentIntent be created automatically on subscription creation?

spiral lava
#

there won't be a Payment Intent directly

#

Subscriptions create Invoices

#

Invoices would have a PaymentIntent if its due amount is more than 0

#

and they get automatically paid

fringe cypress
#

is the setiupIntent also created

#

through invoice'

spiral lava
#

no, if a subscription is created with a trial or with a first zero-invoice then the subscription's pending_setup_intent field will be populated

fringe cypress
#

can we find out the status of paymentIntent when a subscription is created

spiral lava
#

in subscriptions what's important is the status of the invoices

fringe cypress
#

it is written that stripe.confirmPayment needs to be called to setup payment

fringe cypress
#

will this Js call the API- Confirm a PaymentIntent

spiral lava
#

yes

#

confirmPayment confirms a Payment Intent
while confirmSetup confirms a Setup Intent

fringe cypress
#

in a subscription cycle do i need to call confirmsetup>

#

in any case?

spiral lava
#

You chose to use Payment Elements to collect the Payment Methods upon creating the Subscription?

fringe cypress
#

yes

#

do i need to call confirmSetup js?

spiral lava
#

if the subscription has a trial period then yes

#

on Subscription creation you need to expand on pending_setup_intent and send the client_secret to the front-end to use with the Payment Element to confirm the Setup Intent

fringe cypress
#

can you refer this to a doc where i can go through the details, I am not able to find them on search

spiral lava
#

there is no page for this

fringe cypress
#

so I should be calling confirmPayment to confirm a Payment Intent
while confirmSetup to confirm a Setup Intent, that is saving the payment details?

#

i think setupintent is used to save the payment details in a subscription..right

fringe cypress
#

so I should call confirmPayment and confirmSetup both

spiral lava
#

If your subscription has trial or 1st invoice = 0 you would expand on pending_setup_intent and sue the client_secret from the SI to send to the front-end and use the confirmSetup to save the PM for future payments on the subscription

fringe cypress
#

I am not able to find latest_invoice.payment_intent

spiral lava
#

did you create a subscription with trial period?

fringe cypress
#

yes

storm oceanBOT
spiral lava
#

then it's the second scenario that you need to do

fringe cypress
#

you said - you would need to expand on latest_invoice.payment_intent, what do you mean by expand on?

spiral lava
#

please read the whole sentence

#

If your subscription doesn't have trial (1st invoice !=0) then ...

fringe cypress
#

yes...then what is expand on

#

you would expand on pending_setup_intent...what do you mean by expand on?

spiral lava
fringe cypress
#

hi, I also read in the docs-- Use stripe.confirmPayment to complete the payment using details from the Payment Element and activate the subscription. This creates a PaymentMethod and confirms the incomplete Subscription’s first PaymentIntent, causing a charge to be made.

woeful mountain
#

Hey, taking over here. Let me know if there's any follow-up Qs I can answer!

fringe cypress
#

yes the one ablove

woeful mountain
#

What is the exact ask here ?

fringe cypress
#

if i create a subscription, do i need to call both confirmSetup and confirmPayment?...as i am saving as well as taking payment details

#

please confirm?

#

i set the mode to subscription

woeful mountain
fringe cypress
#

i am confused to use stripe.confirmPaayment and stripe.confirmSetup. Will I use both?

spiral lava
#

@fringe cypress it depends on whether you're always giving a free trial at the beginning of the subscription or not

fringe cypress
#

okie

spiral lava
#

If you're not always going to give the free trial then you need to implement both

#

what coding language are you using?

fringe cypress
#

php

spiral lava
#
$stripe->subscriptions->create([
  'customer' => 'cus_xxx',
  'payment_behavior'  => 'default_incomplete',
  'payment_settings' => [
      'save_default_payment_method' => 'on_subscription'
  ],
  .... // here you add trial, items, etc...
  'expand' => ['pending_setup_invoice', 'latest_invoice.payment_intent']
]);
#

after that you check whether pending_setup_invoice or latest_invoice.payment_intent are null or not and based on that you return a hash something like

{ 
  type: 'setup' | 'payment'
  client_secret: (either `pending_setup_invoice.client_secret` or `latest_invoice.payment_intent.client_secret`)
}

and based on the type you choose confirmSetup or confirmPayment

#

is that clear for you @fringe cypress

fringe cypress
#

first time the ConfirmSetup will be written and next time on subscription renewal, when there is no trial I will use confirmPayment....

spiral lava
#

next time you don't have to do anything

#

since we automatically charge the Payment Method

#

you don't have to do anything unless there's an action required

fringe cypress
spiral lava
spiral lava
fringe cypress
#

ok

#

got it

spiral lava
#

when there's no trial nor discount

fringe cypress
#

okay, clear

#

thanks

#

Also, it is written that the return_url should correspond to a page on your website that provides the status of the payment, by verifying the status of the PaymentIntent when rendering the return page. Inspect the status of the PaymentIntent to decide what to show your customers.

#

will I be using the status of Setupintent instead of paymentintent?

spiral lava
#

yes

fringe cypress
#

great, thanks

fringe cypress
#

Also, In case of charging at the end of trial or immediately, I need to pass the relevant timestamp to the trial_end parameter --right?

spiral lava
#

you can either pass trial_end or trial_period_days to specify how long the trial period is

fringe cypress
#

it could be now for immediate charging

#

right?

spiral lava
#

then you don't specify trial at all

#

these are the parameters you need to use when creating

#

you need 1 not both

fringe cypress
#

it just that some trial days have passed and payment details are provided and the charge is requested immediately

spiral lava
#

I don't follow

fringe cypress
#

then can i use now

spiral lava
#

you don't know how long the trial period is on creation?

fringe cypress
#

no, intially the account is created only on y application and the trial goes on ...some trial days have passed, not all and payment details are provided by the customer and they want the charge immediately and not untill the end of trial.

spiral lava
fringe cypress
#

thanks

#

In case of failed payments, we will need to create the paymentIntent ...through confirmPayment..right?

#

to allow adding a new payment method

spiral lava
#

you don't create a new Payment Intent you use the existing one on the invoice

fringe cypress
#

even if it's creating a new payment method

#

?

spiral lava
#

yes

fringe cypress
#

what i used on the invoice was setupIntent, shalli use the same to update the default payment method

spiral lava
#

the payment might fail once you have an invoice with a Payment Intent that fails

#

you would need to use that same Payment Intent from that invoice

fringe cypress
#

u mean the setupIntent as that i i used while using trials

spiral lava
#

no

#

that Setup Intent is used once

#

and you forget about it

#

each new cycle there's going to be a new Invoice

#

and each Invoice will have its own Payment Intent

fringe cypress
#

okay..and a payment.intent is automatically created ? without caling confirmPayment method

spiral lava
#

the confirmPayment (as its name sounds) confirms the Payment on the frontend when the user enters the payment details

#

the creation happens automatically

fringe cypress
#

If I am not using Stripe Invoice and will be using my own invoicing solution...would i able to find the paymentIntent somewhere

#

please answer

echo coyote
#

Hi there 👋 jumping in as my teammate needs to step away. If you are creating and handling your own Invoices outside of Stripe, then a Payment Intent will likely not be created automatically and you will need to create one for processing the payment.

fringe cypress
#

oaky

#

how about the invoice.paid event...shall i still get it

echo coyote
#

No, if there is no Invoice in Stripe then none of our Invoice-related features will operate. You will not receive Invoice related events.

fringe cypress
#

okay, so when i create a setupIntent to save the PM details, I must also create a paymentIntent using confirmPayment ?

#

because the first payment will not create the paymentIntent automatically

#

the one that is created on first payment...in my case i will have to create a payment intent

spiral lava
#

@fringe cypress you're allover the place, if you're using the Subscriptions API, Invoices will be generated for you automatically upon each cycle renewal

#

you don't have to worry about Setup or Payment Intents

#

if you want to use your own logic to create the invoices and handle the subscription cycles then please disregard everything we've been discussing in the last couple of days and let's start over this whole conversation

#

it's another approach and a totally different implementation path

#

you need to decide on which path you want to follow

fringe cypress
#

i will have to go through the another approcah

spiral lava
#

which one? please be precise

fringe cypress
#

if you want to use your own logic to create the invoices and handle the subscription cycles

spiral lava
#

then you don't need Subscriptions API

#

you won't get Invoices

#

nor invoice.* events

fringe cypress
#

okay..then what should i use

#

okay

spiral lava
#

or any related subscription events

#

you would have to build the scheduler logic yourself

fringe cypress
#

any reference in the docs

spiral lava
#

no there isn't since this is not something related to Stripe directly

fringe cypress
#

i am lost...is there anything like Intents i need to use

spiral lava
#

I'm not sure why you want to reinvent the wheel here, what is it with Stripe's Subscription that is not compatible with your use case?

fringe cypress
#

invoices...i am not using stripe invoice

#

just that

spiral lava
#

I know you are lost

fringe cypress
#

i am sorry

spiral lava
#

because we ask you to read through docs and you don't

#

we explain and you don't listen

fringe cypress
#

oh..i will do that from now on..please forgive

spiral lava
#

no need for the appology

#

I'm trying to help you out here, but honestly you're doing yourself a disservice by not listening

#

let's go back to point zero

#

forget about Intents/Subscriptions/Invoices

fringe cypress
#

okay

spiral lava
#

You have a customer right?

fringe cypress
#

yes..

spiral lava
#

you want them to have access to a certain service of yours and in return you want them to pay for a recurring fee right?

fringe cypress
#

yes

storm oceanBOT
spiral lava
#

perfect

#

sometimes you want to give them a free trial and other times you don't?

fringe cypress
#

on the first subscription only

#

not on renewing the subscriptions

#

on the three products i ahve

spiral lava
#

so always you have a free trial at the start of any of your Subscriptions, right?

fringe cypress
#

yes

spiral lava
#

you will never have the case where you don't want to offer a free trial upon subscribing

fringe cypress
#

no

spiral lava
#

ok perfect

#

you also want to listen to events to know when the subscription is paid for

fringe cypress
#

yes

spiral lava
#

ok

#

you don't want to use Stripe Checkout, correct?

fringe cypress
#

yes

spiral lava
#

any reasons why?

fringe cypress
#

no reasons, just that the low code option gives less flexibility

spiral lava
#

what is the flexibility that you are searching for?

fringe cypress
#

wanted to try intents as a custom code

spiral lava
#

what do you need that Checkout doesn't give you access to?

#

I really need to understand so I would be able to guide you through your integration

fringe cypress
#

well i can use checkout,...but that also creates intents

#

so used the subscriptions instead

spiral lava
#

@fringe cypress unless I mention intents please forget about them now

fringe cypress
#

ok

spiral lava
#

Stripe Checkout has 3 modes (something I explained yesterday)
1- payment
2- setup
3- subscription

fringe cypress
#

ok

spiral lava
#

each mode offers a different functionality

fringe cypress
#

yes

spiral lava
#

in Setup mode for example you can collect a payment method for a customer without charging them

fringe cypress
#

ok

spiral lava
#

in Subscription mode, you collect a payment method for a customer and Checkout will create a subscription for you

fringe cypress
#

ok

spiral lava
#

so now I will ask my question again: what do you need that Checkout doesn't give you access to?

fringe cypress
#

nothing ..i can use checkout

spiral lava
#

ok good

#

in that case we go back to the conversation we had yesterday about Checkout

fringe cypress
#

yes...shall I use the setup mode since that saves the payment method

#

for future use

spiral lava
#

no because the Subscription will do both

#

create a Subscription

fringe cypress
#

so use the subscription mode

spiral lava
#

save the Payment Method for future payments

#

and create the Invoice and do everything

#

the only thing you need to worry about is listening to the webhook events

#

and figure out what to do to fulfill the order

fringe cypress
#

i wont be using invoices from Stripe

spiral lava
#

but that's a story for the next episode

spiral lava
#

but you can't have Subscriptions without Invoices

#

that's not possible with Stripe

fringe cypress
#

but invoice is an additional add on as it's charged saperately

#

i dont want to buy that option

spiral lava
#

you don't pay extra for invoices if you're already using Subscription

fringe cypress
spiral lava
#

Recurring Invoices are part of the starter pack

#

for Billing

#

it's the One-time Invoices that you would have to pay extra to get access to

fringe cypress
#

whats the difference...

spiral lava
#

let me go back a second

fringe cypress
#

Stripe Invoicing has no fixed fees or setup costs, but Stripe Payments pricing will apply. If you're a business with large invoice amounts, contact sales to discuss pricing options.

spiral lava
#

if you use Payment Intents you would be subject to this pricing model https://stripe.com/pricing
whereas if you use Billing (creating a subscription) you would be subject to this pricing model https://stripe.com/billing/pricing

Stripe Billing powers recurring payments and subscription business models with tools to reduce churn. Use Stripe’s APIs to quickly set up recurring billing and automatic payments for your business. Easily create and manage subscriptions and recurring invoices from the Dashboard.

#

yes the best thing to do is to contact https://support.stripe.com/?contact=true for pricing questions

#

maybe figure out this part to know whether you want to use Billing or not first

#

and then based on this decision we can proceed with the appropriate approach then

fringe cypress
#

ok, so i should use checkout

spiral lava
#

are you going to use Billing?

fringe cypress
#

let me go back and think of it...

#

i will connect with you tomm

#

it's time to go home for me

#

thanks for helping this long

spiral lava
#

no worries take your time, think about this and once you have a decision made please do come back

fringe cypress
#

bbye