chargebee / chargebee-ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

resource_not_found

styrken opened this issue · comments

I have purchased a product with your SDK and everything related to Apple seems to work. However, the SDK reports the purchase as failed while validating the receipt.

The last step of the SDK is to fetch a subscription from Chargebee, but this fails.

invalidRequest(errorResponse: Chargebee.CBErrorDetail(message: "1000000976907889 not found", type: Optional("invalid_request"), apiErrorCode: Optional("resource_not_found"), param: nil, httpStatusCode: Optional(404)))

The failing line is here:

Why is it failing here? Chargebee receipt validation returns a subscription id but it is nowhere to be found on my chargebee site.

We don't want end user to wait for Chargebee backend processing. So we create subscription id immediately and return it to App. But if there's a mandatory configuration missed in Chargebee then this subscription will not be created in Chargebee unless the configuration is done.
In this case we checked and found that currency being passed (i.e. DKK) is not configured in the Chargebee. So, please configure this currency in Chargebee site and make a purchase. You should be able to see the subscriptions in Chargebee.

Hi @cb-saisrikant.

Does this mean we have to setup currencies for all the countries where we support IAP?

I have enabled DKK currency but still get the same error above

Hi @styrken Yes. We need to enable all the currencies in Chargebee in which you are expecting payments so that we can record payments as per the respective exchange rates. We found that other prerequisites are also missing in the Chargebee site. So you are still getting this error. Please make sure that all prerequisite configurations are done at Chargebee end before integrating SDK. Following are the prerequisite configurations to be done at Chargebee end:

  1. Set up all the currencies you use in your app within Chargebee.
  2. Configure millisecond-based billing and enable proration.
  3. Set up all the billing frequencies that you offer in your app within Chargebee.

I can't find what I am missing.

Are there any logs I can see ?

Well, actually - a subscription was created now when I changed the plan price id. Let met investigate a bit.

That's great! FYI. If you already have products & subscriptions for your App in App store then you can import these using simple CSVs that are available on Chargebee site.

Hello again,
I have done some more testing. I see the SDK is fetching items from the chargebee API using v2/items endpoint with a filter: channels[is]=app_store

Only problem is; there is no way for me of setting my plans to that channel.

I tried using postman to update my item, when setting channel in the update request, it does not change.
I tried using admin panel, can't find any way of setting a channel on the plan.

Can you help me out? :-)

Please use the CSVs available in Chargebee site to upload App store products and Chargebee will create the corresponding plans automatically.

Where do you find that sample file?

I can't find one that looks like the screenshot here:

https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-products

Update:

I found the file when pressing the "upload" button under "manage app" in chargebee.

I used the upload feature but now I get this error:

Mapping for apple_product_id not found, expected one of [apple_product_id;name;currency_code;price;frequency;frequency_unit]

Example of row (Happens for all rows)

ERdyFx6cMAeAVM;Apple ABC (Family) Monthly Plan;USD;2999;1;month

Please note that CSV should have comma separated values. I can see that values are separated by ";" instead of "," in the example. I will take you through the integration in tomorrow's call.

Hi,
You are right. I guess "Numbers"-app on Mac changed those.

Closing this now as the original issue is resolved.