chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
890 stars 185 forks source link

How long to wait for testing? #176

Open felixmagnell opened 6 years ago

felixmagnell commented 6 years ago

Hello, i've tried this package before with a apple account with everything set up. (There where previously apps on the app store on this account.) Now i'm trying to test this with a new apple developer account with the same code, but i get no response. Could it be something i haven't set up with this new account or haven't i waited enough?

With the old account i get the apple login prompt when i press the button. With the new account nothing happens. Here is the code i've got working before:

import React, { Component } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  Alert
} from 'react-native';
import { NativeModules } from 'react-native';
const { InAppUtils } = NativeModules;
var productID ='com.xxx.yyy.10_credit';

type Props = {};
export default class App extends Component<Props> {
  componentDidMount(){
       var products = [
         productID,
       ];
       InAppUtils.loadProducts(products, (error, products) => {
   //update store here.
   //console.log(productID);
   //console.log("ret" + products);
   //console.log(products[0]);
});
     }
     onPressPurchase(){
       InAppUtils.purchaseProduct(productID, (error, response) => {
          // NOTE for v3.0: User can cancel the payment which will be available as error object here.
          console.log(productID);
          if(response && response.productIdentifier) {
             //Alert.alert('Purchase Successful', 'Your Transaction ID is ' + response.transactionIdentifier);
             //unlock store here.
          }
       });
   }

  render() {
    return (
      <View style={styles.container}>
          <Text style={styles.welcome}>
            Test inapputil on dev
          </Text>

          <TouchableOpacity style={styles.button} onPress ={this.onPressPurchase}
          >
          <Text>buy thing</Text>
          </TouchableOpacity>

        </View>
    );
  }
}