j3k0 / cordova-non-renewing-subscription

Simple API for Non-Renewing Subscriptions based on Fovea's Cordova Purchase Plugin
MIT License
19 stars 6 forks source link

How to get the status? #17

Closed hugo4le closed 7 years ago

hugo4le commented 7 years ago

I followed the instructions and made some calls as below but i could not get the content of "status" to continue the work (I may have missed something). Can you show me how to get the status? Thanks

                nonRenewing.onStatusChange(function(status) {
                    if (status) {
                        document.getElementsByClassName('status').innerHTML =
                            'isSubscribed: ' + status.subscriber + '\n' +
                            'expiryDate: ' + status.expiryDate + '\n';
                    } else {
                        document.getElementsByClassName('status').innerHTML =
                            'Status is Unknown';
                    }
                });

OR: nonRenewing.getStatus(function(error, status) { if (error) { alert("Failed to load subscription status: " + error + " Please try again."); return; } document.getElementsByClassName('status').innerHTML = 'isSubscribed: ' + status.subscriber + '\n' + 'expiryDate: ' + status.expiryDate + '\n'; });

hugo4le commented 7 years ago

newbie..that's why i had basis question