EasyPost\CarrierAccount::types PHP Method

types() public static method

get types of carrier account
public static types ( mixed $params = null, string $apiKey = null ) : mixed
$params mixed
$apiKey string
return mixed
    public static function types($params = null, $apiKey = null)
    {
        $requestor = new Requestor($apiKey);
        list($response, $apiKey) = $requestor->request('get', '/carrier_types', $params);
        return Util::convertToEasyPostObject($response, $apiKey);
    }

Usage Example

define("ECHO_ALL_CA", true);
define("ECHO_CA_TYPES", false);
define("CREATE_NEW_CA", false);
define("EDIT_CA", false);
define("DELETE_CA", false);
// retrieve all of your CarrierAccounts
if (ECHO_ALL_CA) {
    $my_carrier_accounts = \EasyPost\CarrierAccount::all();
    print_r($my_carrier_accounts);
}
// This method returns all CarrierAccount types that are available
// to you to create, and the structure of their credentials.
// Especially useful for creating your own interface for collecting
// an end user's CarrierAccount credentials.
if (ECHO_CA_TYPES) {
    $carrier_account_types = \EasyPost\CarrierAccount::types();
    foreach ($carrier_account_types as $ca_type) {
        print "===========\n";
        print "Carrier Account type: " . $ca_type->type . "\n";
        print "Readable name: " . $ca_type->readable . "\n";
        print "Logo: " . $ca_type->logo . "\n";
        print "Credentials: \n";
        foreach ($ca_type->fields["credentials"] as $key => $value) {
            print "  " . $key . " - ";
            print "  " . $value->label . " (" . $value->visibility . ")\n";
        }
        print "===========\n\n";
    }
}
// create a new CarrierAccount
if (CREATE_NEW_CA) {