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/RUN without a player session
Our 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 explicitly
We 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_PAGE expected 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
profileId from searchCriteria to retrieve app-wide transactions?
- Is the
Unrecognized request error expected in this case, or should this be reported as a bug, permission issue, or app configuration issue?
Thanks.