I have a Facebook Instant Game developed with Cocos Creator 3.8.0. In-app purchases work correctly on all platforms except the native Android Facebook app.
The payments API is available, as confirmed by this code:
const apis = FBInstant.getSupportedAPIs();
const hasIaps = apis.includes('payments.purchaseAsync');
console.log(hasIaps); // returns TRUE
When I try to initialize payments and get the catalog, I get the following results:
FBInstant.payments.onReady(() => {
console.log('Payments Ready!'); // This message is logged
FBInstant.payments.getCatalogAsync()
.then(function (catalog) {
console.log("Catalog received:");
console.log(JSON.stringify(catalog, null, 2));
console.log("Catalog length:", catalog.length);
})
.catch(function (error) {
console.error('Cannot get Catalog'); // This error is logged
console.error('Error message:', error.message); // Error: "payments have not been successfully initialized yet"
});
});
The ‘Payments Ready!’ message is logged, indicating that onReady() is called successfully. However, when trying to get the catalog, I receive an error stating “payments have not been successfully initialized yet”.
This issue only occurs in the native Android Facebook app. The same code works fine in web browsers. I’ve already checked all the usual troubleshooting steps mentioned in the Facebook documentation.
Any ideas on what might be causing this or how to resolve it? Thanks!