An error occurred while attempting to decrypt payload. Please ensure the encryption key used was generated using the passed secret key

Hi i’m trying to encrypt a card details payload using our test keys but , i keep getting this error. what should i do

/4fPojuxymXc3aRGmHEV1iV0gO7ACDEULrF99i9in1AG0//4s3o64ZwCJBc9GvlI2iHkAksIOjN3Jzy8CIoHH/I9fc07yXRFKmB1Rza2RPLlrWEhy+GasYDOXKCzFl9eC2q4K0+Dr9utQEfpfaFBlDHJFO47xgzYe9FC7EsyflSsigy8AqbFgcqs/FohqJRdtkW5FKV3n37Tq6sABJezeGAp0afwr6qDrdpuqoNAp2pTyVLS1BrWzlRSA7aU70CzeRlvBnuTJwSdUWY6gnzHJ+STaOnJlUM6h446R4UMcrnYcR/H7Z0Si9KPQIOlP1F+aGt+W6lzbnl6461e/ZbL9VVl29mG9kCNceRQ0MOAS9C1JqSppkGvyYLZ967lVmM1WQliy39fjcyFnDi0MZJYhv8r8bRuW7Z1/C5br44u+dqonSC6e6L/

this is the encrypted payload encrypted with tripledes

Pleasecan anyone respond

Hi @modern_shelter

Thank you for sharing this experience,

The request payload structure above is incorrect as you are only allowed to pass the “client” parameter which contains the encrypted payload as a body parameter as seen here. You can check here for more information on how to encrypt your payload.

It is also important to note that there are backend libraries available that automatically encrypts the payload for you when sending the request.

I will remain on standby if you have further questions

Thank you, i’ve tried it but ,i’m getting this response now

{
“status”: “error”,
“message”: “params.cardno.slice is not a function”,
“data”: null
}

CardNumber = 5531886652142950,
Cvv = 564,
ExpiryMonth = 09,
ExpiryYear = 32,
Currency = “NGN”,
Amount = 100,
FullName = “Yolande Aglaé Colbert”,
Email = “user@example.com”,
TxRef = “YOUR_PAYMENT_REFERENCE”,
RedirectUrl = “https://example_company.com/success”,

and this is my payload

and my enctyption method as follows

public static string TripleDESEncrypt(string data, string encryptionKey)
{
string defaultString = string.Empty;
if (data == null || encryptionKey == null) return defaultString;
try
{
byte encryptionKeyBytes = Encoding.UTF8.GetBytes(encryptionKey);
using (var desede = TripleDES.Create())
{
desede.Mode = CipherMode.ECB;
desede.Padding = PaddingMode.PKCS7;
desede.Key = encryptionKeyBytes;

         byte[] dataBytes = Encoding.UTF8.GetBytes(data);
         byte[] encryptedValue = desede.CreateEncryptor().TransformFinalBlock(dataBytes, 0, dataBytes.Length);
         return Convert.ToBase64String(encryptedValue);
     }
 }
 catch (Exception exception)
 {
     return exception.Message;
 }

}

Hi @modern_shelter

Thank you for sharing additional information. I noticed that there are a few discrepancies between the payload you provided and the correct format. To ensure smooth processing of your request, kindly follow the payload format provided here.

thank you , We’ve updated it accordingly below is the payload and response
Request = new CardChargeRequest
{
CardNumber = 5531886652142950,
Cvv = 564,
ExpiryMonth = 09,
ExpiryYear = 32,
Currency = “NGN”,
Amount = 100,
FullName = “Yolande Aglaé Colbert”,
Email = “user@example.com”,
TxRef = “MC-3243e”,
RedirectUrl = “https://www,flutterwave.ng”,
Authorization = new CardChargeRequest.AuthorizationData
{
Address = “3563 Huntertown Rd, Allison park, PA”,
Pin = 3310,
City = “San Francisco”,
Country = “US”,
State = “California”,
Mode = “pin”,
ZipCode = “94105”

},
Preauthorize = true,
Meta = new CardChargeRequest.CardMeta
{
  FlightId = "",
  SideNote = ""
},
PaymentPlan = "",
DeviceFingerprint = "",
ClientIp = "127.0.0.1"

}

and were still getting the same error

{
“status”: “error”,
“message”: “params.cardno.slice is not a function”,
“data”: null
}

Hi @modern_shelter

The API expects the payload in a specific JSON format, and in accordance with the expected payload structure provided here. For instance, the field CardNumber should be named card_number in the payload.

Yes it is like that the payload comes with a json👍 property name named accordingly to documentation

But the error still persist

“{"card_number":5531886652142950,"cvv":564,"expiry_month":9,"expiry_year":32,"currency":"NGN","amount":100,"fullname":"Yolande Aglaé Colbert","email":"user@example.com","tx_ref":"MC-3243e","redirect_url":"https://www,flutterwave.ng","preauthorize":true,"client_ip":"127.0.0.1","device_fingerprint":"","payment_plan":"","meta":{"flightID":"","sidNote":""},"authorization":{"mode":"pin","pin":3310,"City":"San Francisco","address":"3563 Huntertown Rd, Allison park, PA","state":"California","country":"US","zipcode":"94105"}}”

attached is the payload attached accordingly

@Adekunle the issue was from the documentation card number has to be passed as string and cvv as string for it to be passed, kindly update the documentation and change from int to string

Hi @modern_shelter

Thank you for your feedback,

The links shared above redirects you to a sample request payload in accordance with the expected payload structure. The information on the documentation will also be updated dully.

Regards