Does anyone have a working PERL example:
No matter what I post to /v2/merchant/{mId}/pay I always get the same failure message:
{"paymentId":"TXK3B3WE0KP5M","result":"DECLINED","failureMessage":"CRYPTO FAILURE"}
I've scoured forums on encrypting the card number correctly and believe that I've done it right, but always get the crypto failure response:
Is there any documentation that provides examples of values we can use to make sure we are doing the encryption correctly?
I'm working in Perl, retrieving the Public Key from the pem provided (two different methods produce the same result, so I'm pretty sure I'm doing that step correctly:
use MIME::Base64 qw( encode_base64 );
use Crypt::OpenSSL::RSA;
use Crypt::OpenSSL::Bignum;
use Digest::SHA1 qw(sha1 sha1_hex sha1_base64); #tried them all
my $n = Crypt::OpenSSL::Bignum->new_from_decimal($keys->{modulus});
my $e = Crypt::OpenSSL::Bignum->new_from_decimal($keys->{exponent});
my $rsa_pubkey = Crypt::OpenSSL::RSA->new_key_from_parameters($n, $e);
# $rsa_pubkey consistently returns the same value.
# prepend the prefix to the cardnumber. Clover docs say this cardnumber should return success.
my $string = "$keys->{prefix}4264281511117771";
#encrypt them
my $cipher = sha1($rsa_pubkey,$string);
# and finally encode them to base64
my $encryptednumber = encode_base64($cipher,"");
Always get Crypto Failure.
Anybody have any ideas what I could be doing wrong???
thanks in advance for any help on this.