Giter Club home page Giter Club logo

react-native-cafe-bazaar's Introduction

InApp Billing for Cafe Bazaar (Android)

React Native Cafe Bazaar is built to provide an easy interface to InApp Billing for Cafe Bazaar,

⚠️ Notice: This library is not being actively updated. You might want to use the RN library of the cafebazaar itself.

Installation

  1. npm install --save react-native-cafe-bazaar or yarn add react-native-cafe-bazaar
  2. Add the following in android/settings.gradle
...
include ':react-native-cafe-bazaar', ':app'
project(':react-native-cafe-bazaar').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-cafe-bazaar/android/app')
  1. And the following in android/app/build.gradle
...
dependencies {
    ...
    implementation project(':react-native-cafe-bazaar')
}
  1. Update MainActivity or MainApplication depending on React Native version.
  • React Native version >= 0.29 Edit MainApplication.java.
    1. Add import com.contoriel.cafebazaar.CafeBazaarPackage; in the top of the file.
    2. Register package:
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        // add package here
        new CafeBazaarPackage()
      );
    }
  1. Add your CafeBazaar Public key as a line to your android/app/src/main/res/values/strings.xml with the name CAFE_BAZAAR_PUBLIC_KEY. For example:
<string name="CAFE_BAZAAR_PUBLIC_KEY">YOUR_CAFE_BAZAAR_PUBLIC_KEY_HERE</string>

Alternatively, you can add your license key as a parameter when registering the CafeBazaarPackage, like so:

.addPackage(new CafeBazaarPackage("YOUR_CAFE_BAZAAR_PUBLIC_KEY_HERE"))

or for React Native 29+

new CafeBazaarPackage("YOUR_CAFE_BAZAAR_PUBLIC_KEY_HERE")

Add the billing permission as follows to AndroidManifest.xml file:

<uses-permission android:name="com.farsitel.bazaar.permission.PAY_THROUGH_BAZAAR"></uses-permission>

ON THE BAZAAR DEVELOPER PANEL

  1. Upload the application to the Developer Panel.
  1. Using the Enter button in In-app Billing column of the created app, go to In-app Billing Panel.

  2. In that app, create your in-app items

  3. Grab the application's public key (a base-64 string) You can find the application's public key in the Dealer Apps page for your application.

Javascript API

Most of methods returns a Promise.

open()

Important: Opens the service channel to CafeBazaar. Must be called (once!) before any other billing methods can be called.

import CafeBazaar from 'react-native-cafe-bazaar'

...

CafeBazaar.open()
.then(() => CafeBazaar.purchase('YOUR_SKU','DEVELOPER_PAYLOAD',RC_REQUEST))
.catch(err => console.log('CafeBazaar err:', err))

close()

Important: Must be called to close the service channel to CafeBazaar, when you are done doing billing related work. Failure to close the service channel may degrade the performance of your app.

CafeBazaar.open()
.then(() => CafeBazaar.purchase('YOUR_SKU','DEVELOPER_PAYLOAD',RC_REQUEST))
.then((details) => {
  console.log(details)
  return CafeBazaar.close()
})
.catch(err => console.log('CafeBazaar err:', err))

purchase('YOUR_SKU','DEVELOPER_PAYLOAD',RC_REQUEST)

Parameter(s)
  • productSKU (required): String
  • developerPayload: String
  • rcRequest: Integer
Returns:
  • Details: JSONObject:
    • mDeveloperPayload:
    • mItemType:
    • mOrderId:
    • mOriginalJson:
    • mPackageName:
    • mPurchaseState:
    • mPurchaseTime:
    • mSignature:
    • mSku:
    • mToken:
CafeBazaar.purchase('YOUR_SKU','DEVELOPER_PAYLOAD',RC_REQUEST)
.then((details) => {
  console.log(details)
})
.catch(err => console.log('CafeBazaar err:', err))

consume('YOUR_SKU')

Parameter(s)
  • productSKU (required): String
Returns:
  • Details: JSONObject:
    • mDeveloperPayload:
    • mItemType:
    • mOrderId:
    • mOriginalJson:
    • mPackageName:
    • mPurchaseState:
    • mPurchaseTime:
    • mSignature:
    • mSku:
    • mToken:
CafeBazaar.consume('YOUR_SKU')
.then(...)
.catch(err => console.log('CafeBazaar err:', err))

loadOwnedItems()

Returns:
  • items: JSONArray:
CafeBazaar.loadOwnedItems()
.then((details) => {
  console.log(details)
})
.catch(err => console.log('CafeBazaar err:', err))

loadInventory([item1_SKU,item2_SKU,...])

Parameter(s)
  • productSKUs (required): Array
Returns:
  • mPurchaseMap: JSONObject
  • mSkuMap: JSONObject
CafeBazaar.loadInventory([])
.then(...)
.catch(err => console.log('CafeBazaar err:', err))

Use event listener

Below function dispatch Event instead of Promise and return value is same.

purchaseWithEvent('YOUR_SKU','DEVELOPER_PAYLOAD',RC_REQUEST)

consumeWithEvent('YOUR_SKU')

loadOwnedItemsWithEvent()

import {DeviceEventEmitter} from 'react-native';
...
  componentDidMount(){
    DeviceEventEmitter.addListener('CafeBazaar', function(e: Event) {
      // handle event.
      console.log(e);
    });
  }

BACK TO BAZAAR DEVELOPER PANEL

Upload the updated APK to Bazaar Developer Panel

react-native-cafe-bazaar's People

Contributors

alikazemkhanloo avatar arashmilani avatar seriiix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-native-cafe-bazaar's Issues

error while generating release apk

Debug works fine, but when generating release apk I faced this error

error: resource android:style/TextAppearance.Material.Widget.Button.Borderless.Colored not found.
error: resource android:style/TextAppearance.Material.Widget.Button.Colored not found.
C:\Users\Ali\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cc1406a2305fbe386bafce46a811510c\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\Ali\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cc1406a2305fbe386bafce46a811510c\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\Ali\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cc1406a2305fbe386bafce46a811510c\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

C:\Users\Ali\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cc1406a2305fbe386bafce46a811510c\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontStyle not found.

C:\Users\Ali\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cc1406a2305fbe386bafce46a811510c\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/font not found.

C:\Users\Ali\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cc1406a2305fbe386bafce46a811510c\res\values\values.xml:251:5-69: AAPT: error: resource android:attr/fontWeight not found.

error: failed linking references.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-cafe-bazaar:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

when I updated app/build.gradle file, as this stackoverflow user said, it did compiled.

android {
    compileSdkVersion 26         //was 23
    buildToolsVersion "26.0.1"   //was "23.0.1"
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 24        //was 22
        versionCode 1
        versionName "1.0"
    }

(I updated compileSdkVersion and buildToolsVersion to match my project, maybe it is not needed.)

I'm using

gradle 4.4
classpath 'com.android.tools.build:gradle:3.1.2'
[email protected]
if this can reproduce the problem and the solution works, please update this package.

Purchase response

... await CafeBazaar.open(); const details = await CafeBazaar.purchase(${productId},'"payload", 2); const callback = JSON.parse(details); ...
Please add to the document JSON.parse() requirement.

TypeError: null is not an object

Hi, Thanks for your great package
I followed your README structure
but in console.log(), I get this:
WARN Possible Unhandled Promise Rejection (id: 1): TypeError: null is not an object (evaluating '_reactNativeCafeBazaar.default.open')
I will be appreciated for your guidance.
[email protected]

Can't start async operation (refresh inventory)

we have seen this issue too in appCenter Analytics:

ava.lang.IllegalStateException: Can't start async operation (refresh inventory) because another async operation(refresh inventory) is in progress.

we use await for all of our inventory functions but we have been getting 55 exceptions since 4 days ago

const inventory = JSON.parse(await CafeBazaar.loadInventory(res.items.map(item => item.sku)));
console.log('Inventory: ', inventory);
const ownedItems = JSON.parse(await CafeBazaar.loadOwnedItems());
console.log('OwnedItems: ', ownedItems);

this is stack trace

com.contoriel.cafebazaar.util.IabHelper.flagStartAsync
IabHelper.java - line 819
java.lang.IllegalStateException: Can't start async operation (refresh inventory) because another async operation(refresh inventory) is in progress.
com.contoriel.cafebazaar.util.IabHelper.flagStartAsync IabHelper.java:819
com.contoriel.cafebazaar.util.IabHelper.queryInventoryAsync IabHelper.java:611
com.contoriel.cafebazaar.util.IabHelper.queryInventoryAsync IabHelper.java:639
com.contoriel.cafebazaar.CafeBazaar.loadOwnedItems CafeBazaar.java:144
java.lang.reflect.Method.invokeNative Method.java
java.lang.reflect.Method.invoke Method.java:511
com.facebook.react.bridge.JavaMethodWrapper.invoke JavaMethodWrapper.java:374
com.facebook.react.bridge.JavaModuleWrapper.invoke JavaModuleWrapper.java:162
com.facebook.react.bridge.queue.NativeRunnable.run NativeRunnable.java
android.os.Handler.handleCallback Handler.java:615
android.os.Handler.dispatchMessage Handler.java:92
com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage MessageQueueThreadHandler.java:31
android.os.Looper.loop Looper.java:153
com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run MessageQueueThreadImpl.java:194
java.lang.Thread.run Thread.java:856

JSON returned is different in debug vs release mode

while the implementation worked perfectly in debug mode, i notice my code crashes in release versions and realized the returning JSON structure is quite different in these modes. these screenshots may explain somehow.
example loadInventory data in debug:
getinventory
example loadInventory data in release:

getinventoryrelease
i'm using react-native v 0.57
any idea why this happens?
as you may see the json keys are replaced by 'a','b','c',....

Air native extension

Hi
Would you please develop an air native extension for in-app billing applications which are made by air 26+ .

ایراد در گرفتن اطلاعات محصول

با سلام
وقتی از متدهای نمونه استفاده میکنم با ایراد محصولی یافت نشد مواجه میشویم در صورتیکه محصول در کافه بازار فعال میباشد و از SKU محصول استفاده شده است.

ممنون میشم راهنمایی بفرمایید

how to consume a product after purchasing (but not immediately)

Hi,
I am using your module to use InApp Billing for Cafe Bazaar.
It works correctly if the purchased product consumes immediately. But if after purchasing could not consume the product immediately, the problem occurs.
The loadOwnedItems return an empty array. If I try to re-purchase that product, it response that you purchased it previously and if I try to consume the previously purchased product, its response is that "you need to purchase the product first".
any suggestions, please?

There no connection to cafe bazaar

Hi.
I implemented this package by documentations. but got this error:

There no connection to cafe bazaar

Do you have any idea why I've got this error?

Error: There is a problem in cafe bazaar setup

I do the installation correctly but I get this error "There is a problem in cafe bazaar setup" .
this is my code :
CafeBazaar.open() .then(() => console.log('test')) .catch(err => console.log('CafeBazaar err:', err))

Could not resolve dependencies

Cannot run it in react native 0.63. I faced this error.

Could not resolve all task dependencies for configuration ':react-native-cafe-bazaar:debugCompileClasspath'.
Could not find androidx.appcompat:appcompat:1.0.2.
Required by:
project :react-native-cafe-bazaar > com.facebook.react:react-native:0.63.3
Could not find androidx.versionedparcelable:versionedparcelable:1.0.0.
Required by:
project :react-native-cafe-bazaar > androidx.core:core:1.0.0

Can't change DEVELOPER_PAYLOAD

It seems I can't change DEVELOPER_PAYLOAD param when I send a request to Baazar. Anything I pass to DEVELOPER_PAYLOAD will not change the default value of it which is "DEVELOPER_PAYLOAD". This is the piece of code I'm using:

CafeBazaar.open()
  .then(() => CafeBazaar.purchase(sku, 'something_else', 16))
  .then(details => {
    console.log(details)
    return CafeBazaar.close()
  })
  .catch(err => {
    console.log('CafeBazaar err:', err)
  })

The result is always:

{"mDeveloperPayload":"DEVELOPER_PAYLOAD","mItemType":"inapp","mOrderId":"lwl0n4mnS_0ZbFD5","mOriginalJson":"{\"orderId\": \"lwl0n4mnS_0ZbFD5\", \"purchaseToken\": \"lwl0n4mnS_0ZbFD5\", \"developerPayload\": \"DEVELOPER_PAYLOAD\", \"packageName\": \"com.rndfd\", \"purchaseState\": 0, \"purchaseTime\": 1559387190075, \"productId\": \"test\"}","mPackageName":"com.rndfd","mSignature":"k6QKh7hCFnV8uvJJJSvbdmXg5z25acJNq/bhhGJ2DFD/YLTeUaOglZTyVuN94qt1pQFNkpDFDQ8CS26K1k268it+Yy6ROEfGf6k1vbcz0zMlQlV93P0IPx5mDS+z1+6Jbjv9va0biy+FMxJ3JYz5yIYzCcy3ZeUFv+2/PI3tA9XNMer/iuCsn2Y4cUQlzyR46f4UpxxTlnXqANDrS+fueKGT4AbUGmaY6GeLxYnD","mSku":"test","mToken":"lwl0n4mnS_0ZbFD5","mPurchaseTime":1559387190075,"mPurchaseState":0}

LIbrary Works in Debug Only and Throws an Error in Release Build

Salam,

Thanks for your library.

I am trying to use your library for my app and I have tested it in several scenarios in debug mode while developing and everything works fine.

The problem is when I try to build a release version of the app to deploy it to the store, the library does not work (It doesn't load the owned items, doesn't purchase or doesn't do anything else).

I first thought it was my Proguard rules. Then I added -keep class com.android.vending.billing to my Proguard rules (it is stated here) but the results were the same:(

This is my adblogcat:

04-13 05:53:27.209  4114  4187 I SurfaceFlinger: id=15625 Removed Dim Layer for - Task=24438#0 (0/68)
04-13 05:53:27.226  4114  4114 I Layer   : id=15625 onRemoved Dim Layer for - Task=24438#0
04-13 05:53:27.226  4114  4187 W SurfaceFlinger: Attempting to set client state on removed layer: Dim Layer for - Task=24438#0 [s.what : 10000]
04-13 05:53:27.226  4114  4187 W SurfaceFlinger: Attempting to destroy on removed layer: Dim Layer for - Task=24438#0
04-13 05:53:27.226  4114  4187 I SurfaceFlinger: id=15629 Removed Surface(name=Dim Layer for - Task=24438)/@0x769f8c4 - animation-leash#0 (1/67)
04-13 05:53:27.227  4556  4644 I WindowManager: reset, Reparenting to original parent, shouldDeferScheduleAnimation=false, destroyLeash=true, surface=Surface(name=AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}})/@0x1afc318, parent=Surface(name=Task=24438)/@0x310a7d2, parentNativeHandle=android.os.BinderProxy@bfacacf, caller=com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:97 com.android.server.wm.-$$Lambda$SurfaceAnimator$SIBia0mND666K8lMCPsoid8pUTI.run:4 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$1:104 com.android.server.wm.-$$Lambda$SurfaceAnimator$vdRZk66hQVbQCvVXEaQCT1kVmFc.onAnimationFinished:4 com.android.server.wm.LocalAnimationAdapter.lambda$startAnimation$0:65
04-13 05:53:27.227  4556  4644 D SurfaceControl: reparent is called, sc=Surface(name=AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}})/@0x1afc318, newParentHandle=android.os.BinderProxy@bfacacf, transaction=android.view.SurfaceControl$Transaction@9f16663
04-13 05:53:27.227  4556  4644 D SurfaceControl: destroy(transaction), animation-leash is destroyed, sc=Surface(name=Surface(name=AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}})/@0x1afc318 - animation-leash)/@0x2d021d, transaction=android.view.SurfaceControl$Transaction@9f16663, caller=com.android.server.wm.SurfaceAnimator.reset:338 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:97 com.android.server.wm.-$$Lambda$SurfaceAnimator$SIBia0mND666K8lMCPsoid8pUTI.run:4 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$1:104 com.android.server.wm.-$$Lambda$SurfaceAnimator$vdRZk66hQVbQCvVXEaQCT1kVmFc.onAnimationFinished:4 com.android.server.wm.LocalAnimationAdapter.lambda$startAnimation$0:65 com.android.server.wm.-$$Lambda$LocalAnimationAdapter$X--EomqUvw4qy89IeeTFTH7aCMo.run:4
04-13 05:53:27.228  4556  4644 V WindowManager: Setting visibility of Window{862213d u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity EXITING}: false, caller=com.android.server.wm.WindowContainer.sendAppVisibilityToClients:615 com.android.server.wm.AppWindowToken.setClientHidden:460 com.android.server.wm.AppWindowToken.onAnimationFinished:2390 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:100
04-13 05:53:27.228  4556  4644 E WindowManager: win=Window{862213d u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:870 com.android.server.wm.AppWindowToken.destroySurfaces:851 com.android.server.wm.WindowState.onExitAnimationDone:5430 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:2405 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2
04-13 05:53:27.228  4556  4644 I WindowManager: Destroying surface Surface(name=com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity[16361])/@0x9ffd02c called by com.android.server.wm.WindowStateAnimator.destroySurface:1880 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:838 com.android.server.wm.WindowState.destroySurfaceUnchecked:3840 com.android.server.wm.WindowState.destroySurface:3821 com.android.server.wm.AppWindowToken.destroySurfaces:870 com.android.server.wm.AppWindowToken.destroySurfaces:851 com.android.server.wm.WindowState.onExitAnimationDone:5430 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2
04-13 05:53:27.228  4114  4187 I SurfaceFlinger: id=15623 Removed com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity[16361]#1 (0/66)
04-13 05:53:27.228 16361 16361 W System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference
04-13 05:53:27.229 16361 16361 W System.err: 	at android.view.ViewRootImpl.getHostVisibility(ViewRootImpl.java:1809)
04-13 05:53:27.229 16361 16361 W System.err: 	at android.view.ViewRootImpl.handleAppVisibility(ViewRootImpl.java:1445)
04-13 05:53:27.229 16361 16361 W System.err: 	at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4829)
04-13 05:53:27.229 16361 16361 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:106)
04-13 05:53:27.229 16361 16361 W System.err: 	at android.os.Looper.loop(Looper.java:214)
04-13 05:53:27.229 16361 16361 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7099)
04-13 05:53:27.229 16361 16361 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
04-13 05:53:27.229 16361 16361 W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
04-13 05:53:27.229 16361 16361 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
04-13 05:53:27.232  4556 12881 D ConnectivityService: filterNetworkStateForUid() uid: 10185, pid: 16361
04-13 05:53:27.232  4556 12881 D ConnectivityService: isNetworkWithLinkPropertiesBlocked: uid=10185, vpn=DISCONNECTED,false
04-13 05:53:27.232  4114  5190 W SurfaceFlinger: Attempting to set client state on removed layer: com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity[16361]#1 [s.what : 40]
04-13 05:53:27.232  4114  5190 D Layer   : [AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}}#0]::reparent oldParent:[Surface(name=AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}})/@0x1afc318 - animation-leash#0], newParent:[Task=24438#0]
04-13 05:53:27.232  4114  5190 I SurfaceFlinger: id=15621 Removed 862213d com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity#0 (0/65)
04-13 05:53:27.232  4114  5190 I SurfaceFlinger: id=15628 Removed Surface(name=AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}})/@0x1afc318 - animation-leash#0 (0/64)
04-13 05:53:27.232  4556 12881 D ConnectivityService: filterNetworkStateForUid() uid: 10185, pid: 16361, networkInfo: [type: WIFI[], state: CONNECTED/CONNECTED, reason: (unspecified), extra: (none), failover: false, available: true, roaming: false]
04-13 05:53:27.232  4114  5190 W SurfaceFlinger: Attempting to destroy on removed layer: com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity[16361]#1
04-13 05:53:27.233  4556  4556 D FreeformController: Fail to invalid task id :  -1
04-13 05:53:27.233  4556  4644 I WindowManager: Cancelling animation restarting=false, leash=null, surface=Surface(name=AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}})/@0x1afc318, parent=Surface(name=Task=24438)/@0x310a7d2
04-13 05:53:27.236  4114  5190 I SurfaceFlinger: id=15619 Removed AppWindowToken{740b6d0 token=Token{d20b693 ActivityRecord{c339f82 u0 com.farsitel.bazaar/ir.cafebazaar.ui.pardakht.PaymentActivity t24438}}}#0 (1/63)

Edit README.md

Hi, looks like this repo is not actively maintained and is outdated for some devices. Yet there is another IAB module for Bazaar @cafebazaar/react-native-poolakey. Please edit README file for the sake of not wasting time. *5 hours wasted working on native code trying to make it work : )

Does not work on some Xiomi phones

According to cafe bazzar documents, you need to update IABHelper and AIDL files in order to work on all type of phones. please update them or let me know how to do it. thanks.

Error when call open

in the latest version of React Native: "0.61.5"
after and try to call "Open" an error happen.
"open is not a member of undefined" (it seems an unsupported modules because it's non gradle module)

java.lang.NullPointerException in queryPurchases

Hi, Thanks for your great package
Recently we have seen this error in our analytics

com.contoriel.cafebazaar.util.IabHelper.queryPurchases`
IabHelper.java - line 836
java.lang.NullPointerException

could you please check this ?

the full stack trace:

com.contoriel.cafebazaar.util.IabHelper.queryPurchases
IabHelper.java - line 842
java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Bundle com.android.vending.billing.IInAppBillingService.getPurchases(int, java.lang.String, java.lang.String, java.lang.String)' on a null object reference
com.contoriel.cafebazaar.util.IabHelper.queryPurchases IabHelper.java:842
com.contoriel.cafebazaar.util.IabHelper.queryInventory IabHelper.java:558
com.contoriel.cafebazaar.util.IabHelper.queryInventory IabHelper.java:522
com.contoriel.cafebazaar.util.IabHelper$2.run IabHelper.java:617
java.lang.Thread.run Thread.java:818

E_SETUP_DISCONNECT in case of reinstalling cafebazaar app

Hi !
We faced an issue that relates to reinstalling cafebazar app.
After installing our app from cafebazar the library works good in purchase but after uninstalling and installing cafebazar app, the purchase function returns E_SETUP_DISCONNECT .
The phone must be restarted to perform purchase correctly again.

When I use your library, this message app here "there is no product"

hi
I used your library to pay for the app
And I did all the settings that you said, But my app encountered an error
When I use this message" there is no product"
my code:

   CafeBazaar.open()
            .then(() => CafeBazaar.purchase('tansazReactNative', '', 1840))
            .then((details) => {
                alert(JSON.stringify(details));
                return CafeBazaar.close()
            })
            .catch((err) =>{
                if(err.code==="E_SETUP_DISCONNECT"){
                    alert("cafeBazaar Not install, please install it and so try again");
                }else{
                    alert(JSON.stringify(err))
                }
            } );

You can see for better
picture of mycode+result in my app

thanks

What to set RC_REQUEST to?

Hi ... Good job for this great package!
I just want to know the use of RC_REQUEST and how must we deal with that?
I reviewed official bazaar doc and this package native code but didn't find out anything.

app crashes on successful payment throwing Error: java.lang.Boolean cannot be cast to java.lang.String

Hi ! thank you for this good library.
when I click to purchase , cafe bazaar dialog will appear and if I cancel my payment , all thing is right But If I pay the price (or just write my password for free products) , app will crash with the following error:

07-24 18:38:41.783 25177 25691 W ReactNativeJS: Possible Unhandled Promise Rejection (id: 0): 07-24 18:38:41.783 25177 25691 W ReactNativeJS: Error: java.lang.Boolean cannot be cast to java.lang.String

I tests this on 3 device but error appears on all of them. can you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.