src/includes/classes/Core/Utils/Stripe.php
public function jsTokenMarkup(\StdClass $token, array $args = []): string
    {
        if (empty($token->id) || !is_string($token->id)) {
            throw $this->c::issue(vars(), 'Token missing `id` property.');
        } elseif (empty($token->type) || !is_string($token->type)) {
            throw $this->c::issue(vars(), 'Token missing `type` property.');
        }
        if ($token->type === 'card' && !empty($token->card->brand) && is_string($token->card->brand)
                && !empty($token->card->last4) && is_string($token->card->last4)
            ) {
            if ($token->card->brand === 'Visa') {
                $_icon = '<i class="visa icon #m:r1"></i>';
            } elseif ($token->card->brand === 'MasterCard') {
                $_icon = '<i class="mastercard icon #m:r1"></i>';
            } elseif ($token->card->brand === 'American Express') {
                $_icon = '<i class="american express icon #m:r1"></i>';
            } elseif ($token->card->brand === 'Discover') {
                $_icon = '<i class="discover icon #m:r1"></i>';
            } elseif ($token->card->brand === 'JCB') {
                $_icon = '<i class="japan credit bureau icon #m:r1"></i>';
            } elseif ($token->card->brand === 'Diners Club') {
                $_icon = '<i class="diners club icon #m:r1"></i>';
            } else { // Just indicate that it's a credit card.
                $_icon = '<i class="credit card alternative icon #m:r1"></i>';
            }
            $markup = $_icon.' <tt data-token="'.$this->c::escAttr(json_encode($token)).'">•••• •••• •••• '.$this->c::escHtml($token->card->last4).'</tt>';
            //
        } elseif ($token->type === 'alipay_account' && !empty($token->alipay_account->username) && is_string($token->alipay_account->username)) {
            $markup = '<i class="yen icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">'.$this->c::escHtml($token->alipay_account->username).'</tt>';
            //
        } elseif ($token->type === 'bank_account' && !empty($token->bank_account->last4) && is_string($token->bank_account->last4)) {
            $markup = '<i class="university icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">…••••'.$this->c::escHtml($token->bank_account->last4).'</tt>';
            //
        } elseif ($token->type === 'source_bitcoin' && !empty($token->bitcoin->address) && is_string($token->bitcoin->address)) {
            $markup = '<i class="bitcoin icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">'.$this->c::escHtml($token->bitcoin->address).'</tt>';
            //
        } else { // Generic default display using Stripe icon.
            $markup = '<i class="stripe icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">'.$this->c::escHtml($token->id).'</tt>';
        }
        return $markup;
    }
public function jsTokenMarkup(\StdClass $token, array $args = []): string
    {
        if (empty($token->id) || !is_string($token->id)) {
            throw $this->c::issue(vars(), 'Token missing `id` property.');
        } elseif (empty($token->type) || !is_string($token->type)) {
            throw $this->c::issue(vars(), 'Token missing `type` property.');
        }
        if ($token->type === 'card' && !empty($token->card->brand) && is_string($token->card->brand)
                && !empty($token->card->last4) && is_string($token->card->last4)
            ) {
            if ($token->card->brand === 'Visa') {
                $_icon = '<i class="visa icon #m:r1"></i>';
            } elseif ($token->card->brand === 'MasterCard') {
                $_icon = '<i class="mastercard icon #m:r1"></i>';
            } elseif ($token->card->brand === 'American Express') {
                $_icon = '<i class="american express icon #m:r1"></i>';
            } elseif ($token->card->brand === 'Discover') {
                $_icon = '<i class="discover icon #m:r1"></i>';
            } elseif ($token->card->brand === 'JCB') {
                $_icon = '<i class="japan credit bureau icon #m:r1"></i>';
            } elseif ($token->card->brand === 'Diners Club') {
                $_icon = '<i class="diners club icon #m:r1"></i>';
            } else { // Just indicate that it's a credit card.
                $_icon = '<i class="credit card alternative icon #m:r1"></i>';
            }
            $markup = $_icon.' <tt data-token="'.$this->c::escAttr(json_encode($token)).'">•••• •••• •••• '.$this->c::escHtml($token->card->last4).'</tt>';
            //
        } elseif ($token->type === 'alipay_account' && !empty($token->alipay_account->username) && is_string($token->alipay_account->username)) {
            $markup = '<i class="yen icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">'.$this->c::escHtml($token->alipay_account->username).'</tt>';
            //
        } elseif ($token->type === 'bank_account' && !empty($token->bank_account->last4) && is_string($token->bank_account->last4)) {
            $markup = '<i class="university icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">…••••'.$this->c::escHtml($token->bank_account->last4).'</tt>';
            //
        } elseif ($token->type === 'source_bitcoin' && !empty($token->bitcoin->address) && is_string($token->bitcoin->address)) {
            $markup = '<i class="bitcoin icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">'.$this->c::escHtml($token->bitcoin->address).'</tt>';
            //
        } else { // Generic default display using Stripe icon.
            $markup = '<i class="stripe icon #m:r1"></i> <tt data-token="'.$this->c::escAttr(json_encode($token)).'">'.$this->c::escHtml($token->id).'</tt>';
        }
        return $markup;
    }
JS token as HTML markup.

@since 170329.13807 Stripe utils.

@param \StdClass $token JS token.
@param array     $args  Behavioral args.

@return string HTML markup representation.