cancel
Showing results for 
Search instead for 
Did you mean: 

Authentication Failed when send API to sandbox

Hello,

I'm trying to check how the API works. I registered and try to send a request. So, I'm trying to send for example POST https://apitest.cybersource.com/pts/v2/payments 

First I test API on the page https://developer.cybersource.com/api-reference-assets/index.html#payments_payments_process-a-paymen...  

1. Updated keys /credentials on the page 
2. Sent the request using my account
Worked fine.

Then, I tried to do the same using Postman:
1. Copied headers from the page above 
   * hostapitest.cybersource.com
   * signature keyid="30863dfc-54a2-49a3-***-7db45f770013", algorithm="HmacSHA256", headers="host v-c-date request-target      * digest v-c-merchant-id", signature="Ed9XMG2GmfvhfFeel9II+jfdb2x6zBwOqUOx***89A="
   * digest SHA-256=cwjLNSMNo0IFp7hbUtTNu+7KxaF9O67******nQ7J5g=
   * v-c-merchant-id prots_****1730368156
   * v-c-date Fri, 01 Nov 2024 07:07:59 GMT
   * Content-Type application/json
2. Pasted into postman request (also I used the collection https://documenter.getpostman.com/view/2960117/S17m1riA  provided by cybersource)
Got Result  'Authentication Failed'

As Alternative way, I wrote a simple .NET Console app and tried to send a request in the code (got from example https://github.com/CyberSource/cybersource-rest-samples-csharp/blob/master/Source/Samples/Authentica... )

The result is the same  'Authentication Failed'.

What am I doing wrong ? Is there any additional configuration required ?

prots
Member
3 REPLIES 3

Make sure your format is exactly correct, as CyberSource can be strict with date formats. Double-check that your signature header is generated accurately and try regenerating it to avoid any mismatches. Confirm that your API key, shared secret, and v-c-merchant-id are correct and set for sandbox mode. Using the CyberSource SDK for automatic header generation can also help prevent errors.

waqaskh12
Member

Thanks for your answer.
everything seems to be checked but still doesn't work. One thing here: what do mean under sandbox mode ? apitest.cybersource.com ?

 

I am working on integrating the SubscriptionsApi using .net core. Below is the example code.

I am using Sandbox - apitest.cybersource.com. I verified the date and it is following the standard described in the developer guide.

SubscriptionsApi instance = new SubscriptionsApi(clientConfig);
var subresponse = await instance.CreateSubscriptionAsync(requestObj);
if (response != null)
{
status = subresponse.SubscriptionInformation.Status;
}

 

Exception: CyberSource.Client.ApiException: 'Error calling CreateSubscription: {"response":{"rmsg":"Authentication Failed"}}'

mashwathappa
Member