Author Topic: Currency not added to user automatically  (Read 47 times)

Offline Nikolasio

  • Member
  • *
  • Posts: 45
    • View Profile
Currency not added to user automatically
« on: January 05, 2019, 07:16:09 pm »
Hi,

I'm testing IAPs for real money.  I only have IAP's of the type 'currency' and as explained in the release notes 4.0 currency should be added automatically but it isn't.

I can successfully make purchases with a sandbox tester account and a PlayFab receipt verification (I'm using the full suite) occurs in the play stream, but the purchased currency isn't added to the player's account.
Is this expected behaviour? Or should the currency been added to the player's account?
« Last Edit: January 05, 2019, 09:13:50 pm by Baroni »

Offline Baroni

  • Administrator
  • *****
  • Posts: 1381
    • View Profile
Re: Testing IAPs on ios device.
« Reply #1 on: January 05, 2019, 09:13:11 pm »
Hi,

the purchased currency should be added to the player's account on PlayFab as well as locally on the device.

Could you check a few things:
- is the currency added correctly on the players account on PlayFab?
--> Yes: purchases and receipt verification works, also your configured currency is fine
--> No: check your cloud script on PlayFab, check purchase status in player's account on PlayFab, check that the currency exists in the item catalog
- is the currency added locally? No:
--> but if it works on PlayFab's side, it should be synced after restarting and signing in the player again
--> check that the ProcessPurchase implementation of the IAPManager is called, and what it is called with
--> check that the PurchaseVerified method of the IAPManager is called, specifically at its IAPType.Currency type

Offline Nikolasio

  • Member
  • *
  • Posts: 45
    • View Profile
Re: Currency not added to user automatically
« Reply #2 on: January 09, 2019, 01:47:45 pm »
Is the currency added correctly on the players account on PlayFab? No.
- The 2 handlers (grandItems and addCurrency) from the CloudScript.txt file included in SIS are added to the latest revision.
- No purchases are registered but in the players event history there's a player_receipt_validation event logged.
- The currency exists.  The currency json is uploaded first and then the catalog son. In game, the SetFunds method works well and currency is synchronised with PlayFab on events.
- The item Id's from the catalog bundles correspond with the app store product Id's. But I still get the error message (in the Xcode console and extra debug script) : "The receipt for 'pile_of_coins' could not be verified: InvalidBundleID". I've copied the Xcode log in a txt file and sent it via email.

Is the currency added locally? No.
- The ProcessPurchase and PurchaseVerified methods are up to date with SIS4.2. 
- In the PurchaseVerified method at case IAPType.Currency, I added a debug.log in the foreach loop, but didn't see it appear in the log.  So it's not called.

I went through the complete iOS and Playfab set up again. I was/am using an app store distribution provisioning profile.  Added an ad hoc distribution provisioning profile so that my test devices would be included but the issue persists. I fail to see what I'm missing.

Offline Nikolasio

  • Member
  • *
  • Posts: 45
    • View Profile
Re: Currency not added to user automatically
« Reply #3 on: January 09, 2019, 02:41:00 pm »
Disregard my reply!

As the debug log says: InvalidBundleID,
thus, the Bundle ID defined for your title in PlayFab (on the Settings page of the Game Manager) needs to match your game's Bundle ID in iTunes (usually something like "com.company_name.app_name").

Tested it again, and it works like a charm!

Offline Nikolasio

  • Member
  • *
  • Posts: 45
    • View Profile
Re: Currency not added to user automatically
« Reply #4 on: January 09, 2019, 02:55:03 pm »
This can be useful to check when getting a PlayFab error message:
https://community.playfab.com/questions/124/205469588-Validation-problems-with-iTunes-receipts.html
 
« Last Edit: January 09, 2019, 03:06:01 pm by Nikolasio »