agentsclimarketplace

Paystack refunds

Skill rexedge/paystack/skills/paystack-refunds

24 AI agent skills for Paystack API integration — automate payment workflows with TypeScript, Node.js, and Next.js

Install
npx -y skills add rexedge/paystack --skill paystack-refunds

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Paystack Refunds API — create full or partial refunds, retry failed refunds with customer bank details, list and fetch refund records. Use this skill whenever implementing refund functionality, processing customer refund requests, handling partial refunds, retrying refunds that need attention, or tracking refund status. Also use when you see references to refund.processed, refund.failed, refund.pending webhook events, or the /refund endpoint.

SKILL.md

4.7 KB, as published. Nobody here has run it

Paystack Refunds

The Refunds API lets you create and manage refunds for transactions. Supports full and partial refunds.

Depends on: paystack-setup for the paystackRequest helper.
Related: paystack-webhooks for refund.processed, refund.failed, refund.pending events.

Endpoints

MethodEndpointDescription
POST/refundCreate a refund
POST/refund/retry_with_customer_details/:idRetry a failed refund
GET/refundList refunds
GET/refund/:idFetch a refund

Create Refund

POST /refund

ParamTypeRequiredDescription
transactionstringYesTransaction reference or ID
amountintegerNoAmount in subunits (defaults to full transaction amount)
currencystringNoCurrency code
customer_notestringNoReason shown to customer
merchant_notestringNoInternal reason for merchant

Full Refund

const refund = await paystackRequest<{
  status: string;
  amount: number;
  transaction: { reference: string; amount: number };
}>("/refund", {
  method: "POST",
  body: JSON.stringify({
    transaction: "T685312322670591",  // Transaction reference or ID
  }),
});
// refund.message → "Refund has been queued for processing"

Partial Refund

await paystackRequest("/refund", {
  method: "POST",
  body: JSON.stringify({
    transaction: "T685312322670591",
    amount: 5000,                        // Refund ₦50 of a larger transaction
    customer_note: "Partial refund for damaged item",
    merchant_note: "Customer reported damage on item #3",
  }),
});

Retry Refund

POST /refund/retry_with_customer_details/:id

Retry a refund with needs-attention status by providing the customer's bank account details.

ParamTypeRequiredDescription
refund_account_detailsobjectYesCustomer's bank account details
refund_account_details.currencystringYesCurrency (same as original payment)
refund_account_details.account_numberstringYesCustomer's bank account number
refund_account_details.bank_idstringYesBank ID (from List Banks endpoint)
await paystackRequest(`/refund/retry_with_customer_details/${refundId}`, {
  method: "POST",
  body: JSON.stringify({
    refund_account_details: {
      currency: "NGN",
      account_number: "1234567890",
      bank_id: "9",
    },
  }),
});

List Refunds

GET /refund

ParamTypeRequiredDescription
transactionstringNoFilter by transaction ID
currencystringNoFilter by currency
fromdateNoStart date e.g. 2016-09-21
todateNoEnd date
perPageintegerNoRecords per page (default: 50)
pageintegerNoPage number (default: 1)
const refunds = await paystackRequest("/refund?perPage=20&page=1");

Fetch Refund

GET /refund/:id

const refund = await paystackRequest(`/refund/${refundId}`);
// refund.data.status → "pending" | "processing" | "processed" | "failed"

Refund Statuses

StatusDescription
pendingRefund initiated, awaiting processor
processingRefund received by processor
processedRefund successfully completed
failedRefund failed — your account is credited back
needs-attentionRefund needs manual intervention (retry with customer details)

Webhook Events

Listen for these events to track refund lifecycle:

  • refund.pending — Refund initiated
  • refund.processing — Refund being processed
  • refund.processed — Refund completed successfully
  • refund.failed — Refund failed (amount credited back to your account)

Important Notes

  • Refund amount cannot exceed the original transaction amount
  • If amount is omitted, the full transaction amount is refunded
  • Partial refunds are supported — you can refund a portion of a transaction
  • Failed refunds credit the refund amount back to your Paystack balance
  • For needs-attention status, retry with customer's bank account details
  • Always listen for webhook events rather than polling for refund status

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.