LLM-Powered Chargeback Dispute Drafting
LLM chargeback drafting workflow: 1) Gather inputs: Paystack transaction record (reference, amount, date, authorization), order fulfillment record, customer email history, delivery confirmation. 2) Feed to LLM: "Draft a chargeback dispute response using only these facts. Do not invent delivery details or customer communications not shown here." 3) LLM drafts dispute in standard format. 4) Human reviews: verify every factual claim against actual records. 5) Human submits via Paystack Disputes section in dashboard. The LLM writes the argument structure. You supply and verify every fact.
Dispute Drafting Workflow
// Build context package for LLM dispute drafting
async function buildDisputeContext(transactionReference) {
var headers = { Authorization: 'Bearer ' + process.env.PAYSTACK_SECRET_KEY };
// 1. Get Paystack transaction details
var txnRes = await fetch('https://api.paystack.co/transaction/verify/' + transactionReference, { headers });
var txn = (await txnRes.json()).data;
// 2. Get your order record
var order = await db.orders.findByReference(transactionReference);
// 3. Get customer email history from your CRM/email tool
var emails = await crm.getEmailThread(txn.customer.email, { since: new Date(txn.paid_at) });
return {
transaction: {
reference: txn.reference,
amount_ngn: txn.amount / 100,
date: txn.paid_at,
channel: txn.channel,
card_last_four: txn.authorization?.last4,
card_brand: txn.authorization?.brand,
ip_address: txn.ip_address,
authorization_code: txn.authorization?.authorization_code,
},
order: {
items: order.line_items,
fulfillment_status: order.status,
fulfillment_date: order.fulfilled_at,
delivery_proof: order.delivery_proof_url, // tracking URL or delivery confirmation
},
customer_communications: emails.map(e => ({
date: e.date,
subject: e.subject,
direction: e.direction, // 'sent' | 'received'
summary: e.body.slice(0, 200), // brief summary, not full body
})),
};
}
// Generate dispute draft
async function draftChargebackDispute(transactionReference) {
var context = await buildDisputeContext(transactionReference);
var prompt = `You are helping draft a chargeback dispute response for a Paystack merchant.
Transaction evidence:
${JSON.stringify(context, null, 2)}
Draft a chargeback dispute response that:
1. Clearly states the transaction was authorized and legitimate
2. References specific evidence from the data provided (dates, amounts, fulfillment proof)
3. Summarizes customer communication showing the customer was engaged with the purchase
4. Notes any delivery or fulfillment confirmation
IMPORTANT: Use only the facts provided above. Do not invent or assume any details not present.
If any evidence is missing (e.g., no delivery confirmation), note what is missing rather than fabricating it.
Format as a professional dispute letter.`;
var response = await anthropic.messages.create({
model: 'claude-opus-4-6',
max_tokens: 1024,
messages: [{ role: 'user', content: prompt }],
});
return {
draft: response.content[0].text,
context, // human reviews context + draft together
warning: 'This is an AI draft. Verify every factual claim against your actual records before submission.',
};
}
Evidence Checklist Before Drafting
Gather this before asking the LLM to draft. Missing evidence weakens your dispute:
- Paystack transaction record — reference, amount, date, authorization code, card details, IP address
- Order/fulfillment record — what was purchased, when it was fulfilled, fulfillment method
- Delivery proof — tracking number and delivery confirmation for physical goods; access logs for digital products
- Customer communication — emails or chat showing the customer engaged with the purchase or received the product
- Terms of service — the terms the customer accepted at checkout, including refund policy
- IP/geolocation match — Paystack provides ip_address on transactions; matching to the customer's known location strengthens the case
Learn More
See audit trails for AI financial actions to understand logging requirements around AI-assisted dispute processes.
Key Takeaways
- ✓LLM drafts the dispute structure and argument — you verify every factual claim before submission.
- ✓Gather all evidence first: transaction record, fulfillment proof, customer communications, delivery confirmation.
- ✓Prompt the LLM to use only the provided facts and flag any missing evidence.
- ✓A human reviews and submits via the Paystack dashboard Disputes section — the LLM does not submit.
- ✓Never let the LLM invent facts — a dispute response with fabricated details damages your case and credibility.
Frequently Asked Questions
- Where do I submit a chargeback dispute in Paystack?
- Paystack notifies you of chargebacks via email and via a webhook event (charge.dispute.create). Log in to your Paystack dashboard and navigate to Disputes under the Payments menu. You will see open disputes with a response deadline. Upload your evidence and submit your response before the deadline — typically 5-10 business days from the dispute notification.
- How good is AI at writing chargeback dispute letters?
- AI is good at structure and argumentation when given the right evidence. A dispute letter has a predictable format: summary of facts, evidence cited, argument that the charge was legitimate. The LLM can draft this faster than starting from a blank page. The LLM cannot help you if your evidence is weak — strong evidence + mediocre writing beats weak evidence + excellent writing every time.
- Can AI help me decide whether to dispute a chargeback or accept it?
- Yes — present the context to the LLM and ask for an honest assessment: "Given this evidence, how strong is my dispute case? What are the weaknesses?" A well-framed LLM analysis can help you make the accept-vs-dispute decision faster. Low-value chargebacks with weak evidence are often cheaper to accept than to dispute. The LLM can help you make that calculation explicitly.
Ready to build real-world apps?
Join the McTaba Labs full-stack marathon (4 months full-time · 6 months part-time). Learn M-Pesa, USSD, and WhatsApp engineering while shipping 8 production apps.
Apply to the McTaba Marathon