Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined array key "product_id" Exception #173

Open
freelancefrivas opened this issue Jun 16, 2023 · 5 comments
Open

Undefined array key "product_id" Exception #173

freelancefrivas opened this issue Jun 16, 2023 · 5 comments

Comments

@freelancefrivas
Copy link

I'm getting this exception while it validates an Apple notification, on PendingRenewalInfo.php, line 140.
I'm Printing the payload on the log before validation and it looks like this:
[notification_type] => REVOKE
[password] => xxxxxxxxxxxxxxxxxxxxxxxx
[environment] => PROD
[auto_renew_product_id] => com.learnsafari.spanish_safari_monthSub2
[auto_renew_status] => false
[unified_receipt] => Array
(
[status] => 0
[environment] => Production
[latest_receipt_info] => Array
(
[0] => Array
(
[quantity] => 1
[product_id] => com.learnsafari.spanish_safari_monthSub2
[transaction_id] => 502432905404171488
[purchase_date] => 2023-05-14 23:36:30 Etc/GMT
[purchase_date_ms] => 1684107390000
[purchase_date_pst] => 2023-05-14 16:36:30 America/Los_Angeles
[original_purchase_date] => 2023-05-14 23:36:31 Etc/GMT
[original_purchase_date_ms] => 1684107391000
[original_purchase_date_pst] => 2023-05-14 16:36:31 America/Los_Angeles
[expires_date] => 2023-05-28 23:36:30 Etc/GMT
[expires_date_ms] => 1685316990000
[expires_date_pst] => 2023-05-28 16:36:30 America/Los_Angeles
[web_order_line_item_id] => 502432905404171489
[is_trial_period] => true
[is_in_intro_offer_period] => false
[original_transaction_id] => 502432905404171488
[cancellation_date] => 2023-06-13 00:32:26 Etc/GMT
[cancellation_date_ms] => 1686616346743
[cancellation_date_pst] => 2023-06-12 17:32:26 America/Los_Angeles
[cancellation_reason] => 0
[in_app_ownership_type] => FAMILY_SHARED
[subscription_group_identifier] => 20619207
)

            )

        [latest_receipt] => MIIU0gYJKoZIhvcNAQcCoIIUwzCCFL8CAQExCzAJBgUrDgMCGgUAMIIEEAYJKoZIhvcNAQcBoIIEAQSCA/0xggP5MAoCARQCAQEEAgwAMAsCARkCAQEEAwIBAzAMAgEKAgEBBAQWAjQrMAwCAQ4CAQEEBAICAIwwDQIBDQIBAQQFAgMCTLIwDgIBAQIBAQQGAgRDIK2UMA4C$
    )

[bid] => com.learnsafari.spanish-safari-v1
[bvrs] => 20221130.1
[original_transaction_id] => 502432905404171488
@Stafox
Copy link
Collaborator

Stafox commented Jun 16, 2023

hi. you should not try to put notification payload into ProductionResponse constructor.
Run validation instead using latest_receipt and password from notification.

The structure looks similar but different.

@Stafox
Copy link
Collaborator

Stafox commented Jun 16, 2023

In case you get the error on validation stage, could you share Raw validation response from Apple?

@freelancefrivas
Copy link
Author

You're right, reviewing this I realize the server is treating V1 notifications as if they were V2, and the payload shouldn't be used to validate.
Sorry, should have checked this better before posting.

@freelancefrivas freelancefrivas closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
@freelancefrivas
Copy link
Author

Sorry, reviewing this again, I notice the parameters are fine. There is a problem when the response is being processed, and it seems to be because the Pending_renewal_info field has an empty array inside. I wonder why this could happen...
I'm attaching a screenshot where the data is displayed.
learnsafari

@MartinPerry
Copy link

Have you solved this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants