adaptyteam / AdaptySDK-React-Native

React Native SDK for growing in-app subscriptions
https://docs.adapty.io/docs/quickstart
MIT License
123 stars 12 forks source link

Server error on Purchase #68

Closed HaseebArshad1 closed 1 year ago

HaseebArshad1 commented 1 year ago

Description

A bug happened!

Hey @divanc, Can you please check this issue as well. Thanks!

[2023-04-28T06:16:50.113Z] [adapty@2.4.5] "bridgeCall": Calling bridge function: OK {"error": [Error: {"adapty_code":2004,"message":"Server error","detail":"HTTPError.backend(POST \/sdk\/in-apps\/apple\/receipt\/validate\/, [2.4.4]: Adapty\/Backend.Validator.swift#21, statusCode: 400, body: {\"errors\":[{\"detail\":\"21002: The data in the receipt-data property was malformed.\",\"status\":\"400\",\"source\":{\"pointer\":\"\/data\"},\"code\":\"APPLE_RECEIPT_VALIDATION_ERROR\"}]})"}]}
 DEBUG  [2023-04-28T06:16:50.114Z] [adapty@2.4.5] "BridgeError.nativeErr": Creating new BridgeError from native error... {"args": [Error: {"adapty_code":2004,"message":"Server error","detail":"HTTPError.backend(POST \/sdk\/in-apps\/apple\/receipt\/validate\/, [2.4.4]: Adapty\/Backend.Validator.swift#21, statusCode: 400, body: {\"errors\":[{\"detail\":\"21002: The data in the receipt-data property was malformed.\",\"status\":\"400\",\"source\":{\"pointer\":\"\/data\"},\"code\":\"APPLE_RECEIPT_VALIDATION_ERROR\"}]})"}]}
 DEBUG  [2023-04-28T06:16:50.115Z] [adapty@2.4.5] "BridgeError": Raised new BridgeError {"adapty_code": 2004, "detail": "HTTPError.backend(POST /sdk/in-apps/apple/receipt/validate/, [2.4.4]: Adapty/Backend.Validator.swift#21, statusCode: 400, body: {\"errors\":[{\"detail\":\"21002: The data in the receipt-data property was malformed.\",\"status\":\"400\",\"source\":{\"pointer\":\"/data\"},\"code\":\"APPLE_RECEIPT_VALIDATION_ERROR\"}]})", "message": "Server error"}
 DEBUG  [2023-04-28T06:16:50.115Z] [adapty@2.4.5] "makePurchase": Calling method: OK {"error": [Error: #2004 (serverError): Server error]}
 LOG  adaptyPurchaseError {"adaptyCode":2004,"localizedDescription":"Server error"}

Version

v2.3.5

What platforms are you seeing the problem on?

iOS

System info

iOS: 16.4.1
Device: iPhone 14 pro max
HaseebArshad1 commented 1 year ago

FYI: I just checked this occurs sometimes in production but seem to be occurring every time in debug mode!

In production steps to reproduce: Make a purchase for first subscription, all works normally and passes. Make purchase for another subscription, purchase passes but after showing payment was successful modal it shows undefined error from adapty! And the subscription receipt is not received.

divanc commented 1 year ago

Hello, @HaseebArshad1. Do you use StoreKit configuration file?

HaseebArshad1 commented 1 year ago

@divanc Yes, we are using StoreKit configuration file. Do i have to follow some different steps for that?

divanc commented 1 year ago

Sadly, we do not currently support on-device receipt validation, that is a part of StoreKit config file. StoreKit generates synthetic receipts, that require a separate workflow.

It is also not currently planned on a native side. I'm sorry, but our current recommendation here is to not use config file

divanc commented 1 year ago

@HaseebArshad1, ping to the message above. I guess, you won't be notified otherwise

HaseebArshad1 commented 1 year ago

@divanc Got it, Thanks for sharing details! Closing the ticket.