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 initialize the mangopay object in JavaScript #384

Closed FabianMartin1988 closed 4 years ago

FabianMartin1988 commented 4 years ago

Hello,

we try to integrate the following Code into our Sandbox enviroment:

https://github.com/Mangopay/mangopay2-php-sdk/blob/master/demos/paymentDirect/js/script.js

In the fourth line, the script tries to initialize the mangoPay.cardRegistration.init Object: He does not even know the mangopay object since it is undefined till then. On our Node.js server we use the following code to initialize the MangoPay Api:

var mangopay = require('mangopay2-nodejs-sdk');

var api = new mangopay({ clientId: '100300400', clientApiKey: '2BF0k9Ey2yadk27K3jz9MyqbQ2MGm0tBJKgJ68rFDfCXs04Qsu' });

How do i manage to intitalize the API in Plain Javascript. I cant to a require since it is not supported in HTML (JS) ....

Does anyone have any expirience in integrating the Code above into an HTML / Javascript environment?

Thanks in advance Fabian

catacraciun commented 4 years ago

Please use the https://github.com/Mangopay/cardregistration-js-kit SDK on the client side, in order to manage the user credit cards.

Also, here is the card registration flow described: https://docs.mangopay.com/endpoints/v2.01/cards#e177_the-card-registration-object

The NodeJS SDK is backend only.

Feel free to write in this issue for further information.