javascript - 无效:回调 URL 的语法不正确。示例回调 URL 在 paytm 集成 React native 中为“https://merchant.com/calback/”
问题描述
我正在尝试在 React Native 中实现 Paytm 集成。但我收到此错误 =“无效:回调 URL 的语法不正确。示例回调 URL 为“https://merchant.com/calback/”。请告诉我我的代码有什么问题
这是我的代码
call_api = () => {
fetch("https://XXXXXXXXXXXXXXX", {
method: "POST",
headers: {
Accept: "application/json, text/plain, */*",
"Content-Type": "application/json",
},
body: JSON.stringify([
{
mobile_no: "XXXXXx",
user_id: "XX",
patient_name: "XXXx",
},
]),
})
.then((returnValue) => returnValue.json())
.then((response) => {
console.log("this checksum api esponse" + JSON.stringify(response));
this.setState({ order_id: response[0].data.order_id });
this.setState({ checksum: response[0].data.checksumhash });
this.pay();
});
};
pay = () => {
const details = {
// mode: "Staging", // 'Staging' or 'Production'
mode: "Production",
MID: "XXXXXXXXXXXXXXX",
INDUSTRY_TYPE_ID: "Retail",
WEBSITE: "APPSTAGING",
CHANNEL_ID: "WAP",
TXN_AMOUNT: "1", // String
ORDER_ID: this.state.order_id, // String
// EMAIL: email, // String
// MOBILE_NO: mobile, // String
CUST_ID: "CUSTOMER_1", // String
CHECKSUMHASH: `${this.state.checksum}`, //From your server using PayTM Checksum Utility
// CALLBACK_URL:
// "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=" +
// `${this.state.order_id}`,
CALLBACK_URL: `https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=<${this.state.order_id}>`,
};
Paytm.startPayment(details);
console.log(details);
};
解决方案
在 callbackUrl 参数中,您需要将您的网站 URL 传递到您想要获取响应的位置。如果您没有自己的回调 URL,您可以使用 Paytm 的静态回调 URL,在 Developer Portal 上的 react native 文档中提到。它应该与您发送的const 详细信息相同
推荐阅读
- google-cloud-platform - 在 Google Cloud Platform 中使用服务帐号进行身份验证
- c# - 如何解决“CREATEMULTIDEXMAINDEXCLASSLIST:错误:期望类路径分隔符';'......”
- r - 返回不存在的值而不引入整数 (0)
- gradle - 运行 kaptDebugKotlin 时出现 NullPointerException
- java - Hibernate - 具有 oneToMany 关系的级联实体
- kubernetes - NFS 卷挂载在 IP 不正确的 Kubernetes 上超时?
- regex - 在 Oracle REGEXP_SUBSTR 中验证子表达式
- php - 如何在站点 [htaccess] 上为我的所有用户显示子域中所有子目录的内容?
- authentication - OAuth2 服务器到服务器到期令牌
- php - 如何让用户 id 登录并与他正在做的帖子一起注册?