razorpay / razorpay/razorpay-node
[Feature Request] API to fetch all customers at once
Open
@ankitdas13 is already working on this.
Since Dec 5, 2022.
enhancement
- Dominant language
- JavaScript
- Stars
- 243
- Forks
- 128
- PR merge metrics
- No merged PRs in 30d
Description
I didn't find any API which can fetch customer's data at once so please add the feature.
The existing feature of getting all customers limit the customer's data to 100 max. So in order to get the data we need to use a loop and use skip.
To bypass this here is a temporary solution to get all customer's data at once
Function:-
async function getCustomers(){
let customerData = [];
let skip = 0;
while(true){
const response = await razorpay.customers.all({count: 100, skip: skip})
count = response.count;
for(let item in response.items){
customerData.push(response.items[item]);
};
if(count < 100){ break; } else{ skip +=100 }
}
return customerData
}
Usage:-
getCustomers().then((data)=>{
// Total Customer Count
console.log(data.length);
// Total Customer Data in an Array
// console.log(data)
})
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.