gdx-pay icon indicating copy to clipboard operation
gdx-pay copied to clipboard

Does gdx-pay-server support iOS subscriptions at all?

Open kdbeall opened this issue 6 years ago • 10 comments

Reading the Apple pay docs, the Json sent to Apple to validate a receipt is as follows.

Key Value
receipt-data The base64 encoded receipt data.
password Only used for receipts that contain auto-renewable subscriptions.
exclude-old-transactions Only used for iOS7 style app receipts that contain auto-renewable or non-> renewing subscriptions. If value is true, response includes only the latest renewal transaction for any subscriptions. Unless there's some magic in Base64Util.

From what I see in your PurchaseVerifieriOSApple.java: 64, you only have the receipt-data field being sent for validation.

final String receiptData = Base64Util.toBase64(receipt.getBytes());
final String jsonData = "{\"receipt-data\" : \"" + receiptData + "\"}";

I'm still a bit confused about whether subscription receipt validation is supported or not. I'd just like to be sure about this. Thank you!

kdbeall avatar May 18 '18 17:05 kdbeall

Yes, it is supported but the code is currently wrong. You need to use getTransactionDataSignature() for purchase validation. See: https://github.com/libgdx/gdx-pay/issues/166

noblemaster avatar May 19 '18 01:05 noblemaster

Are you actually using it? We consider to remove it if no one uses it.

keesvandieren avatar Jul 14 '18 19:07 keesvandieren

I ended up rolling my own based on the code in libgdx. Ended up not using it because I switched to Python and Django. But, here's the repository!

kdbeall avatar Jul 17 '18 18:07 kdbeall

@keesvandieren I think we should remove the server component as it is outdated, incomplete and confuses new users.

MrStahlfelge avatar Nov 25 '18 09:11 MrStahlfelge

I think doing server-side verification is somewhat important. That said, the code is incomplete and needs testing. Not sure what you mean by "outdated"? I am not aware of a more modern approach to server side verification!?

In any case, if everyone thinks removing it is a good idea (no one does server side verification?), let's go ahead. However, we should still have some sample code available in the Wiki for example that shows how it works. That's what the 'transationData'/'transactionDataSignature' fields in Transaction.java are for. By removing the server side code we stop explaining also how those fields are to be used.

noblemaster avatar Nov 26 '18 04:11 noblemaster

You are absolutely right with providing a documentation what fields are needed to be sent to a server. If there is different information needed depending on the payment server, this should be stated on the payment service related page.

I don't think server-side verification is superflouus, but it is not important for everyone. And I am convinced that it is not important for a libGDX extension. libGDX is a client-side framework. so server code is not part of the task here. Indeed, I assume the majority of libGDX games work without a dedicated backend, and even of the games using a backend there will only be a fraction using a Java-powered backend.

About outdated, that is just an assumption because the code is 4 years old and I doubt it works without changes. I really doubt anyone uses it given the fact that it even Google Play is not implemented at all.

MrStahlfelge avatar Nov 26 '18 09:11 MrStahlfelge

I think it should ideally be separated out (perhaps a maintainer could be found).

kdbeall avatar Nov 30 '18 16:11 kdbeall

Verification is not terribly complicated to deal with server side. Simple example probably doesnt hurt. Google verification can be done with 'google-api-services-androidpublisher' stuff. Im sure theres something like that for amazon as well.

piotr-j avatar Dec 12 '18 20:12 piotr-j

@piotr-j I have seen you made some fixes for this in your repo. Feel free to create a PR when you are done and testet it, and perhaps to write a wiki page how to use the server side verification. Thanks in advance!

MrStahlfelge avatar Dec 17 '18 15:12 MrStahlfelge

Will do when i test it properly.

piotr-j avatar Dec 17 '18 15:12 piotr-j

Closing as we received no reaction from #166, which is an indication that it is resolved

keesvandieren avatar Sep 25 '23 19:09 keesvandieren