1

我将apple pay与amazon payfort Gate集成并使用沙盒帐户测试操作我的要求是:

$arrData = array(
        'digital_wallet'=>'APPLE_PAY',
        'command' => 'PURCHASE',
        'access_code' => 'xxxxxxx',
        'merchant_identifier' => 'xxxxxx',
        'merchant_reference' =>$data->merchant_refrence,
        'amount' => 100,
        'currency' => 'SAR',
        'language' => 'en',
        'customer_email' =>$data->user->email != "" ? $data->user->email :"test@test.com",
        'customer_name' =>$data->user->name!= "" ? $data->user->name :"test",
        'phone_number' =>$data->user->mobile,
        'order_description' => 'Package payment',
        'return_url' => route('subscripe.return',["lang"=>$lang]),
        'merchant_extra' => str_replace('=', '@', base64_encode(json_encode($data))),
        'apple_data'            => $token['paymentData']['data'],
        'apple_signature'       => $token['paymentData']['signature'],
        'apple_header'          => [
            'apple_transactionId'=> $token['paymentData']['header']['transactionId'],
            'apple_ephemeralPublicKey'=> $token['paymentData']['header']['ephemeralPublicKey'],
            'apple_publicKeyHash'=> $token['paymentData']['header']['publicKeyHash'],
        ],

        'apple_paymentMethod'   => [
            'apple_displayName'=> $token['paymentMethod']['displayName'],
            'apple_network'=> $token['paymentMethod']['network'],
            'apple_type'=> $token['paymentMethod']['type'],
        ],
    );
    $shaString = '';
    ksort($arrData);
    foreach ($arrData as $key => $value) {
        if(is_array($value)){
            $shaSubString = '{';
            foreach ($value as $k => $v) {
                $shaSubString .= "$k=$v, ";
            }
            $shaSubString = substr($shaSubString, 0, -2).'}';
            $shaString .= "$key=$shaSubString";
        }else{
            $shaString .= "$key=$value";
        }
    }
    $shaString = $SHA_Request_Phrase . $shaString . $SHA_Request_Phrase;
    $signature = hash('sha256', $shaString);
    $arrData['signature'] = $signature;
    $arrData=json_encode($arrData);
    $url="https://sbpaymentservices.payfort.com/FortAPI/paymentApi";
    $response= $this->sent_request($url,"POST",$arrData);

在此响应之前我得到“无效的参数类型:apple_header”我被作为json值发送然后我得到不匹配的签名并通过新的计算修复它然后我得到这个响应

{
"error": "",
"result": {
    "amount": "100",
    "response_code": "00099",
    "digital_wallet": "APPLE_PAY",
    "signature": "20b4790c7e63d65c5abdefa3e30fd58d90669e3ba361279adef1abf51c4fb317",
    "merchant_identifier": "xxxxxx",
    "access_code": "xxxxxxx",
    "order_description": "Package payment",
    "language": "en",
    "command": "PURCHASE",
    "merchant_extra": "eyJpZCI6MTg3LCJtZXJjaGFudF9yZWZyZW5jZSI6InRpc3RhaGVsLXBheWZvcnQtc3Vic2NyaXBlXzE2MjkzNzQ1NzYiLCJ0cmFuc2FjdGlvbl9yZWYiOm51bGwsImFwcF9tb2RhbF90eXBlIjoic3Vic2NyaXBlIiwiYXBwX21vZGFsX2lkIjpudWxsLCJhbW91bnQiOiIxMDAiLCJkZXNjcmlwdGlvbiI6bnVsbCwicGFpZCI6MCwiY2hlY2tlZCI6MCwicGF5bWVudF9kYXRlIjpudWxsLCJwYXltZW50X3Jlc3BvbnNlIjpudWxsLCJwYXltZW50X3N0YXR1cyI6bnVsbCwidXNlcl9pZCI6OSwiY3JlYXRlZF9hdCI6IjIwMjEtMDgtMTkgMTI6MDI6NTYiLCJ1cGRhdGVkX2F0IjoiMjAyMS0wOC0xOSAxMjowMjo1NiIsInBheW1lbnRfbWV0aG9kIjoiYXBwbGVfcGF5IiwidXNlciI6eyJpZCI6OSwicm9sZV9pZCI6MiwibmFtZSI6Ik1NTU1NIiwiZW1haWwiOiIiLCJhdmF0YXIiOiJ1c2Vyc1wvZGVmYXVsdC5wbmciLCJjcmVhdGVkX2F0IjoiMjAyMS0wNi0xMyAxMzoxNDozNyIsInVwZGF0ZWRfYXQiOiIyMDIxLTA4LTE5IDEyOjAyOjQ0IiwibW9iaWxlIjoiMDExNTUwMzM5MzIiLCJzdGF0dXMiOjB9fQ@@",
    "response_message": "Failed to execute service",
    "merchant_reference": "xxxxxx",
    "customer_email": "test@test.com",
    "currency": "SAR",
    "phone_number": "01155033932",
    "customer_name": "MMMMM",
    "status": "00"
}

}

我知道“099”表示无效请求,但有什么问题?

4

1 回答 1

0

对我们来说,原来是苹果支付证书问题。我们在支付设置中上传的证书在 Apple 开发者门户中没有激活。

但是,根据 payfort 团队的指示,还有其他可能的原因: 原因可能是:

  1. 证书错误
  2. 用于证书的密码错误
  3. 用于签名的证书与在 PayFort BackOffice 中上传的证书不匹配
  4. 过期证书
于 2021-10-26T14:53:09.663 回答