使用RevenueCat开发计费时POST /receipts遇520错误及购买异常
RevenueCat应用内计费POST /receipts返回520错误问题处理
问题详情
使用RevenueCat开发应用内计费功能时,完成购买后向/receipts发起POST请求出现520错误。Google Play显示购买已完成,但5分钟后收到购买取消邮件,错误日志如下:
[Purchases] - WARN W ⚠️ Unable to start a network connection due to a network configuration issue: https://api.revenuecat.com/v1/receipts [Purchases] - DEBUG D ℹ️ API request started: POST /receipts [Purchases] - DEBUG D ℹ️ API request completed with status: POST /receipts 520 [Purchases] - ERROR E 🤖‼️ There was a problem with the store.
排查及解决方向
- 网络配置拦截:日志明确提示网络配置问题,520是Cloudflare返回的未知错误,优先检查:
- 安卓端
network_security_config.xml是否允许访问api.revenuecat.com - 客户端/服务器的防火墙、代理是否拦截了该域名的HTTPS请求,确保开放443端口的出站权限
- 安卓端
- 服务临时故障:520可能源于RevenueCat的Cloudflare节点异常,可确认其服务状态是否正常
- 凭证提交重试:因网络问题导致凭证未及时验证,Google Play会自动取消购买。需在客户端实现本地缓存购买凭证的逻辑,当请求失败时自动重试提交
- API密钥校验:确认RevenueCat的API密钥配置正确,密钥错误也可能引发请求异常
内容的提问来源于stack exchange,提问作者Iñigo Bereciartua
相关产品推荐
相关产品推荐

