#sarvesh3742

1 messages · Page 1 of 1 (latest)

main acornBOT
#

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.

peak forum
#

hello! how can I help?

potent nexus
#

Hi, I would like to create subscription with 7 days trial period for Monthly and Yearly Subscriptions.

#

$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'],
]);

#

This is something I am using, but it was not asking the card details and received payment invoice.paid webhook event

#

what could be the reason

peak forum
#

that's expected behaviour, to collect payment method details for a Subscription that has a $0 first payment, you'll want to expand [0] the pending_setup_intent [1] when creating the Subscription and use that to initialize the Payment Element.

[0] https://stripe.com/docs/api/expanding_objects
[1] https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent

main acornBOT
potent nexus
#

ok os If I use
'trial_period_days' => 7,
'expand' => ['latest_invoice.payment_intent', 'pending_setup_intent'],

So it will create subscription with $0 initially and user can get access to site by receiving invoice.paid status - Paid ?
after 7 days trial period is over, it will send again a webhook by charing customer cards and payment status as paid again?

#

in which steps user can enter their card details in 0 or 1 step?

sturdy scaffold
#

So it will create subscription with $0 initially and user can get access to site by receiving invoice.paid status - Paid ?
Yes

#

after 7 days trial period is over, it will send again a webhook by charing customer cards and payment status as paid again?
yes, as the customer has filled their payment method using the intial pending_setup_intent

#

'expand' => ['latest_invoice.payment_intent', '**latest_invoice.**pending_setup_intent'],

#

in which steps user can enter their card details in 0 or 1 step?
in 0

potent nexus
#

ok, and in webhook events which field we need to check for 0 and 1 step to see whether it is trial payment or acutual payment happen for the user and he can access the project after trial period is over

sturdy scaffold