cancel
Showing results for 
Search instead for 
Did you mean: 

.Net SDK PaymentsApi is not returning tokenInformation

We are using the .Net Cybersource SDK to manage tokens and run payments, but when trying to do a request and generate a token the tokenInformation.shippingAddress, tokenInformation.paymentInstrument and tokenInformation.customer fields on the response are always null, even that doing the same request on the sandbox APIs return the correct values.

Here is our code:
 

var requestObj = new CreatePaymentRequest
{
  ClientReferenceInformation = new Ptsv2paymentsClientReferenceInformation
  {
    Code = account.AccountId.ToString()
  },
    ProcessingInformation = new Ptsv2paymentsProcessingInformation
  {
    CommerceIndicator = "internet",
    Capture = false,
    ActionList = new List<string> { "DECISION_SKIP", "TOKEN_CREATE" }
  },
  OrderInformation = new Ptsv2paymentsOrderInformation
  {
  AmountDetails = new Ptsv2paymentsOrderInformationAmountDetails
  {
    TotalAmount = "0.01",
    Currency = facilitySettings.CurrencySymbol,
  },

  BillTo = new Ptsv2paymentsOrderInformationBillTo
  {
    Country = model.Country,
    AdministrativeArea = model.State,
    PostalCode = model.Zip,
    Email = account.Email,
    Locality = model.City,
    FirstName = model.FirstName,
    LastName = model.LastName,
    Address1 = model.Address
  }
 },
  TokenInformation = new Ptsv2paymentsTokenInformation
  {
    TransientTokenJwt = model.Jwt
  }
};

try
{

  var clientConfig = GetClientConfiguration(settings);

  var apiInstance = new PaymentsApi(clientConfig);
  PtsV2PaymentsPost201Response result = await apiInstance.CreatePaymentAsync(requestObj);
  Console.WriteLine(result);
  return result;
}
catch (Exception e)
{
  Console.WriteLine("Exception on calling the API : " + e.Message);
  return null;
}

felipemk
Member
5 REPLIES 5

It looks like you are correctly populating the TokenInformation field in your CreatePaymentRequest object, but the ShippingAddress, paymentInstrument, and customer fields within the TokenInformation field in the response are always null.

It's possible that the issue is related to the TransientTokenJwt field. The CyberSource documentation states that the Transient Token JWT must be sent in the Authorization header of the API request. It may be worth checking that the JWT is being sent in the correct format and included in the request headers.

Additionally, it may be helpful to check if your account has the necessary permissions to generate tokens, or if there is any issue with your API credentials.

You may also want to check if there is any issue with sandbox API, you can check the logs or contact the CyberSource support team for help.

Pitaj
Member

The TransientTokenJwt field may be the cause of the problem. According to the CyberSource documentation, the Transient Token JWT must be included in the API request's Authorization header. It could be worthwhile to double-check that the request headers contain the JWT and that it is being transmitted in the appropriate manner.

zaidsahib
Member


If the PaymentsApi in the .NET SDK is not returning tokenInformation, there are several steps you can try to troubleshoot the issue:

Check the API response: Make sure that the PaymentsApi response includes the tokenInformation object. You can inspect the response using a tool like Fiddler or Postman to see if the tokenInformation object is present.

Verify the API request: Ensure that the API request includes the necessary parameters to request tokenInformation. This may include a valid merchant ID, transaction ID, and token ID. site 

 

JmesJony
Member

Check the API version: Verify that you are using the latest version of the .NET SDK and that it is compatible with the version of the CyberSource API you are using.

Check the API credentials: Make sure that the API credentials used to authenticate the request are correct and have the necessary permissions to access tokenInformation.

Verify the token status: Ensure that the token status is valid and has not expired. You can check the token status by making a separate API request to the "GET Token" endpoint.

Contact CyberSource support: If none of the above steps resolve the issue, you may want to contact CyberSource support for further assistance. They can help you troubleshoot the issue and provide guidance on how to resolve it site .

For more information on using the CyberSource API and troubleshooting common issues, check out the CyberSource developer documentation or contact their support team.

If the PaymentsApi from the Net SDK is not returning tokenInformation, there could be a few possible reasons:

  1. Authentication Issues: Make sure that you have authenticated properly and have access to the API. Check that your authentication credentials are correct and that your API key has the appropriate permissions to retrieve token information.

  2. Incorrect Request Parameters: Ensure that you are sending the correct parameters to the API call, such as the correct token ID, payment method, or other required fields.

  3. API Limitations: Check if there are any limitations on the API call that you are making. For example, some API calls may have a limit on the number of requests per minute or hour. Make sure that you are not exceeding these limits.