0

我正在使用 Firebase Cloud 函数在来自 App Store 的 http 请求(服务器到服务器通知)中接收 JSON 有效负载,其中包含 Base64 编码字符串。我正在使用解码:

const latestReceipt = request.body.latest_receipt ? Buffer.from(request.body.latest_receipt, 'base64').toString() : null;

这在另一个函数中可以很好地解码来自 Google Play 商店的消息。然而,来自 Apple 的解码字符串是无效的 JSON 对象。

{
"original-purchase-date-pst" = "2019-09-20 16:40:20 America/Los_Angeles";
"quantity" = "1";
"subscription-group-identifier" = "****";
"unique-vendor-identifier" = "****";
"original-purchase-date-ms" = "1569022820000";
"expires-date-formatted" = "2019-09-24 02:55:47 Etc/GMT";
"is-in-intro-offer-period" = "false";
"purchase-date-ms" = "1569293447000";
"expires-date-formatted-pst" = "2019-09-23 19:55:47 America/Los_Angeles";
"is-trial-period" = "false";
"item-id" = "1478806339";
"unique-identifier" = "******";
"original-transaction-id" = "1000000570864027";
"expires-date" = "1569293747000";
"transaction-id" = "1000000571530192";
"bvrs" = "11";
"web-order-line-item-id" = "1000000047099385";
"version-external-identifier" = "0";
"bid" = "****";
"product-id" = "storage_increase";
"purchase-date" = "2019-09-24 02:50:47 Etc/GMT";
"purchase-date-pst" = "2019-09-23 19:50:47 America/Los_Angeles";
"original-purchase-date" = "2019-09-20 23:40:20 Etc/GMT";
}

我假设我做错了什么,但我不确定到底是什么。我不希望 App Store 发送无效的 JSON。

4

0 回答 0