Receiving 'error decrypting certificate id'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am changing the paypal account that is receiving payments by my custom button script that has worked for 5 years now. I re-generated a new private-key and public certificate (containing the alternate email). I've uploaded the public certificate to (the receiving) paypal and downloaded paypals certificate.
All files are correctly pointed to in the env: (see my script)
Openssl has been sufficient for my site for years without using their program(s)... What is going on, does anyone know why I am receiving 'error decrypting certificate id' after updating everything????
Thanks in advance!
/*
* helper function to use openssl and paypal
* certs to encrypt data for transmission
*
* @Param {$hash} an array containing key => values
*/
private static function encrypt($hash) {
$MY_KEY_FILE = base_path() . env('MY_KEY_FILE');
$MY_CERT_FILE = base_path() . env('MY_CERT_FILE');
$PAYPAL_CERT_FILE = base_path() . env('PAYPAL_CERT_FILE');
$OPENSSL = env('OPENSSL');
if (!file_exists($MY_KEY_FILE))
return "ERROR: MY_KEY_FILE $MY_KEY_FILE not found";
if (!file_exists($MY_CERT_FILE))
return "ERROR: MY_CERT_FILE $MY_CERT_FILE not found";
if (!file_exists($PAYPAL_CERT_FILE))
return "ERROR: PAYPAL_CERT_FILE $PAYPAL_CERT_FILE not found";
if (!file_exists($OPENSSL))
return "ERROR: OPENSSL $OPENSSL not found";
$data = "";
foreach ($hash as $key => $value) {
if ($value != "") {
$data .= "$key=$value\n";
}
}
$openssl_cmd = "($OPENSSL smime -sign -signer $MY_CERT_FILE -inkey $MY_KEY_FILE " .
"-outform der -nodetach -binary <<_EOF_\n$data\n_EOF_\n) | " .
"$OPENSSL smime -encrypt -des3 -binary -outform pem $PAYPAL_CERT_FILE";
exec($openssl_cmd, $output, $error);
if (!$error) return implode("\n", $output);
else return "ERROR: encryption failed";
}
/**
* Returns an encrypted hash for the partial to use.
* @Param type $hash
* @RETURN type
*/
public static function generateButton($hash) {
return PaypalController::encrypt($hash);
}
private static function getPaypalHash($cost, $summary, $number) {
$hash = array(
'cert_id' => '**omitted**', //this was updated in my code to the newly issued certificate by paypal on receiving account, but still receiving error?
'cmd' => '_xclick',
'business' => 'paypal@**omitted**',
'lc' => 'US',
'amount' => $cost,
'item_name' => $summary,
'item_number' => $number,
'button_subtype' => 'services',
'no_note' => 1,
'no_shipping' => 2,
'notify_url' => 'https://**omitted**/paypal/ipn',
'return' => 'https://**omitted**/receipt',
'cancel' => 'https://**omitted**/services',
'currency_code' => 'USD',
'bn' => 'PP-BuyNowBF:btn_paynowCC_LG.gif:NonHosted'
);
return PaypalController::generateButton($hash);
}
- Labels:
-
Express Checkout
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well I got this resolved. there was two download buttons on paypal certificate page. I was selecting the wrong one
Here's to a simple brain-fart!
Cheers

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- I have received a email advising that I need to renew API Certificate. in REST APIs
- Host name does not match server certificate for https://ipnpb.sandbox.paypal.com/cgi-bin/webscr in Sandbox Environment
- Certificate error using API in REST APIs
- Do custom EWP buttons work anymore? Error: cannot decrypt certificate in PayPal Payments Standard
- Website URL Issue in Sandbox Environment