Razorpay response not sending Razorpay order_id - react-native

I am working on React Native Razorpay payment gateway integration.
I am using react-native-razorpay.
Code is below:-
Send Params are:-
var options = {
description: "Credits towards consultation",
image: "https://i.imgur.com/3g7nmJC.png",
currency: "INR",
key: "a-----b----ccc-dd",
amount: Math.round(Number(order_total).toFixed(2) * 100),
name: "Product",
prefill: {
email: email ? email : "v#razorpay.com",
contact: mobile ? mobile : "1111111111",
name:
firstname && lastname
? `${firstname} ${lastname}`
: "Razorpay Software"
},
theme: { color: theme.colors.primaryColor },
payment_capture: 1
};
Checkout Method:-
RazorpayCheckout.open(options)
.then(data => {
// handle success
console.log("payment success", data);
if (data && data.razorpay_payment_id) {
orderData.payment = data.razorpay_payment_id;
this.props.payMyOrder(orderData);
}
})
.catch(error => {
// handle failure
this.toast.show(error.description);
});
I am getting only razorpay_payment_id in response but, razorpay_payment_id and razorpay_signature are missing. Also, in Razorpay backend Razorpay Order Id and Order Id are missing.

hey as we can see in the above code options object that you are passing to the checkout you are not passing the order_id, you should pass the order_id as well. Since you are not passing the order_id the same is not getting returned to you after the payment is done. refer to the below link on how to create an order at your server-side.
https://razorpay.com/docs/api/orders/
if you pass the order_id in the request param to the checkout you'll get the order_id and signature as well in the payment response.

Please check the documentation we need to pass the order_id, here.
As per the documentation, once you pass the order_id, then only after payment successful razorpay returns the
razorpay_order_id,razorpay_payment_id and razorpay_signature.
After that you can compare the signature to get acknowledgement of payment success.

Just a note if your id is wrong your razorpaySignature too will not appear

Issue mostly will be because of invalid order Id, the order id received from Backend should be the one backend got from Razorpay.
Something like below should be used at your backend to generate order id (format of order id will be order_<some id>). You can get language based backend implementation at this link
var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })
instance.orders.create({
amount: 50000,
currency: "INR",
receipt: "receipt#1",
notes: {
key1: "value3",
key2: "value2"
}
})

Related

Query Loopring NFTs using the GraphQL "Playground"

Hello and thanks in advance for any help.
I would like to write a simple query to find out Loopring NFT (non-fungible token) data using the Loopring subgraph, given a user account number. (Note the account number is the Loopring address, similar to an Ethereum address, a hexadecimal as string type)
The subgraph playground for Loopring is here: https://thegraph.com/explorer/subgraph?id=7QP7oCLbEAjejkp7wSLTD1zbRMSiDydAmALksBB5E6i1&view=Playground
Here is my code:
query accountNFTSlotsQuery(
$skip:Int
$first:Int
$orderBy: AccountNFTSlot_orderBy
$orderDirection:OrderDirection
$where:AccountNFTSlot_filter
) {
accountNFTSlots(
skip : 0
first: 100
orderBy: createdAt
orderDirection: asc
where: {
account: "0x08F06d44D6D3e35a3790392571194d86090C863539277"
}
) {
id
account {
id
}
balance
nft {
id
nftType
nftID
mintedAt
}
}
}
The playground is returning...
{
"data": {
"accountNFTSlots": []
}
}
Which I interpret as returning NULL, or "no data found". For the address above, one can verify NFTs exist using lexplorer:
https://lexplorer.io/account/39277
Variations:
I have tried several accounts which I know have NFTs.
I have tried replacing the "account" string with an "id" in the 'where' filter thus:
where: {
id: 39277
}
Model:
I used this github repo as a model for my queries: https://github.com/fudgebucket27/Lexplorer/blob/master/Shared/Services/LoopringGraphQLService.cs

How to create a refund on ShopifyAPI

I'm trying to create a refund using Shopify API with the details in the documentation here:
and this is the payload I'm sending:
{ currency: 'GBP',
notify: false,
refund_line_items:
[ { line_item_id: '<line-item-id>',
quantity: 1,
restock_type: 'no_restock' } ] }
But I get this error:
StatusCodeError: 422 - {"errors":{"refund_line_items.line_item":["can't be blank"]}}
But refund_line_items.line_item is not mentioned in the documentation. I have checked the and the line_item_id is correct (is the ID of the variation ID, not the product ID, but I have tried using SKU and product ID, same result)
Other response in SO infers that this is because the line_item_id is incorrect but that's not the case. Any suggestions would be much appreciated. Thanks!

pubnub get history from multiple channels

I am using pubnub for chat , and using userid as channel to send messages , however when i want to retrieve conversation between two users , i need to get data from both channels, how can i do that?
I have data on both channels e.g. "userAid" and "userBid" but if i query
this.pubnub.history(
{ channel: ['userAid,'userBid'], reverse: true, count: 15 },
(status, res) => {
});```
it does not return any result , if i query with only one channel it works
The History SDK call is generally meant to fetch history from a single channel. If you need to fetch history from multiple channels, you need to use Batch History methods.
Refer to https://www.pubnub.com/docs/react-native-javascript/api-reference-storage-and-playback#batch-history for more details.
An example call might be as follows, but the link above provides a list of all the parameters that can be set. Please note that the fetchMessages method can be used to fetch history from a single channel as well.
pubnub.fetchMessages(
{
channels: ['ch1', 'ch2', 'ch3'],
start: "15343325214676133",
end: "15343325004275466",
count: 25
},
(status, response) => {
// handle response
}
);
It seems history can only get messages from one channel.
Try this:
pubnub.fetchMessages({
channels: ['ch1', 'ch2', 'ch3'],
start: '15343325214676133',
end: '15343325004275466',
count: 15,
}, (status, response) => {
// handle status, response
});
Pubnub docs on getting the history:
https://www.pubnub.com/developers/chat-resource-center/docs/reference/message-history

bigcommerce single page checkout not working in checkout sdk

hello every one i am new in big commerce.
Now i am updating single page checkout using checkout sdk. every thing work fine till now i am following git hub implementing instructions . But the the problem is after update customer shipping address need to select the shipping option for shipping. I am using this syntax for doing this
const saddress = {
address1: $('#shippingaddress').val(),
address2: "",
city: $('#shippingcity').val(),
company: "",
country: $('#shippingcountry').val(),
countryCode: "AU",
customFields: [],
email: $('#email').val(),
firstName: $('#shippingfname').val(),
lastName:$('#shippinglname').val(),
phone: $('#shippingphone').val(),
postalCode: $('#shippingzip').val(),
stateOrProvince: $('#shippingProvince').val(),
stateOrProvinceCode: $('#shippingProvince').val(),
};
const updateaddress = await
service.updateShippingAddress(saddress);
After complete this action the function return all shipping address details along with the ID column and shipping options available in this address. but the problem is that function return the options and also the shipping address details but no ID column found in that list. that's why i am sending the billing address ID for select shipping option this is my code
const newState = await service.selectShippingOption(billing_ID, Shippingoption_ID);
after that i am going to direct payment options my code is
const payment = await service.loadPaymentMethods();
let paymentmethod=payment.data.getPaymentMethods();
in this function i am getting all the payment options details then i go for payment my code is
wait service.initializePayment({ methodId: 'testgateway' });
const payment = {
methodId: 'testgateway',
paymentData: {
ccExpiry: { month: 10, year: 20 },
ccName: 'BigCommerce',
ccNumber: '4111111111111111',
ccType: 'visa',
ccCvv: 123,
},
};
After complete this function this function return a error
Error: "Your order is missing a shipping method. Please return to the
shopping cart and checkout again."

How to use query parameter as col name on sequelize query

So, I have an Express server running Sequelize ORM. Client will answer some questions with radio button options, and the answers is passed as query parameters to the URL, so I can make a GET request to server.
The thing is: my req.query values are supposed to be the column names for my database table. I want to know if it's possible to get the response from the database using Sequelize, and passing the parameters as the column name of the table.
async indexAbrigo(req, res) {
try {
let abrigos = null
let type = req.query.type // type = 'periodoTEMPORARIO'
let reason = req.query.reason // reason = 'motivoRUA'
abrigos = await Abrigos.findAll({
attributes: ['idABRIGOS'],
where: {
//I want type and reason to be the parameters that I got from client
type: 'S',
reason: 'S'
}
})
}
res.send(abrigos)
}
This is not working, the result of the query is something like
(SELECT `idABRIGOS` FROM Abrigos WHERE `type` = `S` AND `reason` = `S`)
Instead, I need that type and reason get translated to their values, and these values will be passed to the SQL. Is it possible to do with Sequelize? Or is it even possible with any ORM for Node/Express?
Thanks.
Yes, you can do it with computed property names. It would look like this:
where: {
[type]: 'S',
[reason]: 'S'
}
Your node.js version must be compatible with ES6.
Thank you - I am passing parameters right from req.body and this worked perfectly for me so I am posting it in the event that it may save someone time.
app.post('/doFind', (req, res) => {
Abrigos.findAll(
{[req.body.field]: req.body.newVal},
{returning: true, where: {id: req.body.id}}
)
.then( () => {
res.status(200).end()
})
.catch(err => {
console.log("Err: " + err)
res.status(404).send('Error attempting to update database').end()
})
})