
Question:
I have a mobile app containing payment method via MasterCard. I have this tutorial:
<a href="https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/api.html?locale=en_US" rel="nofollow">https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/api.html?locale=en_US</a>
I want to create Tokenization which contains customer's master detail, I have followed this tutorial part:
<a href="https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/operation/Tokenization%3A%20Create%20or%20Update%20Token%20(with%20system-generated%20token).html?locale=en_US" rel="nofollow">https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/latest/operation/Tokenization%3a Create or Update Token (with system-generated token).html?locale=en_US</a>
I tried with :
<strong>POST</strong> https://ap-gateway.mastercard.com/api/rest/version/41/merchant/{{MyMerchantID}}/token
<strong>Params:</strong>
{
"sourceOfFunds": {
"type": "CARD",
"provided": {
"card":{
"number": "5123450000000008",
"expiry": {
"month": "05",
"year": "17"
}
}
}
Note: The number is a mastercard test number.
I am always get this error:
error
cause "INVALID_REQUEST"
explanation "Invalid credentials."
result "ERROR"
I followed the params in second URL. Can anyone help? Are the params correct or I missed something?
Answer1:In your configuration file, you need to set the following:
$configArray["merchantId"] = "[merchantId]";
// API username in the format below where Merchant ID is the same as above
$configArray["apiUsername"] = "merchant.[merchantId]";
// API password which can be configured in Merchant Administration
$configArray["password"] = "your api password";
Setting the above parameters in the config file will solve your problem