Mangopay / cardregistration-js-kit

Mangopay V2 JS resources for card registration front-end workflow
MIT License
38 stars 34 forks source link

Error result when cardregister : undefined #28

Closed BaBraux closed 7 years ago

BaBraux commented 7 years ago

Hello,

I'm getting a Resultcode undefined when I'm doing :

mangoPay.cardRegistration.registerCard(cardData, 
        function(res) {
            var message = 'Card registered : ' + res.CardId + '.<br />';
            message += 'Card is now ready to use e.g. in a «Direct PayIn» Object.';
            alert(message);
        },
        function(res){ 
            alert("Error card not registered : " + "ResultCode: " + res.ResultCode + ", ResultMessage: " + res.ResultMessage);
        }
    );

Res return 404... so res.ResultCode gives undefined. All var needed seems init. Any idea from where this error come from since I got no error message.

Thanks

BaBraux commented 7 years ago

It was as simple as the clientid missing : mangoPay.cardRegistration.clientId before :

mangoPay.cardRegistration.init({ cardRegistrationURL : cardRegistrationURL, preregistrationData : preregistrationData, accessKey : accessKey, Id : cardRegistrationId, });