How to use the react-native-payments.PaymentRequest function in react-native-payments

To help you get started, we’ve selected a few react-native-payments examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brandingbrand / flagship / packages / fsshopify / src / components / GooglePayShippingOptionsModal.tsx View on Github external
private continue = async () => {
    const {
      datasource,
      checkoutId,
      ShopifySupportedMethods,
      orderDetails,
      test,
      payment,
      onSuccess
    } = this.props;

    // clone orderDetails to mutate it
    const details = JSON.parse(JSON.stringify(orderDetails));
    details.total.amount.value = this.state.total;

    const secondReq = new PaymentRequest(ShopifySupportedMethods, details, {
      requestPayerName: true
    });
    const secondPaymentResponse = await secondReq.show();
    if (secondPaymentResponse) {
      // Fetch PaymentToken
      if (!secondPaymentResponse.details.getPaymentToken) {
        throw new ShopifyAPIError('getPaymentToken does not exist on android order?');
      }

      const pToken = await secondPaymentResponse.details.getPaymentToken();

      const submitResponse = await datasource.api
        .checkoutCompleteWithTokenizedPayment(checkoutId, {
          test,
          type: 'android_pay',
          amount: this.state.total.amount.value,

react-native-payments

Welcome to the best and most comprehensive library for integrating payments like Apple Pay and Google Pay into your React Native app.

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular react-native-payments functions