How can a server determine the amount of an iphone in-app purchase ?
The server receives the purchase's receipt sent by the app and uses this to validate it.
This returns some informations like a transaction_id, product_id, etc; but no amount or user details.
Since the amount depends on the currency and the user's country, how can I get the amount of the purchase on the server ?
From the same document, you can get product details localized through the SKProduct class, check this
If you are asking about how do the server knows it, when you setup an in-app purchase on the server you choose the price as tier, each tier has the price in different currencies so when you send the in-app purchase product id in the request, it check its price you setup and reflects it in the corresponding currency.
For device locale, check this and for device language check this but to get it from the server itself, Apple doesn't provide an API for it.
Now it is possible to set a different price for each country so the mapping of in app purchase to a pricing tier can be cumbersome.
You can get the price as the user see it in the UI and the price locale from the client and then send that information to your server.
For renewals - You can see renewals by verifying the receipt data on the server side and use the price sent by the client in the first transaction.
Related
I accept webhooks from AppStore, but I'm wondering why there's no price the user paid for the subscription? I mean in transaction info JWSTransactionDecodedPayload. Also I couldn't find any other API methods to get the price.
The reason I need the price, because there may be different cost and commission the customer has to pay, depending on his country or something else.
We can only get the price from client with SKProduct in Original StoreKit by SKProductsRequest, or with Product in StoreKit 2 by products(for:) for now.
Or we get the price from App Store Connect with ProductID configured on Apple. However, price currency is related with AppleID, means we also need currency to confirm how much user paid.
I think why receipt not contains price is also for this reason. Apple could not represent all prices with different currency in a receipt, so only provide ProductID for us to query.
I am currently developing a mobile application in which I am implementing a wallet feature and I am using the PayPal API.
The users can execute a service in exchange of a payment.
Is it possible to let the users store the money received in the wallet within the app ?
Will I also need to acquire any financial certificate before releasing the app?
Thank you very much.
You'll have to ask a lawyer or financial expert of the country(s) your business is based in as well as review any particular App Store policies, but my answer would be that with what you describe the "money received in the wallet" is more like "credits" until your app pays it out to an actual financial system.
You can use PayPal's Payouts API to send money to an email address.
(If there's no PayPal account at that address the recipient will get a notification and have 30 days to create one or add this email to an existing account, otherwise a refunded is processed automatically)
I work for a company offering in-app purchases. I am trying to have our purchase statistics alright after a user has obtained a refund for an in-app purchase with iTunes connect.
I have read the iTunes connect sales and trends guide (pdf) and know how to retrieve sales for a given period of time with the auto-ingestion tool provided.
Unfortunately, the report I get does not contain any field that would allow me to know precisely which purchase or user was refunded. I just know about the amount and Apple id, so here comes my question:
Is there a way to add custom fields when creating a new in-app purchase so that I could pass my order_id to be retrieved it in the sales report?
That is the only way I see to know exactly which purchase on our side was refunded.
Thank you in advance!
In iTunes Connect it is possible to give a free trial period for autorenewable subscriptions.
App > Manage In App Purchases > Subscription Basic > 1 Month > Offer a free trial?
How can I get this information on the client? SKProduct does not have any information about this as I can see. Since we're having a marketing campaign it is very confusing for the end user to not see information about the product has a trial period.
Of course it is possible to fetch this kind of information from a server I maintain, but then we'll have the overhead with updating both our server and iTunes Connect. So I don't accept this kind of answer unless it is wired up to retrieving that trial period information from Apple's services.
TLDR; It is not possible. You need to manage this information yourself.
When you process an SKPayment you get back a receipt. You should verify those receipts regularly for subscriptions (e.g. before downloading new content) as the user might have cancelled the subscription. When the user does cancel the subscription or the subscription expires you get back a descriptive error when verifying the purchase's receipt.
Moreover the receipt gives you all the information you need: for a given product you know which trial period you grant. Therefore when a purchase is made you could store the purchase date given from the purchase receipt in your model object or in the NSUserDefaults or in the Keychain alongside the purchase data. At this point you know when the trial is expired and verify that the subscription is still valid. If you can't you might want to disable access to the content until you're able to do so.
For more informations about purchase receipts and subscriptions check out the In-App Purchase Guide by Apple.
On the client side you usually identify the different products and characteristics by their product identifier as the App Store does not deliver certain information such as subscription period and free trial period.
So if your product ID is for example:
com.domain.app.product_paid1month_free7days you split the ID on the client side and know that the paid subscription duration is 1 month and the product has a free trial period of 7 days.
Of course one approach would be to transmit the product ID to your own server to get its characteristics as response. This way you can maintain the product list continuously without updating the binary and across versions.
SKProduct > introductoryPrice
Available since iOS 11.2
https://developer.apple.com/documentation/storekit/skproduct/2936878-introductoryprice?language=objc
I'm currently developing a Phonegap mobile application.
I implemented In App purchase in my iPhone application and it works fine.
I retrieve my products informations from itunes, I got the receipt of payment from itunes store, my app is sending the receipt back to my servers, the receipt is verified server side using curl/apple api.
My issue is, on the server side when I log the purchase when receipt is OK using information of the receipt, so I know which product the user bought through the app, the datetime, the transaction id BUT I don't know how much the user paid for it. The same product is on different itunes store (US, FR, UK..), so the price could be 100E or 140$, but on the server side how can I retrieve the price and currency the user paid (to make statistics for example)?
I don't think allow you to see the local purchase price.
Not really code related in that you select a purchase level and apple provides a chart in Itunesconnect to see what payment they take across a range of currencies .