Skip to content
Open .md
On this page

List

List invoice refunds with cursor pagination and filter by invoice ID, status, or creation time window.

GET/v1/refunds

API key: Payment

Returns invoice refunds belonging to projects in the authenticated Payment key's scope, ordered by created_at DESC, then withdrawal_id DESC. Regular merchant withdrawals created via POST /v1/withdrawals are never included in this list.

Query parameters

Parameter Type Default Description
limit integer 20 Page size from 1 to 100
cursor string — Opaque next_cursor from the previous response
invoice_id string — Filter by prefixed invoice identifier (inv_...)
status string — Exact snake_case status (created, signed, pending_review, cancelling, completed, failed, cancelled). Repeat the parameter to match multiple statuses
created_from RFC 3339 — Inclusive lower bound on created_at with timezone offset (e.g. 2026-08-23T00:00:00Z)
created_to RFC 3339 — Exclusive upper bound on created_at with timezone offset. Must be later than created_from

Unknown query parameters, duplicate statuses, and invalid timestamps are rejected with 400.

Code examples

Each tab uses the official SDK for that language with a Payment key (pk_).

API_KEY_ID="pk_live_xxxxxxxxxxxx"
API_SECRET="sk_live_xxxxxxxxxxxx"
QUERY="?invoice_id=inv_7K2M9P4Q8R1X5Z3A0bC2dE&limit=20"

TS=$(date +%s)
# No body: the hash slot is the EMPTY STRING, not sha256("").
SIGNATURE=$(printf '%s\n%s\n%s\n%s\n%s' "$TS" GET /v1/refunds "$QUERY" '' \
  | openssl dgst -sha256 -hmac "$API_SECRET" -binary | base64)

curl -sS "https://api.paymos.io/v1/refunds$QUERY" \
  -H "Authorization: HMAC-SHA256 $API_KEY_ID:$SIGNATURE" \
  -H "X-Request-Timestamp: $TS"
import { Paymos } from '@paymos/sdk';

const paymos = new Paymos({
  apiKey: process.env.PAYMOS_API_KEY,
  apiSecret: process.env.PAYMOS_API_SECRET,
});

const page = await paymos.refunds.list({
  invoiceId: 'inv_7K2M9P4Q8R1X5Z3A0bC2dE',
  limit: 20,
});

for await (const refund of paymos.refunds.iterate({ status: ['completed'] }, 10)) {
  console.log(refund.withdrawalId);
}
import os

from paymos import Paymos

paymos = Paymos(
    api_key=os.environ["PAYMOS_API_KEY"],
    api_secret=os.environ["PAYMOS_API_SECRET"],
)

page = paymos.refunds.list(invoice_id="inv_7K2M9P4Q8R1X5Z3A0bC2dE", limit=20)

for refund in paymos.refunds.iterate(10, status=["completed"]):
    print(refund["withdrawal_id"])
<?php
use Paymos\Client;
use Paymos\ClientConfig;

$paymos = new Client(new ClientConfig(
    getenv('PAYMOS_API_KEY'),
    getenv('PAYMOS_API_SECRET')
));

$page = $paymos->refunds()->listPage(array(
    'invoice_id' => 'inv_7K2M9P4Q8R1X5Z3A0bC2dE',
    'limit' => 20,
));

foreach ($paymos->refunds()->iterate(array('status' => array('completed')), 10) as $refund) {
    echo $refund['withdrawal_id'] . PHP_EOL;
}
package main

import (
	"context"
	"fmt"
	"os"

	paymos "github.com/Paymos-labs/go-sdk/v2"
)

func main() {
	client, err := paymos.NewClient(os.Getenv("PAYMOS_API_KEY"), os.Getenv("PAYMOS_API_SECRET"))
	if err != nil {
		panic(err)
	}

	page, err := client.Refunds.List(context.Background(), paymos.RefundListParams{
		InvoiceID: "inv_7K2M9P4Q8R1X5Z3A0bC2dE",
		Limit:     20,
	})
	if err != nil {
		panic(err)
	}
	fmt.Println(len(page.Items), page.NextCursor)

	iter := paymos.NewRefundIterator(client.Refunds, paymos.RefundListParams{
		Status: []paymos.WithdrawalStatus{paymos.WithdrawalCompleted},
	}, 10)
	for {
		refund, ok, err := iter.Next(context.Background())
		if err != nil {
			panic(err)
		}
		if !ok {
			break
		}
		fmt.Println(refund.WithdrawalID)
	}
}
using Paymos;

using var paymos = new PaymosClient(
    Environment.GetEnvironmentVariable("PAYMOS_API_KEY")!,
    Environment.GetEnvironmentVariable("PAYMOS_API_SECRET")!);

var page = await paymos.Refunds.ListAsync(new RefundListOptions(
    InvoiceId: "inv_7K2M9P4Q8R1X5Z3A0bC2dE",
    Limit: 20));

await foreach (var refund in paymos.Refunds.IterateAsync(
    new RefundListOptions(Status: [WithdrawalStatus.Completed]), maxPages: 10))
{
    Console.WriteLine(refund.WithdrawalId);
}
import io.paymos.Page;
import io.paymos.PaymosClient;
import io.paymos.Refund;
import io.paymos.RefundListOptions;
import io.paymos.WithdrawalStatus;

import java.util.List;

PaymosClient paymos = new PaymosClient(
    System.getenv("PAYMOS_API_KEY"),
    System.getenv("PAYMOS_API_SECRET"));

Page<Refund> page = paymos.refunds.list(RefundListOptions.builder()
    .invoiceId("inv_7K2M9P4Q8R1X5Z3A0bC2dE")
    .limit(20)
    .build());

for (Refund refund : paymos.refunds.iterate(
        RefundListOptions.builder().status(List.of(WithdrawalStatus.COMPLETED)).build(), 10)) {
    System.out.println(refund.withdrawalId());
}
require 'paymos'

paymos = Paymos::Client.new(
  api_key: ENV.fetch('PAYMOS_API_KEY'),
  api_secret: ENV.fetch('PAYMOS_API_SECRET')
)

page = paymos.refunds.list(invoice_id: 'inv_7K2M9P4Q8R1X5Z3A0bC2dE', limit: 20)

paymos.refunds.each(max_pages: 10, status: ['completed']) do |refund|
  puts refund.withdrawal_id
end
use paymos::{PaymosClient, RefundListParams, WithdrawalStatus};

let paymos = PaymosClient::new(
    std::env::var("PAYMOS_API_KEY")?,
    std::env::var("PAYMOS_API_SECRET")?,
)?;

let page = paymos
    .refunds()
    .list(&RefundListParams {
        invoice_id: Some("inv_7K2M9P4Q8R1X5Z3A0bC2dE".to_owned()),
        limit: Some(20),
        ..Default::default()
    })
    .await?;
println!("{} items, next_cursor={:?}", page.items.len(), page.next_cursor);

let mut pager = paymos.refunds().pager(
    RefundListParams { status: Some(vec![WithdrawalStatus::Completed]), ..Default::default() },
    Some(10),
)?;
while let Some(refund) = pager.next().await? {
    println!("{}", refund.withdrawal_id);
}

Response (200 OK)

{
  "items": [
    {
      "withdrawal_id": "wdr_6Qm2fK8xR4vN7cT1bY9dL5",
      "invoice_id": "inv_7K2M9P4Q8R1X5Z3A0bC2dE",
      "mode": "full",
      "external_order_id": "refund-1042-full",
      "status": "completed",
      "is_final": true,
      "is_test": false,
      "amount": "100.00",
      "fee": "1.00",
      "currency": "USDT",
      "network": "TRC20",
      "destination_address": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
      "first_sender": "TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9",
      "tx_hash": "9f3b8c2a1d0e4f6789abc123def4567890abc123def4567890abc123def45678",
      "explorer_url": "https://tronscan.org/#/transaction/9f3b8c2a1d0e4f6789abc123def4567890abc123def4567890abc123def45678",
      "created_at": 1767225600,
      "completed_at": 1767225932,
      "type": "refund",
      "project_id": "prj_3F9xL2mN8pQ4rT6vW1yZ5b"
    }
  ],
  "next_cursor": null
}

Each item in items carries the full refund resource, identical in shape to Get Refund.

Pagination rules

  • Follow next_cursor until it returns null.
  • The cursor is bound to the /v1/refunds endpoint and the exact filter parameters (invoice_id, status, created_from, created_to). Keep filters unchanged between pages; limit may vary.
  • Cursors expire 24 hours after issuance.
  • Passing an invoice_id outside your credential's project scope returns an empty list rather than 404.

Errors

A Payout (rk_) key is rejected with 403 payment_key_required. Invalid filter values return 400, and an expired or mismatched cursor returns 400 pagination_cursor_invalid. See Error Codes.