#marroco0488_code
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1222272719115256019
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
When you start a subscription with a trial, the first invoice that's generated is for $0
Hence no payment is required in that case, so there's no PaymentIntent client-secret
If you're trying to use the client-secret to render elements then you can use pending_setup_intent property on subscription instead
$subscription->latest_invoice->pending_setup_intent Is this how i get that?
thanks in that case this pending_setup_intent will go as a clientSecret? -> createPaymentCard(clientSecret) {
if ( this.card) {
this.card.unmount();
this.elements=null;
}
this.stripe = Stripe('....');
const appearance = {
theme: 'stripe'
};
const options = {
layout: {
type: 'tabs',
defaultCollapsed: false,
}
};
this.elements = this.stripe.elements({ clientSecret ,appearance});
this.card = this.elements.create('payment');
this.card.mount('#payment-element');
you'd need to expand the pending_setup_intent parameter to see SetupIntent's client-secret
but yes you can use that to initialize elements
i have this error -> This property cannot be expanded (pending_setup_intent).
Can you share the request ID?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Can you share the code you're using for this?
You seem to be still passing: expand: ["latest_invoice.payment_intent"]
https://dashboard.stripe.com/logs/req_tSmVz5fmrChtpS
req_omyXeQUZo5dUxc
You're calling GET /v1/charges endpoint to retreive subscription
https://dashboard.stripe.com/logs/req_omyXeQUZo5dUxc
which is wrong
im using the method charges->retrieve -> $subscription = $stripe->subscriptions->create([
'customer' => $customerId,
'items' => [[
'price' => 'price_1LAxd9BHYS6r19T02EhtArGq',
]],
'trial_end' => $thirtyDaysFromNow,
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
]);
$setupintent= $stripe->charges->retrieve(
$subscription->id,
['expand' => ['pending_setup_intent']]
);
dd($setupintent);
$setupintent= $stripe->charges->retrieve( that's what's causing the issue.
You need
https://docs.stripe.com/api/subscriptions/retrieve
$stripe->subscriptions->retrieve('sub_xxx', []);
thanks, that solve the issue