vendredi 24 juillet 2020

Passing Stripe Payment Methods to Laravel View

I am trying to load previously used cards using the Stripe API using Laravel using this link from Stripe https://stripe.com/docs/api/payment_methods/list?lang=php

Here is the snippet of code from my controller:

 $stripe = new \Stripe\StripeClient(
            'sk_test_51GueZuLq4MEy
          );


    $customer_id = "cus_HhnBT9fpjxW3hn";
    
    $paymentMethods = $stripe->paymentMethods->all([
            'customer' => $customer_id,
            'type' => 'card',
          ]);
    
    $pm = ($paymentMethods->data);
    
    return view('payment.details', $pm);

However when I am trying to pass the card data into my view I am unable to do so. The variable I am passing in views is:


The error message I get is that my variable is not recognised. The data I am trying to access is $paymentmethods->-data->card->last4

Any help is always appreciated



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3hwv4Ug
via IFTTT

Aucun commentaire:

Enregistrer un commentaire