Pay
Rejects
Disputes & Chargebacks

Disputes

Learn how to manage payment disputes and chargebacks


Payment disputes occur when customers challenge payments through their bank or card issuer. Disputes can result from suspected fraud, unauthorized transactions, service issues, or billing errors. Understanding how to monitor, respond to, and prevent disputes is essential for maintaining healthy payment operations and minimizing revenue loss.

Prerequisites

Before handling disputes, it's helpful to learn about the following topics.


Learn about payment processing

Understand how payments are processed, including authorization, settlement, and clearing flows.

Learn about transaction webhooks

Monitor transaction lifecycle events and status changes through webhook notifications.

Understanding Disputes


Disputes occur when customers contest payments after they have been processed and settled. The dispute process varies based on payment method, but all disputes result in temporary or permanent fund reversals.

How Disputes Work

Initial Processing

Payment is processed and marked as processed

Customer Dispute

Customer contacts their bank/card issuer to dispute the charge

Status Update

Transaction status changes from processed to rejected with status code disputed, or to adjusted with partially_disputed if only part of the payment amount is disputed.

Fund Reversal

Funds are immediately reversed from your processing account. They are pulled from the default withdraw method unless a default dispute method is set.

Evidence Period

You have limited time to submit evidence (typically 7-21 days)

Resolution

Bank/issuer reviews evidence and makes final decision

Outcome

Dispute is won (funds returned) or lost (funds remain reversed) and transaction is set back to processed


Handling Different Dispute Types

The response process varies between card chargebacks and bank account disputes.

Card Chargebacks

Card chargebacks follow a formal dispute process governed by card network rules (Visa, Mastercard, etc.):

  • You have opportunity to provide evidence to the card issuer
  • Evidence submission typically has 7-21 day deadline
  • Card network makes final decision based on submitted evidence

A chargeback for the full amount gives the payment status rejected and status code disputed. A chargeback for part of the amount gives it status adjusted and status code partially_disputed.

Bank Account Disputes

A bank dispute happens when the customer tells their bank that a debit was not authorized. The payment is returned with status rejected and status code disputed. Unlike card chargebacks, bank disputes don't have a formal evidence submission process through the payment network. Resolution typically involves direct communication with the customer or pursuing collection through other means.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
# Retrieve a rejected transaction
transaction = pl.Transaction.get('txn_rejected123')
 
# Check if the customer disputed a bank payment as unauthorized
if (
    transaction.status.code == 'disputed'
    and transaction.sender['method'].type == 'bank_account'
):
    print(f"Bank dispute for transaction {transaction.id}")
    print(f"Amount: ${transaction.amount}")
 
    # Record in dispute tracking system
    print("Creating dispute case in tracking system...")
    # dispute_case = create_internal_dispute_case(
    #     transaction_id=transaction.id,
    #     type='bank_dispute',
    #     status='pending_review',
    #     amount=transaction.amount
    # )
 
    # Notify dispute management team
    print("Notifying dispute team...")
    # send_notification(
    #     team='disputes',
    #     priority='high',
    #     message=f"Bank dispute filed for transaction {transaction.id}",
    #     transaction_id=transaction.id,
    #     amount=transaction.amount
    # )
 
    # Contact customer to determine reason
    print("Initiating customer contact...")
    # send_email(
    #     to=customer.email,
    #     subject="Question About Recent Payment",
    #     body="Your bank reported your recent payment as unauthorized. Please contact us to discuss..."
    # )
 
    # Gather evidence for potential collection
    print("Gathering transaction evidence...")
    evidence = {
        'transaction_id': transaction.id,
        'original_authorization': 'Evidence of customer authorization',
        'service_delivery': 'Proof of service delivery or product shipment',
        'customer_agreement': 'Terms of service agreed to at purchase',
        'communication_history': 'Previous emails, chats, or phone calls'
    }
 
    # Document in dispute tracking system
    print("Creating dispute case...")
    # dispute_case = create_dispute_case(
    #     transaction_id=transaction.id,
    #     type='bank_dispute',
    #     amount=transaction.amount,
    #     evidence=evidence,
    #     customer_id=transaction.sender['account_id']
    # )
 
    # Flag account in your internal system
    print("Flagging account pending resolution...")
    # flag_account_for_review(
    #     account_id=transaction.sender['account_id'],
    #     reason='bank_dispute',
    #     action='suspend_autopay'
    # )
 
    print("Bank dispute handling initiated")

This example handles bank disputes:

  1. Check that the status code is disputed and the payment was made from a bank account
  2. Record the transaction in your internal dispute tracking system
  3. Contact the customer to confirm whether they authorized the payment
  4. Consider whether to pursue collection or write off

Default Dispute Method

Funds for a disputed payment are pulled from the processing account's default withdraw method, like any other pull-back. To pull them from a separate bank account, set account_defaults.funding to disputes on that payment method.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
# Bank account to pull disputed payments from. A dispute method must be
# two_way, and bank accounts aren't two_way by default in every case.
payment_method = pl.PaymentMethod.create(
    type='bank_account',
    account_id='acct_processing123',
    bank_account={
        'account_number': '000123456789',
        'routing_number': '110000000',
        'account_type': 'checking'
    },
    account_holder='Merchant Business Inc',
    transfer_type='two_way',
    account_defaults={
        'funding': 'disputes'
    }
)
 
print(f"Created payment method: {payment_method.id}")
print(f"Default for funding: {payment_method.account_defaults['funding']}")
  • The dispute method must be a two_way bank account on the processing account, and it can't also be the account's default deposit or withdraw method. Bank accounts aren't two_way by default in every case, and transfer_type can't be changed after the payment method is created, so set transfer_type to two_way when you create it, as the example does.
  • Only payments with status code disputed or partially_disputed use it. They are pulled in a withdraw of their own, separate from other funding. Other pull-backs, such as NSF returns and stop payments, still use the default withdraw method.

See Default Payment Methods for the other funding defaults.


Querying Disputed Transactions

Monitor disputed transactions by querying for payments with the disputed or partially_disputed status code.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
from datetime import datetime, timedelta
 
# Query disputed payments from the last 90 days
ninety_days_ago = datetime.now() - timedelta(days=90)
date_string = ninety_days_ago.strftime('%Y-%m-%d')
 
disputed_transactions = pl.Transaction.filter_by(
    status={'code': 'disputed|partially_disputed'},
    created_at='>='+date_string
).all()
 
print(f"Found {len(disputed_transactions)} disputed transactions\n")
 
# Separate card chargebacks from bank disputes
chargebacks = []
bank_disputes = []
 
for txn in disputed_transactions:
    if txn.sender['method'].type == 'card':
        chargebacks.append(txn)
    else:
        bank_disputes.append(txn)
 
# Display dispute summary
print(f"Card Chargebacks: {len(chargebacks)}")
print(f"Bank Disputes: {len(bank_disputes)}")
print()
 
# Display chargeback details
if chargebacks:
    print("Card Chargebacks:")
    for txn in chargebacks:
        print(f"  Transaction: {txn.id}")
        print(f"    Amount: ${txn.amount}")
        print(f"    Status: {txn.status.value}")
        print(f"    Code: {txn.status.code}")
        print(f"    Message: {txn.status.message}")
        print()
 
# Display bank dispute details
if bank_disputes:
    print("Bank Disputes:")
    for txn in bank_disputes:
        print(f"  Transaction: {txn.id}")
        print(f"    Amount: ${txn.amount}")
        print(f"    Rejected: {txn.rejected_date}")
        print()

This example demonstrates querying disputed transactions:

  1. Filter transactions by status.code='disputed|partially_disputed' (| matches either code)
  2. Optionally filter by date range using created_at. Partially disputed payments keep status adjusted and have no rejected_date
  3. Check sender.method.type to tell card chargebacks (card) from bank disputes (bank_account)
  4. Access status.message for human-readable details

Regular monitoring helps identify dispute patterns, track dispute rates, and respond promptly to new disputes.


Handling Dispute Webhooks

Receive immediate notifications when disputes are filed by registering a webhook.

import payload
pl = payload.Session('secret_key_3bW9...', api_version='v2')
 
from flask import Flask, request, jsonify
 
app = Flask(__name__)
 
@app.route('/webhooks/transaction-disputed', methods=['POST'])
def handle_dispute():
    # Acknowledge webhook immediately
    response = jsonify({'received': True})
 
    # Parse webhook payload
    event = request.json
 
    # Verify webhook signature (important for security)
    # signature = request.headers.get('Payload-Signature')
    # pl.Webhook.verify(signature, request.data)
 
    # Full disputes arrive as reject events, partial card disputes as adjusted events
    if event['trigger'] not in ('reject', 'adjusted'):
        return response, 200
 
    # Fetch full transaction details from API
    transaction = pl.Transaction.get(event['triggered_on']['id'])
    txn_id = transaction.id
    status_code = transaction.status.code
    amount = transaction.amount
    rejected_date = transaction.rejected_date
 
    print(f"Dispute notification: Transaction {txn_id}")
    print(f"Amount: ${amount}")
    print(f"Status code: {status_code}")
    print(f"Rejected: {rejected_date}")
 
    # Ignore returns that aren't disputes (NSF, closed account, stop payment)
    if status_code not in ('disputed', 'partially_disputed'):
        return response, 200
 
    # Determine dispute type
    if transaction.sender['method'].type == 'card':
        dispute_type = 'chargeback'
        print("Type: Card Chargeback")
    else:
        dispute_type = 'bank_dispute'
        print("Type: Bank Dispute")
 
    # Create dispute case immediately
    print("Creating dispute case...")
    dispute_case = {
        'transaction_id': txn_id,
        'type': dispute_type,
        'amount': amount,
        'status_code': status_code,
        'received_date': rejected_date,
        'evidence_due_date': 'Calculate based on network rules',
        'status': 'evidence_needed'
    }
    # save_dispute_case(dispute_case)
 
    # Notify dispute management team
    print("Notifying dispute team...")
    # send_urgent_notification(
    #     team='disputes',
    #     priority='urgent',
    #     subject=f"New {dispute_type}: ${amount}",
    #     transaction_id=txn_id,
    #     due_date=dispute_case['evidence_due_date']
    # )
 
    # Notify account manager if high value
    if amount >= 1000:
        print("High-value dispute - notifying account manager...")
        # notify_account_manager(transaction)
 
    # Begin automated evidence gathering
    print("Initiating evidence gathering...")
    # gather_transaction_evidence(txn_id)
    # retrieve_customer_history(transaction['sender']['account_id'])
    # pull_delivery_records(txn_id)
 
    # Update internal systems
    print("Updating internal systems...")
    # update_accounting_system(txn_id, 'disputed')
    # flag_customer_account(transaction.sender['account_id'], 'dispute_filed')
 
    return response, 200
 
if __name__ == '__main__':
    app.run(port=5000)

This example shows webhook handling:

  1. Register webhooks for the reject trigger (full disputes) and the adjusted trigger (partial card disputes)
  2. Receive POST request when dispute occurs
  3. Fetch the transaction and skip it unless status.code is disputed or partially_disputed
  4. Check sender.method.type to determine dispute type
  5. Automatically create case in dispute management system
  6. Notify relevant team members immediately
  7. Begin evidence gathering process

Webhooks enable immediate response to disputes, maximizing the time available for evidence submission.


Analyzing Dispute Patterns

Track dispute rates and identify patterns to reduce future disputes.

from collections import defaultdict
from datetime import datetime, timedelta
 
import payload
 
pl = payload.Session("secret_key_3bW9...", api_version="v2")
 
# Query all transactions from the last 90 days
ninety_days_ago = datetime.now() - timedelta(days=90)
start_date = ninety_days_ago.strftime("%Y-%m-%d")
 
all_transactions = pl.Transaction.filter_by(created_at=">=" + start_date).all()
 
disputed_transactions = pl.Transaction.filter_by(
    status={"code": "disputed|partially_disputed"}, created_at=">=" + start_date
).all()
print(f"Analyzing transactions from {start_date} to today")
print(f"Total transactions: {len(all_transactions)}")
print(f"Disputed transactions: {len(disputed_transactions)}")
 
# Calculate overall dispute rate
dispute_rate = (
    (len(disputed_transactions) / len(all_transactions) * 100)
    if len(all_transactions) > 0
    else 0
)
print(f"Overall dispute rate: {dispute_rate:.2f}%")
 
# Separate card chargebacks from bank disputes
chargebacks = []
bank_disputes = []
dispute_codes = defaultdict(int)
 
for txn in disputed_transactions:
    dispute_codes[txn.status.code] += 1
 
    if txn.sender["method"].type == "card":
        chargebacks.append(txn)
    else:
        bank_disputes.append(txn)
 
print(f"\nDispute breakdown:")
print(f"  Card chargebacks: {len(chargebacks)}")
print(f"  Bank disputes: {len(bank_disputes)}")
 
# Compare full and partial disputes
print(f"\nDispute status codes:")
for code, count in sorted(dispute_codes.items(), key=lambda x: x[1], reverse=True):
    percentage = count / len(disputed_transactions) * 100
    print(f"  {code}: {count} ({percentage:.1f}%)")
 
# Identify products with high dispute rates
product_stats = defaultdict(lambda: {"total": 0, "disputed": 0})
 
for txn in all_transactions:
    if hasattr(txn, "line_items") and txn.line_items:
        for item in txn.line_items:
            product_id = item.get("product_id")
            if product_id:
                product_stats[product_id]["total"] += 1
 
for txn in disputed_transactions:
    if hasattr(txn, "line_items") and txn.line_items:
        for item in txn.line_items:
            product_id = item.get("product_id")
            if product_id:
                product_stats[product_id]["disputed"] += 1
 
print(f"\nProducts with highest dispute rates:")
product_rates = []
for product_id, stats in product_stats.items():
    if stats["total"] >= 10:  # Only consider products with 10+ transactions
        rate = stats["disputed"] / stats["total"] * 100
        product_rates.append((product_id, rate, stats["total"], stats["disputed"]))
 
for product_id, rate, total, disputed in sorted(
    product_rates, key=lambda x: x[1], reverse=True
)[:5]:
    print(f"  Product {product_id}: {rate:.1f}% ({disputed}/{total} transactions)")
 
# Analyze timing patterns
dispute_days = defaultdict(int)
for txn in disputed_transactions:
    if txn.rejected_date:
        print(txn.rejected_date)
        rejected_date = datetime.strptime(txn.rejected_date, "%Y-%m-%d")
        day_of_week = rejected_date.strftime("%A")
        dispute_days[day_of_week] += 1
 
print(f"\nDispute timing by day of week:")
for day in [
    "Monday",
    "Tuesday",
    "Wednesday",
    "Thursday",
    "Friday",
    "Saturday",
    "Sunday",
]:
    count = dispute_days[day]
    print(f"  {day}: {count}")
 
# Flag high-risk accounts
account_disputes = defaultdict(int)
for txn in disputed_transactions:
    if hasattr(txn, "sender") and txn.sender:
        account_id = txn.sender.get("account_id")
        if account_id:
            account_disputes[account_id] += 1
 
print(f"\nAccounts with multiple disputes:")
for account_id, count in sorted(
    account_disputes.items(), key=lambda x: x[1], reverse=True
):
    if count >= 2:
        print(f"  Account {account_id}: {count} disputes")

This example analyzes dispute patterns:

  1. Query all disputed transactions for a date range
  2. Calculate dispute rate (disputes / total transactions)
  3. Group disputes into card chargebacks and bank disputes, and into full and partial disputes
  4. Identify products or services with high dispute rates
  5. Analyze timing patterns (disputes after X days)
  6. Generate reports for management

Key Metrics to Track:

  • Overall Dispute Rate: Should be less than 1% for most businesses
  • Win Rate: Percentage of disputes won with evidence
  • Average Dispute Amount: Track financial impact
  • Time to First Dispute: Days between transaction and dispute
  • Dispute Reason Distribution: Most common dispute types

Testing Disputes

Test dispute handling in test mode before production deployment.

Simulating a Bank Dispute

Pay from the test bank account 0009807 to simulate a customer disputing a bank payment. The payment is processed as usual, then returned with status rejected and status code disputed.

import payload
 
pl = payload.Session("secret_key_3bW9...", api_version="v2")
 
# Test account 0009807 is processed, then returned with status code
# disputed the next time test mode imports bank rejects
transaction = pl.Transaction.create(
    type="payment",
    amount=500.00,
    sender={
        "method": {
            "type": "bank_account",
            "bank_account": {
                "account_number": "0009807",
                "routing_number": "021000021",
                "account_type": "checking",
            },
            "account_holder": "Jane Smith",
        }
    },
    description="Test bank dispute",
)
print(f"Created transaction: {transaction.id}")
print(f"Status: {transaction.status.value}")  # processed
 
# Test mode returns the payment later, not right away. Once returned,
# the payment is rejected with status code disputed.
transaction = pl.Transaction.get(transaction.id)
print(f"Status: {transaction.status.value} ({transaction.status.code})")

Once the payment is returned, confirm that:

  • Your webhook endpoint receives the reject event for the payment
  • Your handling logic runs for the disputed status code

See Test Bank Accounts for the account numbers that produce other status codes.

Card Chargebacks

Test mode can't simulate a card chargeback. No test card number or security code makes a card payment come back disputed. To test a declined card security code instead, use the invalid_card_code test card 4111 1111 1111 9905 from Test Cards.


Dispute Status Codes


Dispute status codes:

disputed
string
Disputed - The cardholder charged back the full payment, or the customer told their bank the debit was not authorized. The payment status is rejected.
partially_disputed
string
Partially disputed - The cardholder charged back part of a card payment. The payment status is adjusted.

Schema Reference


The following fields are relevant for handling disputes:

Transaction Fields

status
object
The status information for this transaction, including the current state, a detailed status code, and a human-readable message explaining the result.
code
enum[string]
A machine-readable code detailing the specific reason or result for the transaction status. This provides granular information about success, failure reasons, or other status conditions.
Values: approved, card_expired, duplicate_attempt, exceeded_limit, general_decline, insufficient_bal, invalid_card_code, invalid_card_number, invalid_zip, invalid_address, invalid_account_number, suspicious_activity, too_many_attempts, processing_issue, issue_reading_card, not_supported, general_reject, general_adjustment, chargeback_overturned, payment_stopped, disputed, partially_disputed, balance_unverifiable
Read-only permissions: "Undocumented"
message
stringRead-only
A human-readable message describing the transaction status and code. This text is suitable for display to users and provides context about the transaction outcome.
value
enum[string]
The current processing status of the transaction, indicating its lifecycle state such as processing, processed, authorized, declined, voided, or rejected.
Values: processing, authorized, processed, declined, rejected, voided, adjusted
rejected_date
string (date)
The date on which this transaction was rejected. This field is automatically set when a transaction is set to rejected.
Read-only permissions: "Undocumented"

For complete transaction field documentation, see the Transaction API Reference.

Next Steps

Enhance dispute handling and payment operations


Prevent Disputes

Manage Payment Methods to validate payment information, implement Payment Method Verification to confirm account ownership, and use clear billing descriptors and customer communication to reduce disputes.

Handle Payment Issues

Respond to Payment Declines for immediate payment failures, manage Bank Rejects for NSF and invalid account rejections, and process Voids and Refunds to cancel and reverse payments.

Monitor Payment Health

Set up Webhook Events for real-time dispute notifications, track metrics with Building Report Queries, and analyze transaction data to identify dispute patterns and improve prevention strategies.


Related articles