Question about AppStore SYS_GET_TRANSACTIONS_PAGE behavior in S2S Cloud Code
-
Hi brainCloud team,
We are implementing an internal monthly revenue settlement tool and need to retrieve App Store IAP transactions for a specific month.
We observed different behavior depending on how the Cloud Code script is executed.
Environment
- App: dev
- Cloud Code script: S2S callable
- Service:
appStore - Operation:
SYS_GET_TRANSACTIONS_PAGE
Case 1: S2S
script/RUNwithout a player sessionOur backend calls the Cloud Code script through S2S
script/RUN.Inside the script, we tried:
var appStoreProxy = bridge.getAppStoreServiceProxy(); var response = appStoreProxy.sysGetTransactionsPage({ pagination: { rowsPerPage: 50, pageNumber: 1 }, searchCriteria: { type: "itunes", pending: false, createdAt: { "$gte": monthStart, "$lt": monthEnd } }, sortCriteria: { createdAt: -1 } });This failed with:
Processing exception: Unrecognized request: service=appStore, operation=SYS_GET_TRANSACTIONS_PAGE.Case 2: Same script from the brainCloud console after Quick Auth
When we ran the same Cloud Code script from the brainCloud web console, after Quick Auth created a player session, the request succeeded.
Case 3: S2S
script/RUN, but the script creates a player session explicitlyWe changed the script to create a session from a known dedicated service profileId:
var userSession = bridge.getSessionForProfile(sessionProfileId); var response = bridge.callAPIForSession(userSession, "appStore", "SYS_GET_TRANSACTIONS_PAGE", { context: { pagination: { rowsPerPage: 50, pageNumber: 1 }, searchCriteria: { type: "itunes", pending: false, createdAt: { "$gte": monthStart, "$lt": monthEnd } }, sortCriteria: { createdAt: -1 } } });This succeeded.
Questions
- Is
SYS_GET_TRANSACTIONS_PAGEexpected to require a player session, even when called from S2S Cloud Code? - Is there an official or recommended way to retrieve app-wide IAP transactions for a monthly settlement report without using an arbitrary player profile session?
- If a player session is required, is it safe to use a dedicated internal/service profileId and omit
profileIdfromsearchCriteriato retrieve app-wide transactions? - Is the
Unrecognized requesterror expected in this case, or should this be reported as a bug, permission issue, or app configuration issue?
Thanks.
-
Hmm - we'll look into it. Definitely looks like it isn't hooked up to the S2S proxy properly.
Thanks for reporting this.
-
Thanks Paul, that makes sense.
For now, we’ll keep using a dedicated internal/service profile with
getSessionForProfile()+callAPIForSession()as a temporary workaround for our monthly transaction reporting job.Could you please confirm whether this workaround is safe to use temporarily in production, as long as we do not include a
profileIdin the search criteria and only use the session to authorize the request?Also, we’d appreciate it if you could let us know once the S2S proxy hookup for
SYS_GET_TRANSACTIONS_PAGEhas been reviewed or fixed.Thanks again for checking into this.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login