Access public endpoints

I have setup the Golang sdk and this works great for all admin access endpoints.
I need to verify my receipts from the playstore and appstore.
I have found these 2 endpoints on this forum:

  1. Google Play: /platform/public/namespaces/{namespace}/users/{userId}/iap/google/receipt
    SDK: iapService.PublicFulfillGoogleIAPItemShort()
  2. Apple: /v2/public/namespaces/{namespace}/users/{userId}/iap/apple/receipt
    SDK: iapService.PublicFulfillAppleIAPItemShort()

Somehow i keep getting this error:
Requested PUT /platform/public/namespaces/{namespace}/users/{userId}/iap/google/receipt returns an error 403: {"errorCode":20003,"errorMessage":"unauthorized access"}

I suspect using the sdk only works for admin endpoints or i’m doing something wrong.
Why do i keep getting the unauthorized access error?

Hi @user24,

Could you please let me know which login method you are using (Email/Password or Client Credentials)? Please note that public endpoints should be accessed using Email/Password authorization.

Hi Damar,

I’m using the Golang SDK with a server to server call. By default this is setup with a custom backend tooling client. Then you setup the sdk with client credentials. I don’t know if it’s possible to do this with email/password authorization.

Best regards,

Thijmen

Hi @user24,

The public endpoint is intended for end users, such as players, and should be accessed using Email/Password authorization. The said endpoints should be called from the game client right after successfully purchased the IAP from the native platform (Google and Apple). May I know your use case on this one? Why you need custom backend to hit this endpoint?

We are not the typical users of the accelByte system. We have a Flutter app which has some gamified components which we use AccelByte for. Since we don’t have a game so we cannot use the unity or unreal sdk. Since we have a flutter app we use revenuecat to handle purchases in our app. Revenuecat will handle the buy with the correct sdk based on your OS.

Then if the transaction is complete we need to add the coins you have bought in AccelByte because we need the coins to buy other stuff in our app which is all handled by AccelByte.

Since we don’t implement the AccelByte client we also don’t use your IAM. We only have headless accounts to synchronize our users into your system.
This is the main reasoning behind using only the Golang SDK with a custom backend.

If the endpoints cannot be used this way we might have to find another way to synchronize the bought coins with AGS.

Thanks for the explanation @user24, I’ll pass this to internal team and will get back to you.

Hi @user24, after discussing this with our internal team, we currently do not have an equivalent API for the admin endpoint. As a workaround, we recommend handling this directly in your extension app. Here’s what you’ll need to do:

  1. Perform validation in your extension app to verify the purchase.
  2. If the purchase is valid, you can grant the currency by calling this endpoint:
    /admin/namespaces/{namespace}/users/{userId}/wallets/{currencyCode}/credit.

At the moment, we don’t have a roadmap for this feature, but it has been added to our backlog. Thank you for your patience and understanding!

Hi Damar,

Thank you for your help. I was indeed thinking about setting up a webhook from revenuecat (which handles the transaction) and then crediting the money.

Best regards,

Thijmen