#lordcyber - Issuing Laravel PHP

1 messages · Page 1 of 1 (latest)

broken flame
#

I have not personally but am happy to look in to it and consult my colleagues who would be more familiar with that if need be

#

What are you running in to?

gusty talon
#

am having issues connecting my controller with the server to retrieve the cardholders i have created and also create a cardholder directly through the API

#

this is the function I was using to access the data.

#

public function list()
{
Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
$data = \Stripe\Issuing\Cardholder::list()->json();
return view('backend.list',['data'=> $data]);
}

broken flame
#

Gotcha. And what error are you seeing?

gusty talon
#

With this normally its supposed to work but am getting $data not declared whiles its already been declared and passed to the view to display as a json format

broken flame
#

Is the \Stripe\Issuing\Cardholder::list() call failing then?

#

Or you are getting this error despite that resolving successfully?

gusty talon
#

Yes, i have tried several times with every method I know of working with Stripe packages have failed

#

The only tutorial on YouTube that talks about this is in Ruby of which am not an expect in that, but since the development uses MVC model i understood the concept.

broken flame
#

What is the error that the call is returning?

gusty talon
broken flame
gusty talon
#

No test record is showing there

broken flame
#

If you make just the list call what error do you see?

gusty talon
#

Here is the code please

broken flame
#

Understood. But if you break that code out in to just calling Stripe\Stripe::setApiKey(env('STRIPE_SECRET')); $data = \Stripe\Issuing\Cardholder::list()->json();

#

Do you see any errors?

#

We've narrowed down where the error is likely happening but it is important to see the error itself to address it

#

the error before then rather

gusty talon
#

yes please. This is the error am getting.

gusty talon
#

Is it possible to hit this endpoint
/v1/issuing/cardholders with the stripe library installed and how would it be done please

rugged heron
#

that's exactly what Pompey said above

#

Really you seem to be mixing things up with your own templating system but the first step is to call Stripe's API and look at the response

gusty talon
#

Still facing the same issues

#

If its possible can you please spear some few seconds of your time and make a quick demo on that so we know how to get things up and running.

#

Laravel cashier doesn't come along with this feature .

rugged heron
#

We gave you the exact PHP code to use above, there's not much more to it than this though. I don't understand the problem you have

#

the data thing in your screenshot is purely due to your own template

#

you need to ignore that completely for a few minutes and just focus purely on the PHP code that calls our API and log the information you get back

#

does that make sense?

rugged heron
#

@gusty talon did that make sense? Are you making progress?

gusty talon
#

@rugged heron please am still working on it please

rugged heron
#

sounds good!

rugged heron
#

@gusty talon please talk here, no reason to DM with the same question

#

and I already explained above, I gave you the exact doc and my colleague gave you the exact PHP code

gusty talon
#

Ok Snr

rugged heron
#

You shouldn't think about a "url" or anything like that

#

It's really simple PHP. If you could share your exact code that would really help I think

gusty talon
#

Can i share via GitHub ?

gusty talon
#

please here is the exact code . A cardholder has already been created but retrieving the cardholders details in a json format that's where the issue is still for me. When I work with the stripe payment and other features with this same method it works but for the stripe issuing it doesn't .

rugged heron
#

please don't share pictures of code

#

and move away from Laravel completely for a bit

#

you need to focus on the basics of PHP first

#

just write a one-off PHP script that does any API Request with Stripe as you don't seem to have used it before

#

but really as the developer, you should be logging the content of what is returned on line 18 of your 3rd screenshot

gusty talon
rugged heron
#

that's what's blocking your right now, you call Stripe and have no idea if that call worked

#

I'd also remove the ->json() entirely

#

let me know if that doesn't make sense

gusty talon
#

Am refactoring my code now based on your information please

rugged heron
#

sounds good

gusty talon
#

whiles trying to retrieve the data which is been stored inside my variable with the new method am using. Am getting the error $data not defined. What I did was clear the foreach statement and also removed the ->json() and that's when this error came up again please.

rugged heron
#

yeah you're still deep in Laravel and not really understanding the code

#

you really need to stop for a few minutes. Don't look at Laravel, UIs, templates

#

just add good old echo and var_dump calls to your PHP please

gusty talon
#

Alright

#

there is no error appearing now but the data from the api is not showing up when i call the function inside the var_dump(list());

rugged heron
#

what does var_dump(list()); mean? What even is list();?

#

Please share real code (not pictures) of that exact part

gusty talon
#

What I meant to say was I tried dumping the data from the Api to my view using the print_r($list); The $list is the name i gave to my controller.

#

Am going to pause the development with laravel and use the normal php structure for now and see if that would work. After it does then I redevelop it with laravel . Thanks very much for your support.

rugged heron
#

yeah that's my advice too

#

you're too deep in Laravel and not verifying the content of your variables in your controller

#

print_r prints to the general output and not the view so you want to read your PHP console or use error_log