I am trying to connect my app to app purchases using this: https://github.com/chirag04/react-native-in-app-utils
I have an epic where I want to fix success if it succeeds, and failure if it fails. Something like that:
import 'rxjs'; import { InAppUtils } from 'NativeModules'; import * as packagesActions from '../ducks/packages'; import * as subscriptionActions from '../ducks/subscription'; export default function createSubscription(action$, store) { return action$.ofType(packagesActions.SELECT) .mergeMap(action => { const productId = action.payload; InAppUtils.purchaseProduct(productId, (error, response) => { if(response && response.productIdentifier) { return subscriptionActions.subscribeSuccess(); } else { return subscriptionActions.subscribeFailure(); } }); }); };
However, I am not sure how to write the contents of mergeMap . Is there any way to do this?
source share