Skip to content

VerifyCardValidationData

Source: src/AWS/PaymentCryptography/VerifyCardValidationData.ts

Runtime binding for payment-cryptography:VerifyCardValidationData — verifies card validation values (CVV/CVV2, dCVV, CSC) under the same Card Verification Key (CVK) Key used to generate them. A mismatch fails with the typed VerificationFailedException. Provide VerifyCardValidationDataHttp on the Function to satisfy this service.

// init
const verifyCvv2 = yield* PaymentCryptography.VerifyCardValidationData(cvk);
// runtime
const outcome = yield* verifyCvv2({
PrimaryAccountNumber: "9123456789012345",
VerificationAttributes: {
CardVerificationValue2: { CardExpiryDate: "0130" },
},
ValidationData: cvv2,
}).pipe(
Effect.map(() => "valid"),
Effect.catchTag("VerificationFailedException", () =>
Effect.succeed("invalid"),
),
);