← Back to Overview

Analyze Refund

Analyze refund to estimate non-recovered interchange fees

POST/api/back/analyzeOptional Auth
publicproductoptional-auth

Example Request

cURL

curl -X POST https://margin.so/api/back/analyze \
  -H "Content-Type: application/json" \
  -H "X-API-Key: sk_live_your_api_key_here" \
  -d '{}'

JavaScript

const response = await fetch('https://margin.so/api/back/analyze', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'sk_live_your_api_key_here'
  },
  body: JSON.stringify({})
});

const data = await response.json();
console.log(data);

Python

import requests

response = requests.post(
    'https://margin.so/api/back/analyze',
    headers={
        'Content-Type': 'application/json',
        'X-API-Key': 'sk_live_your_api_key_here'
    },
    json={}
)

data = response.json()
print(data)

Example Response

{
  "success": true,
  "data": {
    "refund_id": "ref_abc123def456",
    "original_transaction_id": "txn_original_123",
    "refund_amount_cents": 5000,
    "original_amount_cents": 15000,
    "is_partial_refund": true,
    "interchange_recovery": "partial",
    "estimated_loss_cents": 42,
    "recommended_method": "bank_transfer",
    "method_savings_cents": 42,
    "event_id": "evt_analysis_xyz789"
  }
}

Request Body

FieldTypeRequiredDescription