0

here is my problem.

I've set up an application in the Firefox MarketPlace. My application is approved and public. I can find it in the store, download it and use it.

It's a FREE app and some extra content can be unlocked with an fxpay in-app purchase. This also work.

I use javascript fxpay() lib.

When a user quits the app and come back, fxpay() call 'onrestore' method and on the return, the servers knows if the user have bought the in-app or not. But I don't know 'who' bought it. For example if I want to make some stuff available for 2 weeks, I need to identify my user and save him in my database.

So here is what I've tried from docs:

console.log('product: ',product.productId);

this works and return me the correct id relatively to my app administration panel

console.log('productname: ',product.name);

this also work

console.log('product.receiptInfo: ',product.receiptInfo);

this returns "undefined"

console.log('product.receiptInfo.status: ',product.receiptInfo.status);
console.log('product.receiptInfo.reason: ',product.receiptInfo.reason);
console.log('product.receiptInfo.receipt: ',product.receiptInfo.receipt);
console.log('product.receiptInfo.receipt: ',product.receiptInfo[0]);

All of theses doesn't return anything

Am I doing it wrong ? I cannot find anything in the doc about parsing the receipt properly !

I've seen this link but I think it only refers to the old library and not to fxPay

I've also seen this one but it doesn't help there too !

And Row ID
  • 169
  • 11

1 Answers1

0

fxpay just provides a way to purchase an item and verify the purchase via receipts. It does not provide user identity. What you can do is ask the user to log in before they make a purchase. You can use Facebook Connect, OpenID, or whatever you want. When they complete the purchase, you can associate the item with their user account. From there you should be able to make the item expire in two weeks.

If you want to get access to the receipt itself (as you illustrated in code), this was added to fxpay in version 0.0.15 but that has not been released yet. Even with access to the receipt, you would probably still need to track user identity to create an item that expires in two weeks.

kumar303
  • 674
  • 6
  • 7
  • Hello Kumar, thanks for the help and the clearance about fxpay! I think that, if I can access the receipt, regarding to the doc, I will no longer have problem. Let me explain: Case 1: I get the "iat" field from the receipt and from this, I can know how much time passed since the purchase (so I don't even need DB storage) Case 2: I get the "user" > "value" field from the receipt. and from this I stock it in my database and identify the user! This would only work if the receipt looks the same that it looks in the doc (with old payment lib) – And Row ID Mar 20 '15 at 08:53
  • Also, do you know when will it be released ? – And Row ID Mar 31 '15 at 14:16
  • 1
    We ran into some snags but we're down to only a couple bugs. We're hoping 0.0.15 will be out sometime next week. – kumar303 Apr 01 '15 at 18:41