_tokenizeCard(cardData, successCallback, errorCallback) {

			// Get Payline token
			mangoPay._networking._ajax({

				// Payline expects POST
				type: "post",

				// Payline service URL obtained from the mangoPay.cardRegistration.init() call
				url: this._cardRegisterData.cardRegistrationURL,

				// Force CORS
				crossDomain: true,

				// Sensitive card data plus pre-registration data and access key received from the mangoPay.cardRegistration.init() call
				data: {
					data: this._cardRegisterData.preregistrationData,
					accessKeyRef: this._cardRegisterData.accessKey,
					cardNumber: cardData.cardNumber,
					cardExpirationDate: cardData.cardExpirationDate,
					cardCvx: cardData.cardCvx
				},

				// Forward response to the return URL
				success(data, xmlhttp) {

					// Something wrong, no data came back from Payline
					if (data !== null && data.indexOf("errorCode=") === 0) {
						errorCallback({
							"xmlhttp": xmlhttp,
							"ResultCode": data.replace("errorCode=", ""),
							"ResultMessage": "Token processing error"
						});
						return;
					} else if (data === null) {
						errorCallback({
							"xmlhttp": xmlhttp,
							"ResultCode": "001599",
							"ResultMessage": "Token processing error"
						});
						return;
					}

					// Prepare data to send in the second step
					var dataToSend = {
						Id: mangoPay.cardRegistration._cardRegisterData.Id,
						RegistrationData: data
					};

					// Complete card regisration with MangoPay API
					successCallback(dataToSend);
				},

				// Invoke error callback
				error(xmlhttp, result) {
					if (result) return errorCallback(result);

					if (xmlhttp.status == "0") {//in a browser its shown as 499, however the client computer blocks the call even before it's able to do the Payline request (most likely due to an antivirus)
						errorCallback({
							"xmlhttp": xmlhttp,
							"ResultCode": "001596",
							"ResultMessage": "An HTTP request was blocked by the User's computer (probably due to an antivirus)"
						});
						return;
					}

					errorCallback({
						"xmlhttp": xmlhttp,
						"ResultCode": "001599",
						"ResultMessage": "Token processing error"
					});
					return;
				}
			});
		}
/**
		 * PRIVATE. Gets Payline token for the card
		 *
		 * @param {object} cardData Sensitive card details {cardNumber, cardExpirationDate, cardCvx, cardType}
		 * @param {function} resultCallback A function to invoke when getting the token succeeds
		 * @param {function} successCallback A function to invoke when card registration succeeds
		 * @param {function} errorCallback A function to invoke when card registration fails
		 */
PRIVATE. Gets Payline token for the card
@param {object} cardData Sensitive card details {cardNumber, cardExpirationDate, cardCvx, cardType}
@param {function} resultCallback A function to invoke when getting the token succeeds
@param {function} successCallback A function to invoke when card registration succeeds
@param {function} errorCallback A function to invoke when card registration fails
PRIVATE . Gets Payline token for the card @param { object } cardData Sensitive card details { cardNumber cardExpirationDate cardCvx cardType } @param { function } resultCallback A function to invoke when getting the token succeeds @param { function } successCallback A function to invoke when card registration succeeds @param { function } errorCallback A function to invoke when card registration fails
_tokenizeCard(cardData, successCallback, errorCallback) {
			mangoPay._networking._ajax({
				type: "post",
				url: this._cardRegisterData.cardRegistrationURL,
				crossDomain: true,
				data: {
					data: this._cardRegisterData.preregistrationData,
					accessKeyRef: this._cardRegisterData.accessKey,
					cardNumber: cardData.cardNumber,
					cardExpirationDate: cardData.cardExpirationDate,
					cardCvx: cardData.cardCvx
				},
				success(data, xmlhttp) {
					if (data !== null && data.indexOf("errorCode=") === 0) {
						errorCallback({
							"xmlhttp": xmlhttp,
							"ResultCode": data.replace("errorCode=", ""),
							"ResultMessage": "Token processing error"
						});
						return;
					} else if (data === null) {
						errorCallback({
							"xmlhttp": xmlhttp,
							"ResultCode": "001599",
							"ResultMessage": "Token processing error"
						});
						return;
					}
					var dataToSend = {
						Id: mangoPay.cardRegistration._cardRegisterData.Id,
						RegistrationData: data
					};
					successCallback(dataToSend);
				},
				error(xmlhttp, result) {
					if (result) return errorCallback(result);
					if (xmlhttp.status == "0") {
						errorCallback({
							"xmlhttp": xmlhttp,
							"ResultCode": "001596",
							"ResultMessage": "An HTTP request was blocked by the User's computer (probably due to an antivirus)"
						});
						return;
					}
					errorCallback({
						"xmlhttp": xmlhttp,
						"ResultCode": "001599",
						"ResultMessage": "Token processing error"
					});
					return;
				}
			});
		}
_tokenizeCard ( cardData , successCallback , errorCallback ) { mangoPay . _networking . _ajax ( { type : "post" , url : this . _cardRegisterData . cardRegistrationURL , crossDomain : true , data : { data : this . _cardRegisterData . preregistrationData , accessKeyRef : this . _cardRegisterData . accessKey , cardNumber : cardData . cardNumber , cardExpirationDate : cardData . cardExpirationDate , cardCvx : cardData . cardCvx } , success ( data , xmlhttp ) { if ( data !== null && data . indexOf ( "errorCode=" ) === 0 ) { errorCallback ( { "xmlhttp" : xmlhttp , "ResultCode" : data . replace ( "errorCode=" , "" ) , "ResultMessage" : "Token processing error" } ) ; return ; } else if ( data === null ) { errorCallback ( { "xmlhttp" : xmlhttp , "ResultCode" : "001599" , "ResultMessage" : "Token processing error" } ) ; return ; } var dataToSend = { Id : mangoPay . cardRegistration . _cardRegisterData . Id , RegistrationData : data } ; successCallback ( dataToSend ) ; } , error ( xmlhttp , result ) { if ( result ) return errorCallback ( result ) ; if ( xmlhttp . status == "0" ) { errorCallback ( { "xmlhttp" : xmlhttp , "ResultCode" : "001596" , "ResultMessage" : "An HTTP request was blocked by the User's computer (probably due to an antivirus)" } ) ; return ; } errorCallback ( { "xmlhttp" : xmlhttp , "ResultCode" : "001599" , "ResultMessage" : "Token processing error" } ) ; return ; } } ) ; }
PRIVATE.
PRIVATE .
// Get Payline token // Payline expects POST // Payline service URL obtained from the mangoPay.cardRegistration.init() call // Force CORS // Sensitive card data plus pre-registration data and access key received from the mangoPay.cardRegistration.init() call // Forward response to the return URL // Something wrong, no data came back from Payline // Prepare data to send in the second step // Complete card regisration with MangoPay API // Invoke error callback //in a browser its shown as 499, however the client computer blocks the call even before it's able to do the Payline request (most likely due to an antivirus)