readdle / app-store-server-api

Pure PHP library that allows managing customer transactions using the App Store Server API and handling server-to-server notifications using the App Store Server Notifications V2
MIT License
54 stars 20 forks source link

Thank you and a question about Requesting a Test Notification #13

Closed AmitSonkhiya closed 9 months ago

AmitSonkhiya commented 9 months ago

Hi,

I want to express my gratitude for this excellent library. It has significantly streamlined our interactions with the App Store API.

I have a query regarding the process of handling test notifications. We made a request to send a test notification token using the AppStoreServerAPI::requestTestNotification() method. Upon receiving a response in the controller script, we obtained a JWT payload, which we converted into a JSON object:

{
    "signedPayload": "gyJhbGciWiJFUzI1NiIsPsg1................a5oO78Q"
}

Now, we are unsure about the next steps. Specifically, we are uncertain about what needs to be passed to the AppStoreServerAPI::getTestNotificationStatus(string $testNotificationToken) method to send the token to the Apple server and obtain the responseBody and other relevant information.

The example seems tailored to scenarios where the same script requests the notification and handles the payload. https://github.com/readdle/app-store-server-api/blob/master/examples/requestAndCheckTestNotification.php

Could you kindly provide some guidance on how to proceed with obtaining the test notification status and extracting the necessary information?

Thank you for assisting.

pkotets commented 9 months ago

Hi,

The example you've mentioned shows how to request a test notification and check its status, so doing it in the same lifecycle is natural. At the same time, this specific flow is not useful irl.

The situation you described consists of two independent parts:

  1. Request test notification (you already did it)
  2. Process incoming S2S notification. To do this, you may follow this example: https://github.com/readdle/app-store-server-api#app-store-server-notifications
AmitSonkhiya commented 9 months ago

Hi,

Thank you and I got that. This ticket may be closed.

Just I would like to let you know that your work is deeply appreciated and it heavily reduced the burden of handling IAP. Have a good time ahead.