i m 在我React.js与背后 no的 no子里安装了支薪门。
www.un.org/Depts/DGACM/index_french.htm
razorpayHandler = () =>{
const payment_amount = this.props.TotalPrice;
const backend_url = https://25234399bb.ngrok.io ;
const self = this;
const options = {
key: config.RAZOR_PAY_KEY,
amount: payment_amount * 100,
name: StanPlus ,
description: pay your ambulance fare ,
handler(response) {
const paymentId = response.razorpay_payment_id;
const url = backend_url+ /razorpay/ +paymentId+ / +payment_amount+ / +self.id;
console.log(paymentId)
// Using my server endpoints to capture the payment
fetch(url, {
method: get ,
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
}
})
.then(resp => resp.json())
.then(function (data) {
console.log(data)
})
.catch(function (error) {
console.log( Request failed , error);
});
},
theme: {
color: #40A9FF ,
},
};
const rzp1 = new window.Razorpay(options);
rzp1.open();
}
backend.js(nodejs)
var express = require( express );
var router = express.Router();
var config = require( ../config );
const Razorpay = require( razorpay );
const instance = new Razorpay({
key_id: config.razorpay_live_key,
key_secret: config.razorpay_live_secret,
});
router.get( /:payment_id/:amount/:BID ,function(req,res,next){
const {payment_id } = req.params;
const {BID} = req.params;
const amount = Number(req.params.amount*100);
instance.payments.capture(payment_id, amount).then((data) => {
data.Bid = BID;
res.json(data);
}).catch((error) => {
res.json(error);
});
})
module.exports = router;
这表明我有错误。
“statusCode”:400,“error”:{“code”:“BAD_REquestST_ERROR”,“description”:“所提供的援助不存在”
but if the same code if do process using test key its getting successfully completed but it is not working with live api.
here i m passing an extra parameter to the backend which required for us but if removed that parameter then also it is not working.but with parameter it is working with test api.
when we send request to backend it is generating id and sending to backend also but still it showing The id provided does not exist.