diff --git a/src/Gateways/Alipay/Support.php b/src/Gateways/Alipay/Support.php index 1a3f46a96..b0895fb4c 100644 --- a/src/Gateways/Alipay/Support.php +++ b/src/Gateways/Alipay/Support.php @@ -156,7 +156,9 @@ public static function generateSign(array $params): string } if (Str::endsWith($privateKey, '.pem')) { - $privateKey = openssl_pkey_get_private($privateKey); + $privateKey = openssl_pkey_get_private( + Str::startsWith($privateKey, 'file://') ? $privateKey : 'file://'.$privateKey + ); } else { $privateKey = "-----BEGIN RSA PRIVATE KEY-----\n". wordwrap($privateKey, 64, "\n", true).