问题描述:

Here's the thing.

were doing some cross-platform game, selling some virtual currency to be used on our game, and life are awesome. Until came the requirements for BI.

The requirements are completely legible - no magic here. Only that with Apple, it's (how to say gently) ...hell.

Here I have to report for every package that was purchased, what is the price that was presented to the user, and what of it was passed to us.

So, OK, after I get a report of a successful purchase and get a receipt

  • I pass it to my server
  • I check the receipt with apple, get it decoded
  • in the receipt I find the package ID - awesome.

But there is no information about sums :o

All this is available when doing billing integration for credit-cards. What would be the equivalent for Apple In-App Purchases?

More info? Ok.

I could cheat a little and solve half of the problem, naming packages like

com.example.vc100

com.example.vc100_promo1

where in both packages the user buys 100 coins of VC, but

  • vc100 is sold in the usuall case, by the price of some tier that makes sense to our game-balancers, and
  • vc100_promo1 is sold by promotions by the price of a cheaper tier that makes sense to our marketting.

So, the fallback would be to maintain two lists. one on our servers, and one on the apple back-end, repeating in both ends the relations between a pack and a tier.

Another fallback would be to encode both the VC-sum and the tier in the name. But that would be a partial solution, because we still don't know what price was presented to the user, AND need to maintain a list on our side that would update every-time a price tier is redefined.

Yuck. I refuse to believe there's no better way to do it!

My goal is that marketers can create whatever product-SKU they wish to sell in one place. Obviously, Apple wont let me do that, so at least let it be one list per platform: apple-skus on the iTunes backend, and cross-billing-provider skus in our integration layer for our billing partners, who are much more cooperative than the ...appholes in apple.

Basically, if clients can pull this information and present it to the users - there has to be a way to do it on our servers, and collect this information for BI events.

Having the commission that apple cuts a constant percent from the US price - all we need is to have on our servers the prices for the sold SKU in local currency and USD.

Anybody?

网友答案:

so, no long - no answer.

We could not find a way to get this info from Apple in a peer-to-peer request.

What we ended up doing is collect the sums on the client and pass them to the server together with the receipt, protect the values with hashing signature, and send it over ssl.

If there is a better solution - I'd still want to learn about it

网友答案:

Unfortunately -- incredibly -- Apple doesn't include the price tier as part of the receipt, so the approaches you've outlined are the only options:

  1. The client can store the price tier + local currency price and send it up to the server at time of purchase
  2. The server can maintain a separate list of [product ids -> price tiers], and [price tiers -> local currency price] per tier, both of which need to be kept in sync with iTunes.

It looks like iTunes connect has an (unofficial) JSON API, which could be used to automate #2 (keeping the server in sync with iTunes). I haven't tried it though!

See iTunes Connect API and https://github.com/fastlane/itc-api-docs

相关阅读:
Top