let {
out_trade_no,
transaction_receipt,
transaction_identifier,
} = data;
if (!out_trade_no) {
throw { errCode: ERROR[51001] };
}
// 初始化uniPayInstance
let uniPayInstance = await this.initUniPayInstance({ provider: "appleiap", provider_pay_type: "app" });
let verifyReceiptRes = await uniPayInstance.verifyReceipt({
receiptData: transaction_receipt
});
let userOrderSuccess = false;
let pay_date = 0;
if (verifyReceiptRes.tradeState !== "SUCCESS") {
throw { errCode: ERROR[54002] };
}
// 支付成功
pay_date = Number(verifyReceiptRes.receipt.receipt_creation_date_ms);
x***@163.com
- 发布:2023-08-16 00:12
- 更新:2023-08-16 11:03
- 阅读:203
产品分类: uniCloud/腾讯云
示例代码:
操作步骤:
IOS内购成功后,查看表uni-pay-orders的pay_date字段即可
IOS内购成功后,查看表uni-pay-orders的pay_date字段即可
预期结果:
时间戳
时间戳
实际结果:
字符串
字符串
bug描述:
IOS内购的情况下,云函数更新后的uni-pay-orders中pay_date和notify_date均为字符串而非字段定义的时间戳。(其他支付均无此问题)
检查发现是因为uni-pay-co/service/pay.js中verifyReceiptFromAppleiap函数中verifyReceiptRes.receipt.receipt_creation_date_ms为字符串。
强制Number()后恢复正常