Hi there!
I have a problem with Soomla and purchasing goodies.
I have created a test user Sandbox in itunesConnect and confirmed its creation via email
I logout from iTunes Store on my Ipad
When I try to purchase goodies, I have a prompt for entering credentials .I set the credentials of the sandbox test user
And I have an error : Here is the log message in Xcode
<b>SOOMLA SoomlaStore: An error occured for product id “goodie3months” with code “0” and description “Error Domain=SKErrorDomain Code=0 “Connexion à l’iTunes Store impossible” UserInfo={NSLocalizedDescription=Connexion à l’iTunes Store impossible}”</b>
I have created my goodies in iTunesConnect with productId:
-goodie1year
-goodie3months
and they are approved
I also try to build with dev provisioning profile
Here is the code:
Store {
id: nutriStore
version: 1
secret: "ac88b77f81ce44fea0b721190ad89368" // replace with your Soomla secret
goods: [
SingleUseGood {
id: goodie3monthsGood
itemId: "goodie3months" // replace with id of your store product
name: "Abonnement 3 mois"
description: "Abonnement 3 mois"
purchaseType: StorePurchase { id: goodie3monthsPurchase; productId: goodie3monthsGood.itemId; }
},
SingleUseGood {
id: goodie1yearGood
itemId: "goodie1year" // replace with id of your store product
name: "Abonnement 1 an"
description: "Abonn 1 an"
purchaseType: StorePurchase { id: goodie1yearPurchase; productId: goodie1yearGood.itemId; }
}
]
onStorePurchaseStarted: {
}
onUnexpectedError: {
hideLoading()
print("NutriStore : Unexpected error")
nativeUtils.displayMessageBox("NutriStore : Erreur inattendue. Veuillez réesayer dans quelques instants")
}
onItemNotFoundError: {
hideLoading()
print("NutriStore : item not found")
nativeUtils.displayMessageBox("NutriStore : Item not found."+itemId+" Veuillez réesayer dans quelques instants")
}
onItemPurchased: {
hideLoading()
console.log("NutriStore : L'achat a bien été effectué:", itemId)
if(itemId === 'goodie3months'){
onSubscribtionPurchased('goodie3months')
}else if (itemId === 'goodie1year'){
onSubscribtionPurchased('goodie1year')
}
}
onRestoreAllTransactionsStarted: {
isRestoringAfterLogin = true
showLoading('Vérification de l\'abonnement')
print('nutriStore.restoreAllTransactions()')
}
//N'est appelé que lorsque le user est déja loggé loginDBSucceded. Donc si pas d'abonnement, on envoie sur la page abonnement
onRestoreAllTransactionsFinished: {
isRestoringAfterLogin = false
console.log("Purchases restored with success:", success)
if(success){
//Abonnement OK
mainNav.currentIndex = 2
var msg = ''
if(subscribtion3monthsGood.purchased ){
msg = msg + 'subscribtion3months'
onSubscribtionOk('subscribtion3months')
}else if(subscribtion1year.purchased){
msg = msg + 'subscribtion1year'
onSubscribtionOk('subscribtion1year')
}
//Pas d'abonnement -> Go vers la page d'abonnement
else{
onSubscribtionNone()
}
nativeUtils.displayMessageBox("NutriStore : Abonnement vérifié -> ",msg)
}else{
hideLoading()
mainNav.currentIndex = 3
NativeDialog.confirm("Erreur", "Impossible de vérifier si l'utilsateur est abonné", null, false)
}
}
//Annulation du paiement
onStorePurchaseCanceled: {
hideLoading()
NativeDialog.confirm("Annulation", "Vous ne pouvez pas utiliser Nutrissim sans être abonné", null, false)
}
}
And I Call the buyItem() function:
if(subscribtionTypeId === 'goodie1year'){
nutriStore.buyItem(goodie1yearPurchase.productId)
}else if(subscribtionTypeId === 'goodie3months'){
nutriStore.buyItem(goodie3monthsPurchase.productId)
}