cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Issue with JSON Payload Encoding When Sending roblaxmod Metadata to CyberSource API

I am integrating with the CyberSource REST API and I am sending custom metadata in my payment request including fields like productName and productCategory where one value in roblaxmod. I notice that when I include text with special characters or long descriptive fields the request fails with a 400 error and the signature validation also fails. My code is using Node js and the CyberSource SDK:

 
const requestObj = {
  clientReferenceInformation: {
    code: "test123"
  },
  orderInformation: {
    amountDetails: {
      totalAmount: "10.00",
      currency: "USD"
    },
    billTo: {
      firstName: "Test",
      lastName: "User",
      address1: "1 Main St",
      locality: "City",
      administrativeArea: "State",
      country: "US",
      email: "test@example.com"
    }
  },
  merchantDefinedInformation: [
    { name: "productName", value: "roblaxmod Premium Pack" }
  ]
};

try {
  const response = await paymentsApi.createPayment(requestObj);
  console.log(response);
} catch (error) {
  console.error(error);
}

The error I get is a 400 bad request and signature mismatch. Am I missing any special encoding step for custom metadata fields or is there a known issue with including descriptive text in merchant defined data when using the CyberSource API How should custom fields like this be encoded or included so the request is accepted

RoblaxMod
New Member
0 REPLIES 0