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

Issues when view is cancelled or payment submitted #20

Open
folivi opened this issue Jun 2, 2016 · 1 comment
Open

Issues when view is cancelled or payment submitted #20

folivi opened this issue Jun 2, 2016 · 1 comment

Comments

@folivi
Copy link

folivi commented Jun 2, 2016

Hi,
I came to a couple of issues using this package:

  1. Error message: "Paypal app switch is missing a returnURLScheme"
    this message appears when I click on the Paypal Checkout button.
  2. Possible unhandled Promise Rejection (id: 3)
    this message appears when I tap the 'Pay' button or 'Cancel' to dismiss the payment view.

What I'm I doing wrong here?

Please find my implementation below.
I'm using ReactNative 0.25.1

import React, {Component} from 'react';
import {
  Text,
  View,
  Image,
  ScrollView,
  Animated,
  TouchableOpacity,
  TouchableHighlight,
  StyleSheet
} from 'react-native';

const BTClient = require('react-native-braintree');

export default class EventDetail extends Component {
  constructor(props) {
    super(props);
    this.state = { fadeAnim: new Animated.Value(0), // init opacity 0
    };
    this.showBTView = this.showBTView.bind(this);
  }

  componentDidMount(){
      Animated.timing(  // Uses easing functions
        this.state.fadeAnim,  // The value to drive
        {toValue: 1}  // Configuration
    ).start();
  }
  showBTView(){
      fetch('http://localhost:3000/get_token', {method: "GET"})
      .then((response) => response.json())
      .then((responseData) => {
        const clientToken = responseData.clientToken;
        BTClient.setup(clientToken);

        BTClient.showPaymentViewController(function(err, nonce) {
          //callback after the user completes (or cancels) the flow.
          //with the nonce, you can now pass it to your server to create a charge against the user's payment method
          fetch('http://localhost:3000/pay', {
            method: "POST",
            headers: {
              'Content-Type': 'application/json'
            },
            body: JSON.stringify({payment_method_nonce: nonce})
          }).done();
        });

      }).done();

  }
  render() {
    return (
      <ScrollView>
          <TouchableHighlight onPress= {this.showBTView}>
              <View style={{height: 30, flex: 1, backgroundColor: 'red', justifyContent: 'center'}}>
                  <Text style={{textAlign: 'center',}}>Buy this</Text>
              </View>
          </TouchableHighlight>


      </ScrollView>
    );
  }

}

When I hit the button which triggers the payment View,

this is what shows in xcode:

2016-06-03 08:26:25.883 AppTemplate[62808:28893357] -canOpenURL: failed for URL: "com.paypal.ppclient.touch.v1://" - error: "This app is not allowed to query for scheme com.paypal.ppclient.touch.v1"
2016-06-03 08:26:25.884 AppTemplate[62808:28893357] -canOpenURL: failed for URL: "com.paypal.ppclient.touch.v2://" - error: "This app is not allowed to query for scheme com.paypal.ppclient.touch.v2"
2016-06-03 08:26:25.884 AppTemplate[62808:28893357] -canOpenURL: failed for URL: "com.venmo.touch.v2://x-callback-url/vzero/auth" - error: "This app is not allowed to query for scheme com.venmo.touch.v2"

Thanks for your help

@AdamBrodzinski
Copy link

@alanhhwong @folivi did you figure out how to work around this?

I'm hitting this now and it kind of looks like perhaps the one touch setup is required as it's enabled by default on the braintree lib. I don't really want one-touch support as it would increase complexity on my end.

Any info would be great!

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