#sarvesh3742

1 messages · Page 1 of 1 (latest)

kind briarBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

midnight ether
#

@orchid kernel hi, what was your question?

orchid kernel
#

Hi
I am createing subcription with 7 days trial period with below call but it does not ask for user card details to input and directly sending invoice.paid webhook with paid status

$subscription = $stripe->subscriptions->create([
'customer' => $stripe_customer_id,
'items' => [[
'price' => $stripePriceId,
]],
'metadata' => $metaData,
'trial_period_days' => 7,
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
//'expand' => ['latest_invoice.payment_intent'],
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],
]);

#

when user can enter is card details in this case?

kind briarBOT
lime pilot
#

Hi there 👋 in the future, please provide your question/concern in your original message, it helps us help you faster.

That's expected behavior. You're creating a Subscription with a trial period, so the first Invoice is a zero-dollar Invoice, and those are automatically considered paid since they don't process a payment.

If you're building a flow that creates Subscriptions via the API, then it's up to you to decide when in your flow you want to collect payment method details.

orchid kernel
#

yes, we want to collect the payment method (card details from user) initially on pay now page when user clicks on subscribe button. we had that flow working with code without 'trial_period_days' => 7 and pending_setup_intent' which we adds additional.
After that it does not show the payment method form to add card details

lime pilot
#

Subscriptions with a trial period should still create a Setup Intent and put its ID in pending_setup_intent on the Subscription object for you to use to setup a Payment Method.

orchid kernel
#

yes, so here we are sending it 'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],

#

need to remove first option latest_invoice.payment_intent from it to get the payment method form?

lime pilot
#

I don't know, I don't know how you're triggering your form, but probably not.

lime pilot
#

Do you have more details about how you're triggering your form to collect payment method details?

orchid kernel
#

in case of $0 payment is there any status / fields which can say about trial period is active or status as trial?

#

in invoice.paid webhook event response gives me
status: paid
"amount_due": 0,
"amount_paid": 0,
"amount_remaining": 0,
"amount_shipping": 0,
"trial_period_days": null,

#

how to detect from invoice.paid webhook event whether it is trial period notification or recurring?

lime pilot
orchid kernel
#

ok, and getting another error on payment details screen
planSubscribe:355 Uncaught (in promise) IntegrationError: Your code called confirmPayment() but you passed a client_secret associated with a SetupIntent. Did you mean to call confirmSetup() instead?