Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get error in getting result of purchaseDetail method. #1

Closed
arefhosseini opened this issue Jul 21, 2019 · 1 comment
Closed

Get error in getting result of purchaseDetail method. #1

arefhosseini opened this issue Jul 21, 2019 · 1 comment

Comments

@arefhosseini
Copy link

for checking purchase of user I use purchaseDetail(...) as code below:

MainMethod:

Future<Map<String, dynamic>> result = BazaarUtils.purchaseDetail("sample2");
      result
          .then((result) {
            if (result == null) {
              print("Purchase is null");
            }
            else {
              print("Already Purched");
            }
          })
          .catchError((error) => print('Detail error: $error'))
          .whenComplete(() {
            widget.onPushLoadingWidget(false);
          });

BazaarUtils.purchaseDetail:

static Future<Map<String, dynamic>> purchaseDetail(String sku) async {
    Map<String, dynamic> result = await CafebazaarFlutter.getPurchase(sku: sku);
    return result;
}

But in logs I got these error:

Detail error: NoSuchMethodError: The getter 'length' was called on null.
    Receiver: null
    Tried calling: length

I already use initPay(...) for initializing payment.
How can I check that user purchased some product?
Thanks.

@ghost
Copy link

ghost commented Jul 24, 2019

hello
this method fixed in next version soon

you can use this

Map<String,dynamic> result = CafebazaarFlutter.getPurchase(sku:"your product sku")

the result

{ "isSuccess": "true", "response":"0", "message":"Success (response: 0:OK)", "purchase":{ "orderId":"12999763169054705758.1371079406387615", "packageName":"com.example.app", "productId":"exampleSku", "purchaseTime":1345678900000, "purchaseState":0, "developerPayload":"bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ", "purchaseToken":"rojeslcdyyiapnqcynkjyyjh" } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants