Mangopay / mangopay2-php-sdk

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

Payin creation error #511

Closed Geoffray-buhler closed 3 years ago

Geoffray-buhler commented 3 years ago

After have register my Credit card i want to make a payin request so i have issue when i send it

PayIn Object passed : image

My Mangopayservices : image

My controller : image

Error: image

I don't know why i have an error Thank you ^^

H4wKs commented 3 years ago

Hi @Geoffray-buhler, The error is quite explicit, you're missing the ExecutionDetails for your PayIn, and that's not the only thing missing. According to the Payin requirement in the MangoPay API documentation ( https://docs.mangopay.com/endpoints/v2.01/payins#e278_create-a-card-direct-payin ) you're missing:

        $payIn->ExecutionDetails = new PayInExecutionDetailsDirect();
        $payIn->ExecutionDetails->SecureModeReturnURL = "https://your.return.url.com";
        $payIn->PaymentDetails->IpAddress = "";
        $payIn->PaymentDetails->BrowserInfo = new BrowserInfo();
        $payIn->PaymentDetails->BrowserInfo->AcceptHeader = "";
        $payIn->PaymentDetails->BrowserInfo->UserAgent = "";
        $payIn->PaymentDetails->BrowserInfo->Language = "";
        $payIn->PaymentDetails->BrowserInfo->ScreenWidth = "";
        $payIn->PaymentDetails->BrowserInfo->ScreenHeight = "";
        $payIn->PaymentDetails->BrowserInfo->ColorDepth = "";
        $payIn->PaymentDetails->BrowserInfo->TimeZoneOffset = "";
        $payIn->PaymentDetails->BrowserInfo->JavaEnabled = "";
        $payIn->PaymentDetails->BrowserInfo->JavascriptEnabled = "";

Of couse, you can't leave these fields empty, you need to set the correct values. If you search for BrowserInfo over the issue here, you will see some code example on how to achieve it if you need help with it.

Cheers

Geoffray-buhler commented 3 years ago

Ho thank you, i'm sorry but it's my first time to implemente a payment system in web site so i'm sorry if my questions are idiot.

SoloJr commented 3 years ago

Hi @Geoffray-buhler

Mircea from the MangoPay SDKs team. We all started somewhere. There are no questions that should/could be labeled as idiot.

Keep it up and all the best :)

H4wKs commented 3 years ago

@Geoffray-buhler don't worry, we have all been in that first time situation, we all learn new stuff everyday, that's half the fun :) There are no idiot question, and I am very sorry if my answer made you think that. The idea was more that most of the time, the error message will point you in the right direction, and reading the documentation will also show you what the API is expecting.