I'm attempting to receive the last 4 digits of data list returned from stripe object. So far I have the following. The documentation for this is at: https://stripe.com/docs/api/external_account_bank_accounts/list

require_once 'stripe-php-master/init.php';
//$stripe = new \Stripe\StripeClient($STRIPE_API_KEY);

$stripe = new \Stripe\StripeClient(
    $STRIPE_API_KEY
);
$external = $stripe->accounts->allExternalAccounts(
 $STRIPE_DEST,
 ['object' => 'bank_account', 'limit' => 1]
);

$subsData = $external->jsonSerialize();
$last4 = $subsData['last4'];
//echo $last 4 as last 4 digits 

    And...I'm assuming it's not working as desired? If so, do you have all PHP errors/warnings enabled? If so, anything interesting we should know about from those warnings?

    Otherwise, was does echo "<pre>".var_export($subsData, 1)."</pre>"; give you after you've set it?

      I exchanged some of the numbers below for privacy, however this was the format and output.

      
      array (
        'object' => 'list',
        'data' => 
        array (
          0 => 
          array (
            'id' => 'dfsdfsdfsdfsdf_dfsds',
            'object' => 'bank_account',
            'account' => 'adfadfadfasd',
            'account_holder_name' => NULL,
            'account_holder_type' => NULL,
            'account_type' => NULL,
            'available_payout_methods' => 
            array (
              0 => 'standard',
            ),
            'bank_name' => 'The Bank name was displayed here',
            'country' => 'US',
            'currency' => 'usd',
            'default_for_currency' => true,
            'fingerprint' => 'sdfdsdfsd',
            'last4' => '3534',
            'metadata' => 
            array (
            ),
            'name' => NULL,
            'routing_number' => '3333333',
            'status' => 'new',
      
      

        So looks to me like you'd get it from $subsData['data'][0]['last4'], if I'm reading that right.

          That works, the output array seemed different from the documentation. Thanks

            Write a Reply...