Skip to main content
The ApiRegulatory class provides methods to retrieve regulatory information about country authorizations. This helps you understand which Mangopay features are available in specific countries and any restrictions that may apply.

Methods

GetCountryAuthorizations

Retrieves authorization information for a specific country.
public function GetCountryAuthorizations($countryCode)
return
\MangoPay\CountryAuthorization
The CountryAuthorization object containing authorization details for the specified country

Example

$api = new \MangoPay\MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';

$countryAuth = $api->Regulatory->GetCountryAuthorizations('FR');

echo "Country: " . $countryAuth->CountryName . "\n";
echo "Country Code: " . $countryAuth->CountryCode . "\n";
echo "Last Updated: " . $countryAuth->LastUpdate . "\n";

if ($countryAuth->Authorization) {
    // Access authorization data
    echo "Authorization details available\n";
}

GetAllCountryAuthorizations

Retrieves authorization information for all countries with optional pagination and sorting.
public function GetAllCountryAuthorizations(
    & $pagination = null,
    $sorting = null
)
return
\MangoPay\CountryAuthorization[]
Array of CountryAuthorization objects for all countries

Example

$api = new \MangoPay\MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';

$pagination = new \MangoPay\Pagination(1, 100);
$sorting = new \MangoPay\Sorting();
$sorting->AddField('CountryCode', 'ASC');

$authorizations = $api->Regulatory->GetAllCountryAuthorizations(
    $pagination,
    $sorting
);

foreach ($authorizations as $auth) {
    echo $auth->CountryCode . ": " . $auth->CountryName . "\n";
}

echo "\nTotal countries: " . $pagination->TotalItems . "\n";

CountryAuthorization Object

The CountryAuthorization object contains regulatory information for a specific country.
CountryCode
string
The ISO 3166-1 alpha-2 country code
CountryName
string
The full name of the country
Authorization
\MangoPay\CountryAuthorizationData
Object containing detailed information about the country’s restrictions and authorized features. This includes information about:
  • Blocked user types
  • Blocked payment methods
  • Blocked functionality
  • Other country-specific restrictions
LastUpdate
string
The date and time when at least one of the authorizations was last updated

Use Cases

Check country availability

Before onboarding users from a specific country, check if Mangopay services are available:
$countryAuth = $api->Regulatory->GetCountryAuthorizations('US');

if ($countryAuth->Authorization) {
    // Check specific restrictions
    echo "Country is supported\n";
} else {
    echo "Country may have restrictions\n";
}

Display supported countries

Retrieve all country authorizations to display a list of supported countries in your application:
$pagination = new \MangoPay\Pagination(1, 200);
$authorizations = $api->Regulatory->GetAllCountryAuthorizations($pagination);

$supportedCountries = [];
foreach ($authorizations as $auth) {
    $supportedCountries[] = [
        'code' => $auth->CountryCode,
        'name' => $auth->CountryName
    ];
}

// Use $supportedCountries in your UI

Monitor regulatory changes

Regularly check the LastUpdate field to stay informed about regulatory changes:
$authorizations = $api->Regulatory->GetAllCountryAuthorizations();

foreach ($authorizations as $auth) {
    $lastUpdate = strtotime($auth->LastUpdate);
    $daysSinceUpdate = (time() - $lastUpdate) / (60 * 60 * 24);
    
    if ($daysSinceUpdate < 30) {
        echo $auth->CountryCode . " was recently updated\n";
    }
}

Best Practices

Cache country authorization data in your application to reduce API calls. Update the cache daily or when you receive notifications about regulatory changes.
Always check country authorizations before enabling features for users from specific countries. Regulatory requirements may restrict certain payment methods or user types.
Regulatory information can change over time. Implement a process to regularly refresh your cached data and notify affected users of any changes.

Compliance Considerations

Country authorization data helps you:
  • Ensure compliance - Stay compliant with local regulations by understanding country-specific restrictions
  • Plan market expansion - Evaluate which countries support your required features before expanding
  • Manage user expectations - Inform users about available payment methods and features based on their country
  • Implement geo-restrictions - Block or allow access to features based on regulatory requirements

Build docs developers (and LLMs) love