aporat / store-receipt-validator

PHP receipt validator for Apple iTunes, Google Play and Amazon App Store
Apache License 2.0
633 stars 153 forks source link

How to retrieve data 'POSTed' by in-app purchase plugin #51

Closed ef33zy closed 7 years ago

ef33zy commented 7 years ago

Hi,

Another novice question. I'm following the example file as detailed here,

The in-app plugin I'm using sends (POSTs) the data as such, and I see this request in the Network tab during debugging, but I'm not quite sure how to retrieve the info I need using my PHP file.

Essentially get the $receiptBase64Data to be my transaction.appStoreReceipt below:

{
"id":"xxxxxx",
"alias":"xxxxx",
"type":"paid subscription",
"state":"approved",
"title":"All Access",
"description":"my description",
"priceMicros":null,
"price":"£3.49",
"currency":"GBP",
"loaded":true,
"canPurchase":false,
"owned":false,
"downloading":false,
"downloaded":false,
"additionalData":null,
"transaction":{
    "type":"ios-appstore",
    "id":"1000000243254365",
    "appStoreReceipt":"MII....xxxxx.....zU=",
    "transactionReceipt":"ewoJI...xxxx...9"
    },
"valid":true,
"transactions":[
    "1000000243254365"
    ]
}

When I hard code it in there (i.e. copy & paste my appStoreReceipt value), it works fine.

Any help is very much appreciated.

As seen in the Network tab: image