here is my code samples.i add plugin cordova-plugin-purchase and after initialize and then register products.
put before order i am trying to get product but cant do that
import 'cordova-plugin-purchase';
@Component({
selector: 'app-questions',
templateUrl: './napp2.page.html' ,
providers: [{provide: CdvPurchase.Store}]
})
CdvPurchase.store.initialize([CdvPurchase.Platform.GOOGLE_PLAY]);
CdvPurchase.store.verbosity = 4;
CdvPurchase.store.register([{
id: 'urun1',
type: CdvPurchase.ProductType.CONSUMABLE,
platform: CdvPurchase.Platform.GOOGLE_PLAY,
}]);
CdvPurchase.store.when().productUpdated(this.onProductUpdated);
onProductUpdated() {
const product = CdvPurchase.store.get('urun1', CdvPurchase.Platform.GOOGLE_PLAY);
console.log("PRODUCT: ", product)
}
CdvPurchase.store.when().approved((product) => {
console.log('Purchase approved', product);
});
CdvPurchase.store.when().finished((product) => {
console.log('Purchase now owned', product);
});
CdvPurchase.store.when().unverified((product) => {
console.log(' unverified', product);
});
CdvPurchase.store.when().verified((product) => {
console.log(' verified', product);
});
checkout(r){
const product = CdvPurchase.store.get('urun1', CdvPurchase.Platform.GOOGLE_PLAY);
// product is !!!!!!! EMPTY!!!!!!!! so not working next codes...
const sub = product.getOffer();
CdvPurchase.store
.order(sub)
.then(() => {
console.log('order placed', CdvPurchase.store.get("urun1"));
})
.catch((error: Error) => {
console.log('error purchased failed', error);
});
}
CdvPurchase.Platform change to TEST not working
add billing key not workıng
upgrade ionic 6 not workıng, back to down version now ionic 5 cordova 12.0.1
providers: [{provide: CdvPurchase.Store}]. move to app.model.ts not workıng