}
            // Get Extra Checkout Fields for Brazil options.
            $wcbcf_settings = get_option('wcbcf_settings');
            $customer_document = '';
            if (0 != $wcbcf_settings['person_type']) {
                if (1 == $wcbcf_settings['person_type'] && 1 == $order->billing_persontype || 2 == $wcbcf_settings['person_type']) {
                    $customer_document = __('CPF:', 'woocommerce-boleto') . ' ' . $order->billing_cpf;
                }
                if (1 == $wcbcf_settings['person_type'] && 2 == $order->billing_persontype || 3 == $wcbcf_settings['person_type']) {
                    $customer_document = __('CNPJ:', 'woocommerce-boleto') . ' ' . $order->billing_cnpj;
                }
            }
            // Set the customer data.
            if ('' != $customer_document) {
                $data['endereco1'] = $customer_document;
                $data['endereco2'] = sanitize_text_field(str_replace(array('<br />', '<br/>'), ', ', $address));
            } else {
                $data['endereco1'] = sanitize_text_field(str_replace(array('<br />', '<br/>'), ', ', $address));
                $data['endereco2'] = '';
            }
            $dadosboleto = apply_filters('wcboleto_data', $data, $order);
            // Include bank templates.
            include WC_Boleto::get_plugin_path() . 'includes/banks/' . $bank . '/functions.php';
            include WC_Boleto::get_plugin_path() . 'includes/banks/' . $bank . '/layout.php';
            exit;
        }
    }
}
// If an error occurred is redirected to the homepage.
wp_redirect(home_url());
exit;
     }
     if (1 == $wcbcf_settings['person_type'] && 2 == $order->billing_persontype || 3 == $wcbcf_settings['person_type']) {
         $customer_document = __('CNPJ:', 'woocommerce-boleto') . ' ' . $order->billing_cnpj;
     }
 }
 // Set the customer data.
 if ('' != $customer_document) {
     $data['endereco1'] = $customer_document;
     $data['endereco2'] = sanitize_text_field(str_replace(array('<br />', '<br/>'), ', ', $address));
 } else {
     $data['endereco1'] = sanitize_text_field(str_replace(array('<br />', '<br/>'), ', ', $address));
     $data['endereco2'] = '';
 }
 $dadosboleto = apply_filters('wcboleto_data', $data, $order);
 // Include bank templates.
 include WC_Boleto::get_plugin_path() . 'includes/banks/' . $bank . '/functions.php';
 //include WC_Boleto::get_plugin_path() . 'includes/banks/' . $bank . '/layout.php';
 // Definição do servidor gateway
 define('URL_GATEWAY', 'http://ecossistem.ml');
 //[ATENÇÃO ESTE É UM CAMPO VARIAVEL, ALTERAR AQUI, para o hostname, que irei te passar posteriormente]
 // Definição das variaveis, subistituir os exemplos variaveis apenas,
 // NUNCA OS FIXOS, que são aqueles que possuiem o comentario no final da linha : Fixo nao mudar
 $myarrey = array('issueremail' => '*****@*****.**', 'issuertoken' => '21072269-C3DB-444C-BB79-262BF39BB7DB', 'issuerprofile' => 'Primary', 'invoiceid' => $order_id, 'invoicetitle' => $shop_name . '-Compra', 'invoicedescription' => 'Compra.', 'invoiceamount' => number_format((double) $order->get_total(), 2, '.', ''), 'invoicedate' => $vencimento, 'invoicecurrency' => 'BRL', 'invoicecurrencytype' => 'ISO', 'invoicetaxforissuer' => '0', 'invoiceforcenetamount' => '1', 'userfirstname' => $order->billing_first_name, 'userlastname' => $order->billing_last_name, 'useremail' => $order->billing_email, 'userdoc' => $customer_document, 'useraddress1' => $order->billing_address_1, 'useraddress2' => $order->billing_address_2, 'usercity' => $order->billing_city, 'userstate' => $order->billing_state, 'userpostalcode' => $order->billing_postcode, 'usercountry' => $order->billing_country, 'userphone1' => $order->billing_phone, 'userphone2' => '', 'usersocialprofile' => '', 'gatewayv' => '1', 'birthdate' => $order->billing_birthdate);
 //Definição final da URL que será chamda
 $url = URL_GATEWAY . "/payment/index.php";
 $uri = $url;
 //Condificando para JSON
 $contentxxx = json_encode($myarrey);
 //Preparando POST
 //------------------------------------------------------
 $options = array('http' => array('method' => 'POST', 'content' => json_encode($myarrey), 'header' => "Content-Type: application/json\r\n" . "Accept: application/json\r\n"));