PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, November 11, 2022

[FIXED] How to deploy the payment gateway into real environment?

 November 11, 2022     payment-gateway, paypal, react-native     No comments   

Issue

I have integrated payment gateway in my react-native app by using "react-native-paypal-wrapper". How to test and deploy it in real environment? Right now, when I enter any wrong email and password, then it passes. I think my code is for test.

That is my code. How to make it work in real environment?

_onPay = () => {
  const options = {
    merchantName: "sss",
    merchantPrivacyPolicyUri: "https://example.com/privacy",
    merchantUserAgreementUri: "https://example.com/useragreement",
  }
  PayPal.initialize(PayPal.NO_NETWORK, PAY_PAL_CLIENT_ID);
  // PayPal.obtainConsent().then(authorization => console.log('authorization', authorization))
  //   .catch(error => console.log('error', error));
  // const metadataID = await PayPal.getClientMetadataId();
  PayPal.pay({
    price: '19.99',
    currency: "USD",
    description: "19.99 USD will be paid",
  })
    .then((confirm) => {
      console.log('confirm', confirm);
      this.setState({ isPaid: true })
      Alert.alert("Congratulation!", " 19.99 USD was paid.");
      // this.paymentHandler(confirm.response, subscription_id, days, userID);
    })
    .catch((error) => {
      if (error.message !== "User cancelled") {
        Alert.alert(error.message);
      }
      console.log(JSON.stringify(error));
    });
}

Solution

Have you read the documentation of the 2-year-old package you are using?

// 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
PayPal.initialize(PayPal.NO_NETWORK, "<your-client-id>");

In addition to specifying PRODUCTION there, the place to obtain a production client ID is from the 'Live' tab of an application in https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplications



Answered By - Preston PHX
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing