When calling retrieveExternalAccount from the API I'd like a response of whether or not the stripe connected account is a card or bank_account and then list the last 4 digits of account or card accordingly.
https://stripe.com/docs/api/external_account_cards/retrieve
require_once 'stripe-php-master/init.php';
//$stripe = new \Stripe\StripeClient($STRIPE_API_KEY);
$stripe = new \Stripe\StripeClient(
$STRIPE_API_KEY
);
$link = $stripe->accounts->retrieve(
$STRIPE_DEST,
[]
);
$linkaccount = $stripe->accounts->retrieveExternalAccount(
$STRIPE_DEST,
[]
);
if ($link->transfers_enabled == FALSE){
echo '<script>top.location.href = "https://www.website.net/oa-drive.php"</script>';
exit();
}
if ($linkaccount->object == "bank_account"){
$accounttype = 'account ending in '.$linkaccount->last4.'';
} else {
$accounttype .= 'card ending in '.$linkaccount->last4.'';
}