How do i convert ruby codes into php slim?

hi I was trying to convert code from ruby to PHP slim and want to send data from PHP slim with help of to JSON

<pre>$app->get('/order-info', function (Request $request, Response $response) {
  $session = \Stripe\Checkout\Session::retrieve($request->get('session_id'));
  $customer = \Stripe\Customer::retrieve($session->customer);
  
  {
    session: session,
    customer: customer
  }.to_json

});

and in javascript


<pre>document.addEventListener('DOMContentLoaded', async () => {
    var urlParams = new URLSearchParams(window.location.search);
    var sessionId = urlParams.get('session_id');
    
    if (sessionId) {
        const {customer, session} = 
            await fetch(`order-info?session_id=${sessionId}`)
                .then((r) => 
                r.json());
    }
    
});

this is the link to ruby codes which i was trying to convert into php slim

What I have tried:

i have tried this maybe you can help me out if there is some mistake or need some changes to succeed

<pre><?php
  $app->get('/order-info', function (Request $request, Response $response) {
    $session = \Stripe\Checkout\Session::retrieve($request->get('session_id'));
    $customer = \Stripe\Customer::retrieve($session->customer);

    return $response->withJson([ 'session' => $session->session, 'customer' => $customer->customer]);

  });
?>

I do get error slim application error

actually I was learning stripe PHP checkout following stripe php donation page checkout

but in this video they didn’t mention about success page and couldn’t find one in PHP slim, I asked even stripe about this but they were like we will update and its been 1 month no response and one of their representative told docs are not updated so sorry for the inconvenience. so if you guys can help me that will be so helpful to me

It looks like you are still using Slim 3. Which version are you using? What is the error message?

this is the one which i did follow exact

after following this stripe checkout is working fine but all I want to add up is the success [page and that is in ruby and stripe is not providing a tutorial for PHP slim

Are you expecting from me that I watch this 1h video to get an answer for this simple question? :wink:
If you need help, you may contact me via DM to consult me. This forum is not a free programming service.

I just posted video to show what i have done , well i do understand that this is time consuming , thats why stripe are also not helping out i asked them about tutorial tgey said we will update soon its been 1 month nothing came up, and then i asked them to provide doc and one of yhem told me its not updated