Skip to content

Commit

Permalink
filter: to only paid payments
Browse files Browse the repository at this point in the history
  • Loading branch information
anishshobithps committed May 7, 2024
1 parent e0e611e commit 464f8c5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/api/razorpay/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ export async function GET() {
}

try {
const paymentData = await razorpay.payments.all({
const paymentDatas = await razorpay.payments.all({
count: 100
});
const paymentData = {
entity: paymentDatas.entity,
count: paymentDatas.count,
items: paymentDatas.items.filter((paymentItem) => paymentItem.status === "captured"),
}
return NextResponse.json(paymentData, { status: 200 });
} catch (error) {
console.error("Error fetching payment data:", error);
Expand Down

0 comments on commit 464f8c5

Please sign in to comment.