question

max avatar image
max asked

Redeem Coupon 'GrantedItems' list empty, even though items were granted

I recently implemented the very cool redeem coupon feature into our app. Unfortunately, when redeeming a coupon, the 'GrantedItems' list of the ReedemCouponResult is empty.

I'm granting a bundle that disappears after 3 seconds to give the player some soft currency. Could this be the issue?

The soft currency is correctly added to the player's account, but I can't show my player what kind of Coupon he redeemed.

Player DataPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

In my testing, GrantedItems contains the item added, as well as any items that were added as part of the bundle, though it does not return any virtual currency added at the moment (we have a backlog item to add that). If you're not seeing the bundle item itself in GrantedItems, can you send us the specifics of your repro (Title ID, Item ID from your catalog)?

8 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

max avatar image max commented ·

That's interesting...Yes I'm not seeing the bundle item itself, I get a list of zero items with a success result.

Sure, here's the data, TitleID: D73D ItemID: com.forestringgames.towerduel.smalbagsoftcurrency

0 Likes 0 ·
brendan avatar image brendan max commented ·

Can you send me the specifics of your test - the actual calls you're making and the values passed in? I just created a player in your title (B40F3BBE5E278862 - feel free to delete it), generated a coupon for that item, and called RedeemCoupon from the client. The item was in GrantedItems in my test - here's the output from the call.

{
    "code": 200,
    "status": "OK",
    "data": {
        "GrantedItems": [
            {
                "ItemId": "com.forestringgames.towerduel.smalbagsoftcurrency",
                "ItemInstanceId": "26E71FFF6668D149",
                "ItemClass": "BagSoftCurrency",
                "PurchaseDate": "2017-03-16T00:08:25.533Z",
                "Expiration": "2017-03-16T00:08:29.533Z",
                "CatalogVersion": "MainCatalog",
                "DisplayName": "Small bag of soft currency",
                "UnitPrice": 0
            }
        ]
    }
}
0 Likes 0 ·
max avatar image max brendan commented ·

Here's the function that I call:

void AccountManager::redeemCoupon(const std::string &coupon, const std::function<void(const std::list<PlayFab::ClientModels::ItemInstance> &playFabItemList)> successCallback, const std::function<void(CouponRedeemError error)> errorCallback)

    {

        PlayFab::ClientModels::RedeemCouponRequest request;

        request.CouponCode = coupon;

        // Breakpoint 1

        PlayFab::PlayFabClientAPI::RedeemCoupon(request, [=](const ClientModels::RedeemCouponResult &result, void *userData) {
             
            // Breakpoint 2
          
            // cut away since characters exceeded
        }, [=](const PlayFabError &error, void *userData)  {
	    // cut away since characters exceeded
        });

    }

I've set some breakpoints to inspect the values and here's printing the request with the debugger

(lldb) expr request

(PlayFab::ClientModels::RedeemCouponRequest) $0 = (CouponCode = "qpo-edfn-rc7", CatalogVersion = "", CharacterId = "")

And here's printing the result with the debugger:

(lldb) expr result

(const PlayFab::ClientModels::RedeemCouponResult) $1 = {

  GrantedItems = size=0 {}

}
0 Likes 0 ·
Show more comments
Show more comments
max avatar image max max commented ·

I was able to create a repro project (might take some time uploading): https://www.dropbox.com/s/t7um1udlf4de78s/PlayFabIssue.zip?dl=0

Run the Xcode project and use the Simulator or a connected device, both should work to trigger the bug. The starting point is the HelloWorld class that cocos creates by default.

Though the bug only happens sometimes, try to redeem 10+ coupons this way and you should see it at least once for sure. I see the bug with a ~80% chance.
In my main project the bug did now NOT appear one single time, which is also very weird. I tried again afterwards and it happened again. Hope this helps to track it down.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.