google-wallet发回解码错误

时间:2014-11-03 16:46:52

标签: php postback android-pay jwt

googlw-wallet数字商品的回发文件失败了。我知道我从谷歌得到一个有效的休息,因为我在测试线上检查我收到的回复通过电子邮件将回复发送给我自己。经过测试,我得到了一个正确的jwt解码(使用google在线jwt解码器),如下所示。当我将测试线移动到JWT :: decode线以下时,我没有得到一个响应,表明解码中的致命错误是从jwt(通过luciferous)改变的。当我自己运行回发时,我得到了致命的错误(当然没有发布jwt),表明正在找到包含和脚本。

返回的帖子是 eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJHb29nbGUiLCJyZXF1ZXN0Ijp7Im5hbWUiOiJJbnZvaWNlIE51bWJlcjogMTA2NTk3IiwiZGVzY3JpcHRpb24iOiJTdXBwb3J0ZWQgU2VydmljZSIsInByaWNlIjoiMTAwIiwiY3VycmVuY3lDb2RlIjoiR0JQIiwic2VsbGVyRGF0YSI6IkRBVklEIE1JTExTLGRhdmVAZHdtaWxscy5jb20sSW52b2ljZSBOdW1iZXI6MTA2NTk3In0sInJlc3BvbnNlIjp7Im9yZGVySWQiOiJHV0RHX1MuY2VhYmI1YzQtNTk1Ni00OGIyLWE0MGItN2ZjMmRkMTg0YTlhIn0sInR5cCI6Imdvb2dsZS9wYXltZW50cy9pbmFwcC9pdGVtL3YxL3Bvc3RiYWNrL2J1eSIsImF1ZCI6IjEyMzQ1NjA1ODcxOTI0NjQ0MjcyIiwiaWF0IjoxNDE1MDI0ODM0LCJleHAiOjE0MTUwMjQ4NTR9.PV8c18EGWLL38sUDmjMY1HEV91An6ZVnKkymuW2SQUI。

header
   {
    "alg": "HS256"
   }
claims
    {
    "aud": "12345605871924644272", 
    "iss": "Google", 
    "request": {
        "currencyCode": "GBP", 
        "price": "100", 
        "sellerData": "ghhk,ghty.com,Invoice Number:106597", 
        "name": "Invoice Number: 106597", 
        "description": "Supported Service"
    }, 
    "exp": 1415024854, 
    "iat": 1415024834, 
    "typ": "google/payments/inapp/item/v1/postback/buy", 
    "response": {
        "orderId": "GWDG_S.ceabb5c4-5956-48b2-a40b-7fc2dd184a9a"
    }
   }
signature
   PV8c18EGWLL38njyujMY1HEV91An6ZVnKkymuW2SQUI

我在尝试解码时遇到了致命错误,因为我无法进入测试线。

我的回帖脚本是

<?php

    require_once '../../includes/lib/JWT.php';
    require_once '../../includes/seller_info_test.php';



    $encoded_jwt = $_POST['jwt'];

     $decodedJWT  = JWT::decode($encoded_jwt, $sellerSecret);
     $orderId     = $decodedJWT->response->orderId;

     header("HTTP/1.0 200 OK");
     echo $orderId;

     $logfile = "purchasing/logfile.txt";
     if (!file_exists($logfile)) {
        touch($logfile);
        chmod($logfile, 0777);
     }
     $orderIDS   = file($logfile); //reads file into array
     $orderIDS[] = $orderId; //append new orderID to array
     file_put_contents($logfile, $orderIDS); //save the new array to file
    ?>

1 个答案:

答案 0 :(得分:0)

问题现在已经解决了。非常简单的$ sellerSecret在替换为它工作的实际值时没有从包含文件中读取。寻找明显的我想!删除了日志文件行,并添加了发送电子邮件。下一步编写包含文件,将响应数据写回数据库,反对卖方数据字段。