[Skip to main content](#vessel-content)

#   Problem uploading KYC documents to Mangopay

##

- **[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")**
- [![sabroso's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/38789-sabroso "View sabroso's Profile") Topic Author
- [ Offline](/forum/user/38789-sabroso)

Less More

- Posts: 128
- Thank you received: 2
-
-

10 years 1 day ago -  10 years 1 day ago [\#255615](#255615) by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile")  *[Problem uploading KYC documents to Mangopay](/forum/22-market-bug-report/887549-problem-uploading-kyc-documents-to-mangopay#255615 "-- HikaShop version -- : 2.6.4 -- HikaMarket version -- : 1.7.2 -- Joomla version -- : 3.6.4 -- PHP version -- : 5.6  Hi there,  When uploading a KYC document to Mangopay via the Hikamarket Mangopay plugin (version 1.7.3) there is always an error message  There are no php or Mangopay error messages in the php and Mangopay logs.  I have done some troubleshooting and the problem seems to be in the file plugins/hikamarket/mangopay/mangopay&#95;class.php inside the funtion addDocument()  The condition on line 210 is always met and hence it returns FALSE and the error message I quoted above shows.  on line 204 the file is uploaded to Mangopay as follows  However it looks like the variable $createdPage always gets the value NULL  I'm not sure the document is being uploaded to Mangopay since in the Mangopay dashboard I cannot see the document itself.  Looking at the Mangopay API documentation it seems to suggest that the variable $file needs to be a string containing the file as base64 encoded.  in your code, line 186, $file is an array as follows  Could you please look into this an advice?  Many thanks")* was created by *[sabroso](/forum/user/38789-sabroso "View sabroso's Profile")*

-- HikaShop version -- : 2.6.4
-- HikaMarket version -- : 1.7.2
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6

Hi there,

When uploading a KYC document to Mangopay via the Hikamarket Mangopay plugin (version 1.7.3) there is always an error message
Code:

Error Error Saving

There are no php or Mangopay error messages in the php and Mangopay logs.

I have done some troubleshooting and the problem seems to be in the file plugins/hikamarket/mangopay/mangopay_class.php inside the funtion addDocument()

The condition on line 210 is always met and hence it returns FALSE and the error message I quoted above shows. Code:

if(empty($createdPage)) return false;

on line 204 the file is uploaded to Mangopay as follows Code:

$createdPage = $api-&gt;Users-&gt;CreateKycPageFromFile($mango_vendor-&gt;Id, $createdDocument-&gt;Id, $file);

However it looks like the variable $createdPage always gets the value NULL

I'm not sure the document is being uploaded to Mangopay since in the Mangopay dashboard I cannot see the document itself.

Looking at the Mangopay API documentation it seems to suggest that the variable $file needs to be a string containing the file as base64 encoded.

in your code, line 186, $file is an array as follows

> $file = $\_FILES;

Could you please look into this an advice?

Many thanks

Last edit: 10 years 1 day ago by [sabroso](/forum/user/38789-sabroso "View sabroso's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIyLW1hcmtldC1idWctcmVwb3J0Lzg4NzU0OS1wcm9ibGVtLXVwbG9hZGluZy1reWMtZG9jdW1lbnRzLXRvLW1hbmdvcGF5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 1 day ago [\#255629](#255629) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Problem uploading KYC documents to Mangopay](/forum/22-market-bug-report/887549-problem-uploading-kyc-documents-to-mangopay#255629 "-- HikaShop version -- : 2.6.4 -- HikaMarket version -- : 1.7.2 -- Joomla version -- : 3.6.4 -- PHP version -- : 5.6  Hi there,  When uploading a KYC document to Mangopay via the Hikamarket Mangopay plugin (version 1.7.3) there is always an error message  There are no php or Mangopay error messages in the php and Mangopay logs.  I have done some troubleshooting and the problem seems to be in the file plugins/hikamarket/mangopay/mangopay&#95;class.php inside the funtion addDocument()  The condition on line 210 is always met and hence it returns FALSE and the error message I quoted above shows.  on line 204 the file is uploaded to Mangopay as follows  However it looks like the variable $createdPage always gets the value NULL  I'm not sure the document is being uploaded to Mangopay since in the Mangopay dashboard I cannot see the document itself.  Looking at the Mangopay API documentation it seems to suggest that the variable $file needs to be a string containing the file as base64 encoded.  in your code, line 186, $file is an array as follows  Could you please look into this an advice?  Many thanks")*

Hi

For the function "CreateKyCPageFromFile", see the definition here :
1.6 - [ github.com/Mangopay/mangopay2-php-sdk/bl...ls/apiUsers.inc#L224](https://github.com/Mangopay/mangopay2-php-sdk/blob/v1.6/MangoPaySDK/tools/apiUsers.inc#L224)
2.4.1 - [ github.com/Mangopay/mangopay2-php-sdk/bl...ay/ApiUsers.php#L285](https://github.com/Mangopay/mangopay2-php-sdk/blob/v2.4.1/MangoPay/ApiUsers.php#L285)

I cannot tell you like that why you document is not uploaded but I can see that the SDK is not consistent.
While every function return the content which is coming from the "CreateObject" function, that specific one, do not..
Which in fact, shouldn't surprise me ; even if they own code made the same error :
1.7 - [ github.com/Mangopay/mangopay2-php-sdk/bl...flow/scripts/kyc.php](https://github.com/Mangopay/mangopay2-php-sdk/blob/v1.7/demos/workflow/scripts/kyc.php)
2.4.1 - [ github.com/Mangopay/mangopay2-php-sdk/bl...flow/scripts/kyc.php](https://github.com/Mangopay/mangopay2-php-sdk/blob/v2.4.1/demos/workflow/scripts/kyc.php)

But while in their code there is no check of the variable, I made the mistake to think that the function returned something... And the patch I implemented became an error....

So please replace the code by Code:

$createdPage = false; try { $api-&gt;Users-&gt;CreateKycPageFromFile($mango_vendor-&gt;Id, $createdDocument-&gt;Id, $file); $createdPage = true; }

So the plugin will still handle the PHP exception in the MangoPay SDK.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIyLW1hcmtldC1idWctcmVwb3J0Lzg4NzU0OS1wcm9ibGVtLXVwbG9hZGluZy1reWMtZG9jdW1lbnRzLXRvLW1hbmdvcGF5P3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.064 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
