Re: VISA In-App-Provisioning with Samsung Pay

Ayman
New Contributor

VISA In-App-Provisioning with Samsung Pay

I'm a mobile developer, I have created a new project in VISA to integrate with  https://sandbox.api.visa.com/inapp/provisioning/cardData/samsungPay.

I have created succeffuly the payload required for AddCard interface of Samsung Pay using the enrolled test data of cards and here is the response :

{"paymentAccountReference":"V1234567890124514786300989816","last4":"9816","cardType":"DEBIT","opaquePaymentCard":"eyJhdWQiOiIxODk5NzZhNi0yZmFjLTRlZDEtOTM0ZS03MjY5NmVhMDgxMzEiLCJraWQiOiJiYmVlZTAzOC1RMkFZM1Y1RTNJQ05CVVU2NkQ4SzExaEJtenFkWFN2VGlOelotWW5wb3pXUlhUbzUwIiwiaXNzIjoiYmJlZWUwMzgtNDgzMS00MjUzLWE3MjItMHY3NWNsMTNuNzFkIiwidHlwIjoiSk9TRSIsImNoYW5uZWxTZWN1cml0eUNvbnRleHQiOiJTSEFSRURfU0VDUkVUIiwiZW5jIjoiQTI1NkdDTSIsInRhZyI6Ik9IMWFNRVdGbWFaVmRoWS1NLVpCVHciLCJpYXQiOjE3MzAyNzg4NzcsImFsZyI6IkEyNTZHQ01LVyIsIml2IjoiUTc0eWtocTVEeFJtYTU3USJ9.LWxx2pz4wcKgl3B7b4D08JkmReSXd9vAIBZKit-83KQ.HXJs6TBD88kkG9AZ.91qhh6OkvdvjRiJyvqH_slJ5akSTYaelJCoTfg9cIposu9y8q1ldwSwcARqlp6srdBMCwx2vjFzC1epuQi7RBXHDAnjMTI1R6PB4P94FRlv-RPbih5GB-P9Xq6xgnMNf_k0BAnaCZJ7cpnJZItn281QzRDBD1S5C1GVwesWyEIZ4YDZmmd0ps4mjlIcs-SqlI648xlcRmRGouVI-my1AgDwKCSqRyLBszDi8ETfm00QCFVlxGTvZWFVOz-TdaOIGOM_eNxzfFZG9jDH8eMemchnzV_oVBgpl5--Ml5p1BtoM7lcy3TLm8DZjR_PPIPUNuSCS6ZHcMPDQcwnqk_Wys9ofA71FhGJnOAdxmzQ0cuQv7sakQN-l7B_tvc65HLW_ZHhl4F9R6web456AeXBtX2dhPsoP9sA4q_kBNYRRqg4Hhm_LE1tufiG36UP96KQ88Pv1e6bax-iA28vTeqyp2Lf5LgymFVMJfUWWBoldqqCAmuZKBlmMer8NdxcN9cC6QpsU16KovAFsIvOU7sWICBz4fpZv_ewvrUZ23lZLEHBFiMxg01Y3nUEb0zvZiXkXXQILgWTX1Wi_JoUgxYI.QpCLQ3258_Ukf_ur0hVdcA","vCardID":"v-123-89f535a7-11f9-4e09-887e-f47aee2f0501"}

When I share  the value of opaquePaymentCard with addCard interface, I got the below error from Samsung Pay SDK:


2024-10-30 12:02:22.057 4780-3867 SpayFw_Req...ollRequest com.samsung.android.spayfw E TR Response Error: {"code":"500.1","message":"VisaTokenServiceException [vtsResponse={\"errorResponse\":{\"message\":\"Credentials API Key incorrect.\",\"reason\":\"authError\"}}, statusCode=401 UNAUTHORIZED, responseHeaders=[Server:\"nginx\", Date:\"Wed, 30 Oct 2024 09:02:22 GMT\", Content-Type:\"application/json;charset=UTF-8\", Content-Length:\"96\", Connection:\"keep-alive\", X-SERVED-BY:\"-56c7c8b4s99\", X-CORRELATION-ID:\"1730278942_463_1196505423_-56c7c8b4s99_VDP_WS\", X-ERROR-ORIGIN:\"9900\", X-APP-STATUS:\"401\", x-response-id:\"4fce7c2e-309e-49c4-9b3c-7aba2f7ed004\", X-Frame-Options:\"SAMEORIGIN\", X-XSS-Protection:\"0\", X-Content-Type-Options:\"nosniff\", Cache-Control:\"no-cache, no-store, must-revalidate\", Pragma:\"no-cache\", Expires:\"-1\", Content-Security-Policy-Report-Only:\"default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;\", X-Content-Security-Policy-Report-Only:\"default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;\", X-WebKit-CSP-Report-Only:\"default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;\", Strict-T

 

However I used the same api key to call VISA api and it is working fine

2 REPLIES 2
SyedSa
Community Moderator

Re: VISA In-App-Provisioning with Samsung Pay

Hi @Ayman, Thank you for reaching out. An agent will look into this and get back to you soon. Until then, if any community member knows a solution, feel free to reply in this thread. 

DianaVisaPM
Visa Developer Support Specialist

Re: VISA In-App-Provisioning with Samsung Pay

Hey @Ayman,

 

The error message you are encountering suggests that there is an issue with the API key used in the request to the Visa Token Service (VTS). The error message "Credentials API Key incorrect." indicates that the API key provided in the request to the Samsung Pay SDK is not being recognized or authorized by Visa.

 

Here are some steps to troubleshoot and resolve this issue:

1. Verify API Key:
Ensure that the API key you are using in the request to the Samsung Pay SDK is the same as the one used successfully in the Visa API request.

2. Check API Key Permissions:
Confirm that the API key has the necessary permissions for the Visa Token Service and Samsung Pay integration. You can check the permissions in your project settings on the Visa Developer Platform.

3. Environment Consistency:
Make sure that the environment (sandbox or production) for the API key matches the environment you are working in. Sometimes, sandbox keys do not work in production and vice versa.

4. Correct Header Configuration:
Ensure that the `Authorization` header is correctly configured in the request to the Samsung Pay SDK. The header should be in the format `Authorization: Basic <base64_encoded_api_key>`.

 

Here is an example of how to configure the headers correctly:

```javascript
// START 
const axios = require('axios');

const headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic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BFiMxg01Y3nUEb0zvZiXkXXQILgWTX1Wi_JoUgxYI.QpCLQ3258_Ukf_ur0hVdcA"
};

axios.post('https://sandbox.api.visa.com/inapp/provisioning/cardData/samsungPay', data, { headers: headers })
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Error:', error.response ? error.response.data : error.message);
});
// END 
```

 

By following these steps, you should be able to identify and resolve the issue with the API key authorization.




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.