Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

IAP not working correctly with Corona-2019.3528 and IOS 13
Started by accounting7 Sep 24 2019 08:34 AM

82 replies to this topic
[TOPIC CONTROLS]
« Page 4 of 4 2 3 4
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#76

colinmorgan

[GLOBAL: userInfoPane.html]
colinmorgan
  • Enthusiast

  • 47 posts
  • Corona SDK

I hope it works!

Like I said, since Apple provides zero feedback, we don't know why our apps were approved the second time through. Probably because of the note, but who knows?



[TOPIC: post.html]
#77

burdin.a.d3

[GLOBAL: userInfoPane.html]
burdin.a.d3
  • Observer

  • 12 posts
  • Corona SDK

Hello.

Has anyone solved the problem with purchases on iOS 13 with new IAP plugin?


[TOPIC: post.html]
#78

yosu

[GLOBAL: userInfoPane.html]
yosu
  • Contributor

  • 557 posts
  • Corona SDK

I am currently testing the new iap plugin on iOS13 (iPhone XR). I am using test flight with a sandbox tester account. It works with app in store too.

 

Purchase is successful with sandbox tester account.

 

there are 2 main data here. 

 

 

Sent to 'https://sandbox.itunes.apple.com/verifyReceipt' with a post json body. You can also try sending it to 'https://buy.itunes.apple.com/verifyReceipt' but it will most likely return '{"status":21007}' because it was using a sandbox account.

 

Sample body :

{"password":"...","receipt-data":"....."}

When you send it to Apple for verification :

 

  • event.transaction.receipt will return such data (sensitive info masked with XXX):
{
"receipt":{
"original_purchase_date_pst":"2020-03-20 02:05:41 America/Los_Angeles", 
"purchase_date_ms":"1584695141188", 
"unique_identifier":"00008020-000565223EE10XXX", 
"original_transaction_id":"1000000641424XXX", 
"bvrs":"2020.03.201521", 
"transaction_id":"1000000641424XXX", 
"quantity":"1", 
"unique_vendor_identifier":"BF033E1A-877C-42A0-B7B3-6E20B216CXXX", 
"item_id":"1448649XXX", 
"version_external_identifier":"0", 
"bid":"com.XXX", 
"is_in_intro_offer_period":"false", 
"product_id":"com.XXX", 
"purchase_date":"2020-03-20 09:05:41 Etc/GMT", 
"is_trial_period":"false", 
"purchase_date_pst":"2020-03-20 02:05:41 America/Los_Angeles", 
"original_purchase_date":"2020-03-20 09:05:41 Etc/GMT", 
"original_purchase_date_ms":"1584695141188"}, 
"status":0
}

  • store.receipt_base64_data will return much more data :
"receipt":{
"receipt_type":"ProductionSandbox", 
"adam_id":0, 
"app_item_id":0, 
"bundle_id":"com.XXX", 
"application_version":"2020.03.201521", 
"download_id":0, 
"version_external_identifier":0, 
"receipt_creation_date":"2020-03-20 09:05:41 Etc/GMT", 
"receipt_creation_date_ms":"1584695141000", 
"receipt_creation_date_pst":"2020-03-20 02:05:41 America/Los_Angeles", 
"request_date":"2020-03-20 09:39:00 Etc/GMT", 
"request_date_ms":"1584697140182", 
"request_date_pst":"2020-03-20 02:39:00 America/Los_Angeles", 
"original_purchase_date":"2013-08-01 07:00:00 Etc/GMT", 
"original_purchase_date_ms":"1375340400000", 
"original_purchase_date_pst":"2013-08-01 00:00:00 America/Los_Angeles", 
"original_application_version":"1.0", 
"in_app":[
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639052XXX", "original_transaction_id":"1000000639052XXX", "purchase_date":"2020-03-14 02:53:43 Etc/GMT", "purchase_date_ms":"1584154423000", "purchase_date_pst":"2020-03-13 19:53:43 America/Los_Angeles", "original_purchase_date":"2020-03-14 02:53:43 Etc/GMT", "original_purchase_date_ms":"1584154423000", "original_purchase_date_pst":"2020-03-13 19:53:43 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639056XXX", "original_transaction_id":"1000000639056XXX", "purchase_date":"2020-03-14 03:21:00 Etc/GMT", "purchase_date_ms":"1584156060000", "purchase_date_pst":"2020-03-13 20:21:00 America/Los_Angeles", "original_purchase_date":"2020-03-14 03:21:00 Etc/GMT", "original_purchase_date_ms":"1584156060000", "original_purchase_date_pst":"2020-03-13 20:21:00 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639057XXX", "original_transaction_id":"1000000639057XXX", "purchase_date":"2020-03-14 03:34:22 Etc/GMT", "purchase_date_ms":"1584156862000", "purchase_date_pst":"2020-03-13 20:34:22 America/Los_Angeles", "original_purchase_date":"2020-03-14 03:34:22 Etc/GMT", "original_purchase_date_ms":"1584156862000", "original_purchase_date_pst":"2020-03-13 20:34:22 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639058XXX", "original_transaction_id":"1000000639058XXX", "purchase_date":"2020-03-14 03:48:45 Etc/GMT", "purchase_date_ms":"1584157725000", "purchase_date_pst":"2020-03-13 20:48:45 America/Los_Angeles", "original_purchase_date":"2020-03-14 03:48:45 Etc/GMT", "original_purchase_date_ms":"1584157725000", "original_purchase_date_pst":"2020-03-13 20:48:45 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639066XXX", "original_transaction_id":"1000000639066XXX", "purchase_date":"2020-03-14 04:56:13 Etc/GMT", "purchase_date_ms":"1584161773000", "purchase_date_pst":"2020-03-13 21:56:13 America/Los_Angeles", "original_purchase_date":"2020-03-14 04:56:13 Etc/GMT", "original_purchase_date_ms":"1584161773000", "original_purchase_date_pst":"2020-03-13 21:56:13 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639068XXX", "original_transaction_id":"1000000639068XXX", "purchase_date":"2020-03-14 05:17:14 Etc/GMT", "purchase_date_ms":"1584163034000", "purchase_date_pst":"2020-03-13 22:17:14 America/Los_Angeles", "original_purchase_date":"2020-03-14 05:17:14 Etc/GMT", "original_purchase_date_ms":"1584163034000", "original_purchase_date_pst":"2020-03-13 22:17:14 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000639071XXX", "original_transaction_id":"1000000639071XXX", "purchase_date":"2020-03-14 05:45:42 Etc/GMT", "purchase_date_ms":"1584164742000", "purchase_date_pst":"2020-03-13 22:45:42 America/Los_Angeles", "original_purchase_date":"2020-03-14 05:45:42 Etc/GMT", "original_purchase_date_ms":"1584164742000", "original_purchase_date_pst":"2020-03-13 22:45:42 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000640284XXX", "original_transaction_id":"1000000640284XXX", "purchase_date":"2020-03-18 04:06:04 Etc/GMT", "purchase_date_ms":"1584504364000", "purchase_date_pst":"2020-03-17 21:06:04 America/Los_Angeles", "original_purchase_date":"2020-03-18 04:06:04 Etc/GMT", "original_purchase_date_ms":"1584504364000", "original_purchase_date_pst":"2020-03-17 21:06:04 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000640510XXX", "original_transaction_id":"1000000640510XXX", "purchase_date":"2020-03-18 12:04:32 Etc/GMT", "purchase_date_ms":"1584533072000", "purchase_date_pst":"2020-03-18 05:04:32 America/Los_Angeles", "original_purchase_date":"2020-03-18 12:04:32 Etc/GMT", "original_purchase_date_ms":"1584533072000", "original_purchase_date_pst":"2020-03-18 05:04:32 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000640572XXX", "original_transaction_id":"1000000640572XXX", "purchase_date":"2020-03-18 13:45:00 Etc/GMT", "purchase_date_ms":"1584539100000", "purchase_date_pst":"2020-03-18 06:45:00 America/Los_Angeles", "original_purchase_date":"2020-03-18 13:45:00 Etc/GMT", "original_purchase_date_ms":"1584539100000", "original_purchase_date_pst":"2020-03-18 06:45:00 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000641342XXX", "original_transaction_id":"1000000641342XXX", "purchase_date":"2020-03-20 06:14:08 Etc/GMT", "purchase_date_ms":"1584684848000", "purchase_date_pst":"2020-03-19 23:14:08 America/Los_Angeles", "original_purchase_date":"2020-03-20 06:14:08 Etc/GMT", "original_purchase_date_ms":"1584684848000", "original_purchase_date_pst":"2020-03-19 23:14:08 America/Los_Angeles", "is_trial_period":"false"}, 
{"quantity":"1", "product_id":"com.XXX", "transaction_id":"1000000641424XXX", "original_transaction_id":"1000000641424XXX", "purchase_date":"2020-03-20 09:05:41 Etc/GMT", "purchase_date_ms":"1584695141000", "purchase_date_pst":"2020-03-20 02:05:41 America/Los_Angeles", "original_purchase_date":"2020-03-20 09:05:41 Etc/GMT", "original_purchase_date_ms":"1584695141000", "original_purchase_date_pst":"2020-03-20 02:05:41 America/Los_Angeles", "is_trial_period":"false"}]}, 
"status":0, "environment":"Sandbox"}



[TOPIC: post.html]
#79

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Corona Geek

  • 1,057 posts
  • Corona Staff

Hello! Just to be clear, Apple specifically says that you should be used from your servers, not from your app. Workflow is following:

You make a purchase, app sends receipt to your server. Server talks to Apple, verifying receipt and sends your app confirmation of the purchase.

If you want to do it on your device, you have to use receiptDecrypted. It will verify purchases on the device, checking cryptographic signatures. See some sample around here. It will also remove unnecessary network calls.



[TOPIC: post.html]
#80

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 974 posts
  • Corona SDK

One question because this all is confusing...

 

Is the following usage still working?

local store = require( "store" )

local json = require( "json" )


-- Transaction listener function
local function transactionListener( event )



    if not ( event.transaction.state == "failed" ) then  -- Successful transaction
        print( json.prettify( event ) )
        print( "event.transaction: " .. json.prettify( event.transaction ) )


    else  -- Unsuccessful transaction; output error details
        print( event.transaction.errorType )
        print( event.transaction.errorString )
    end


    -- Tell the store that the transaction is finished
    store.finishTransaction( event.transaction )

end


-- Initialize Apple IAP

store.init( transactionListener )

And inside the not failed state:

if event.transaction.state == "purchased" or event.transaction.state == "restored" then

                  if productID=="PERSONAL PRODUCT NAME" then

                         --- do stuff
                     end
end

I just wonder if this code still can be used with the new build version and if it is working fine on all current iOS versions?

 

Any help welcome.
 



[TOPIC: post.html]
#81

bus_ter2011

[GLOBAL: userInfoPane.html]
bus_ter2011
  • Observer

  • 19 posts
  • Corona SDK

Hello! Just to be clear, Apple specifically says that you should be used from your servers, not from your app. Workflow is following:

You make a purchase, app sends receipt to your server. Server talks to Apple, verifying receipt and sends your app confirmation of the purchase.

If you want to do it on your device, you have to use receiptDecrypted. It will verify purchases on the device, checking cryptographic signatures. See some sample around here. It will also remove unnecessary network calls.

In store.receipt encrypted().in_app for each subscription there is an expires_date parameter that is the expiration time of the recipe. Tell me in what time zone does expires_date come? What is the best way to check the end time? Can I find out to Google time and compare it?



[TOPIC: post.html]
#82

vlads

[GLOBAL: userInfoPane.html]
vlads
  • Corona Geek

  • 1,057 posts
  • Corona Staff

It’s supposed to be Unix time. It has no time zone, it is rather point in universal time- how much seconds passed from Jan 1970. There are convenience functions to get or translate it. But most of the time you can get and compare it directly, like
os.time(os.date("!*t"))

[TOPIC: post.html]
#83

bus_ter2011

[GLOBAL: userInfoPane.html]
bus_ter2011
  • Observer

  • 19 posts
  • Corona SDK

It’s supposed to be Unix time. It has no time zone, it is rather point in universal time- how much seconds passed from Jan 1970. There are convenience functions to get or translate it. But most of the time you can get and compare it directly, like
os.time(os.date("!*t"))

The difference between UNIX time (from Jan 1970) and purchase date is 82 hours. There is a 78 hour difference between os.time(os.date("!*t")) and purchase_date. I can't figure out how to check the time with such a difference. Maybe time is distorted due to testing in TestFlight?




[topic_controls]
« Page 4 of 4 2 3 4
 
[/topic_controls]