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)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.