#marroco0488_code

1 messages · Page 1 of 1 (latest)

glacial needleBOT
#

👋 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/1222631223227191367

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

chrome shuttleBOT
#

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.

graceful stone
#

Hello

#

What does "not working" mean exactly?

#

Do you see a specific error?

cedar drift
#

v3/:1 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?
at xe (v3/:1:85614)
at e._handleMessage (v3/:1:91173)
at e._handleMessage (v3/:1:103445)
at v3/:1:89293
xe @ v3/:1
_handleMessage @ v3/:1
(anonymous) @ v3/:1
(anonymous) @ v3/:1
v3/:1 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?
at xe (v3/:1:85614)
at e._handleMessage (v3/:1:91173)
at e._handleMessage (v3/:1:103445)
at v3/:1:89293

graceful stone
#

Are you passing the client secret associated with the pending_setup_intent from the Subscription?

cedar drift
#

yes, but I solve that part i just change the confirmPayment with the confirmSetup(

graceful stone
#

Okay so are you still hitting an error after updating that?

cedar drift
#

but now i haven an issue as you can see here -> Route::get('/checkout-success/success', function (Request $request) {
$paymentIntent = $request->query('payment_intent');
$paymentIntentClientSecret = $request->query('payment_intent_client_secret');
$redirectStatus = $request->query('redirect_status');

// Aquí puedes realizar cualquier lógica necesaria con estos parámetros
// Por ejemplo, validar el estado del pago, registrar información en la base de datos, etc.

// Luego pasas los parámetros a la vista
return view('payment.checkout-success', [
    'paymentIntent' => $paymentIntent,
    'paymentIntentClientSecret' => $paymentIntentClientSecret,
    'redirectStatus' => $redirectStatus,
]);

})->name('check-success');... I try to collect this parameter from the url but I think give me other parameters as setup_intent_client_secret

cedar drift
graceful stone
#

Yes, if you are using a SetupIntent then the URL parameters will change accordingly

cedar drift
#

and what i will need to change here -> try {
$intent = PaymentIntent::retrieve($paymentIntentId);

        // Obtener el ID del cliente (Customer ID)
        $customerId = $intent->customer;

        // Si el PaymentIntent fue creado como parte de una suscripción,
        // podrías intentar obtener el ID de la suscripción a través de la factura asociada (Invoice)
        $invoiceId = $intent->invoice;
        if ($invoiceId) {
            $invoice = \Stripe\Invoice::retrieve($invoiceId);
            $subscriptionId = $invoice->subscription; // Aquí obtienes el Subscription ID


            $subcription=$this->getSubscription($subscriptionId);
        }
graceful stone
cedar drift
#

from the $intent = $stripe->setupIntents->retrieve($paymentIntentId, []);
setup intent how can i ge tthe subscriptionid ?

graceful stone
#

Ah yeah you can't go SetupIntent --> Invoice as they aren't directly related. Mostly you should already know the Subscription anyways... it seems your code overcomplicates things here by default. Why not just pass the Subscription ID through as a query param and then pass it back to your backend after success?

cedar drift
#

you are rigth