【问题标题】:apple pay in payfrort return Failed to execute service?apple pay in payfrort return 执行服务失败?
【发布时间】:2021-10-21 13:42:35
【问题描述】:

我将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”表示无效请求,但有什么问题?

【问题讨论】:

    标签: php curl applepay payfort


    【解决方案1】:

    对我们来说,结果是 Apple 支付证书问题。我们在支付设置中上传的证书在 Apple 开发者门户中无效。

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

    1. 证书错误
    2. 用于证书的密码错误
    3. 用于签名的证书与在 PayFort BackOffice 中上传的证书不匹配
    4. 证书过期

    【讨论】:

      猜你喜欢
      • 2019-03-13
      • 2019-04-08
      • 2019-05-08
      • 2015-10-29
      • 2021-02-09
      • 2020-03-07
      • 2023-03-15
      • 1970-01-01
      相关资源
      最近更新 更多