Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GrahamMorbyDev's avatar

Stripe retrieve subscription gets blank response

Im trying to implement stripe and Im all good until I try and retrieve a subscription

I send my secret and sub id and get a 200 ok and a blank response

Am I doing anything wrong?

//Create a new stripe instance
        $stripe = new \Stripe\StripeClient(
            config('stripekeys.secret')
        );
        //Retrieve stripe record
        $stripe->subscriptions->retrieve(
            'sub_IV0LDLuFIfKvce'
        );

        //Build return data
        $data = [
            'status' => 200,
            'data' => $stripe
        ];
        //Return data
        return response($data);

I followed the docs here https://stripe.com/docs/api/subscriptions/retrieve?lang=php

0 likes
3 replies
GrahamMorbyDev's avatar
GrahamMorbyDev
OP
Best Answer
Level 4
        $stripe = new \Stripe\StripeClient(
            config('stripekeys.secret')
        );
        //Retrieve stripe record
        $return = $stripe->subscriptions->retrieve(
            'sub_IV0LDLuFIfKvce'
        );

        //Build return data
        $data = [
            'status' => 200,
            'data' => $return
        ];
        //Return data
        return response($return);

This works perfectly

Please or to participate in this conversation.