如何将支付网关部署到真实环境中?
How to deploy the payment gateway into real environment?
我使用“react-native-paypal-wrapper”在我的 react-native 应用程序中集成了支付网关。
如何在真实环境中进行测试和部署?现在,当我输入任何错误的电子邮件和密码时,它就会通过。我认为我的代码是为了测试。
这是我的代码。如何让它在真实环境中工作?
_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));
});
}
您是否阅读了您正在使用的 2-year-old 软件包的 the documentation?
// 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
PayPal.initialize(PayPal.NO_NETWORK, "<your-client-id>");
除了在此处指定 PRODUCTION 之外,获取生产客户端 ID 的地方是 https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplications
中应用程序的 'Live' 选项卡
我使用“react-native-paypal-wrapper”在我的 react-native 应用程序中集成了支付网关。 如何在真实环境中进行测试和部署?现在,当我输入任何错误的电子邮件和密码时,它就会通过。我认为我的代码是为了测试。
这是我的代码。如何让它在真实环境中工作?
_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));
});
}
您是否阅读了您正在使用的 2-year-old 软件包的 the documentation?
// 3 env available: NO_NETWORK, SANDBOX, PRODUCTION
PayPal.initialize(PayPal.NO_NETWORK, "<your-client-id>");
除了在此处指定 PRODUCTION 之外,获取生产客户端 ID 的地方是 https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fapplications
中应用程序的 'Live' 选项卡