Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
122 stars 133 forks source link

how to find a user by his email ? #461

Closed vrax-coder closed 3 years ago

vrax-coder commented 3 years ago

Hi, I know how to find a user by his userId, like that : $User = $Api->Users->Get($UserId);

now I want t do the same but by his email. How can I do ???

Thanks

tdumalin commented 3 years ago

Hi,

I don't think it's possible, since multiple user can have the same email in mangopay and there is no filter on the user list endpoint: https://docs.mangopay.com/endpoints/v2.01/users#e257_list-all-users

You should store the userId in the an user table in your database

FYI some endpoint let you filter the list query, Kyc documents for instance: https://docs.mangopay.com/endpoints/v2.01/kyc-documents#e217_list-all-kyc-documents With the SDK you can do something like this:

$filter = new \MangoPay\FilterKycDocuments();
$filter->Status = \MangoPay\KycDocumentStatus::Created;
$documents = $api->KycDocuments->GetAll(null,null,$filter);

Hope this help,

vrax-coder commented 3 years ago

hi, Yes it help. Thanks !!