'How do I get apple receipt from app store events in laravel

I am using imdhemy/laravel-in-app-purchases plugin to manage mobile purchases from Google and Apple. I configured Google ok and I'm handling purchase events correctly.

But with apple subscriptions (renewable subscriptions) I can verify purchases, but I can't make the events listeners to work.

This is what I have working so far:

  • I can get a purchase from the mobile device and verify the receipt.
  • I can store the purchase identifier in my database.
  • I configured apple's push notification endpoint both for production and sandbox

My specific problem is:

  • the route /purchases/subscriptions/apple is expecting unified_receipt, unified_receipt.latest_receipt, unified_receipt.latest_receipt_info and notification_type.
  • but apple is sending Post: "{\x22signedPayload\x22:\x22eyJhbGciOiJFUzI1N...., if I'm not wrong, that is a JWT token, but in the library documentation, there is no information regarding JWT token.

That produces a 422 error from laravel's side, as it expects fields not sent by Apple.

Is there some extra configuration or step that I'm missing?

Thanks!



Solution 1:[1]

If you are switch to Notification version 1 you will find all data. Version 2 send only jwt token

Solution 2:[2]

If someone comes across this issue, the solution I found was to decrypt the JWT manually and skip all the custom events.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Igor ?urovi?
Solution 2 Richard Threepwood