{
  "format": "dataset-manifest/1",
  "slug": "payment-lifecycle-events",
  "version": 2,
  "seed": "payment-lifecycle-events:1",
  "spec": {
    "format": "dataset/1",
    "slug": "payment-lifecycle-events",
    "name": "Payment Lifecycle Events",
    "tagline": "Lifecycle events of payments including creation, authorization, capture, refund, and dispute details.",
    "description": "Payments are initiated, tracked, and processed through various stages in the fintech world, with each stage represented as an event in their lifecycle. When a payment is created, it enters the system and is subsequently authorized to ensure the validity and availability of funds. Once confirmed, payments are captured, marking the point where the funds are transferred. However, not every transaction follows the smooth path; some may encounter issues, leading to refunds or disputes that require further handling. This dataset models these processes, illustrating how each payment evolves through its lifecycle.\n\nThe relationships between the tables paint a detailed picture of payment interactions. The 'payments' table serves as the primary record that outlines each transaction, with individual entries representing distinct payments. Linked to this are the 'payment_events,' which detail every event that a payment undergoes, from creation to authorization, capturing, refunding, or disputing. The 'refunds' table captures specific entries related to any refunds processed, while the 'disputes' table covers cases where transactions are challenged. By examining these tables together, one can understand how various actions relate to a single payment over time.\n\nThis dataset answers critical questions regarding payment performance and lifecycle management. Developers can practice addressing queries such as: What percentage of payments are refunded versus captured? How do disputes impact overall revenue? What patterns emerge in payment failures or retries? These insights are essential for enhancing payment strategies and improving customer satisfaction. It's important to note that all data within this dataset is synthetic, designed to provide a realistic yet fictional representation of payment processes for analytical practice.",
    "domain": "fintech",
    "shape": "event-log",
    "useCases": [
      "etl-pipelines",
      "analytics-demo"
    ],
    "keywords": [
      "payments",
      "lifecycle",
      "events",
      "fintech",
      "etl",
      "analytics",
      "refunds",
      "disputes"
    ],
    "locale": "en",
    "license": "CC0-1.0",
    "version": 1,
    "tables": {
      "payments": {
        "description": "This table contains records of payment transactions, including their status and amount. Each row represents a unique payment identified by its ID, and links to related events, refunds, or disputes through the payment_id.",
        "rows": 100,
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each payment transaction."
          },
          "amount": {
            "kind": "decimal",
            "min": 0.01,
            "max": 10000,
            "scale": 2,
            "description": "Total amount of the payment in decimal format.",
            "distribution": "long-tail"
          },
          "created_at": {
            "kind": "datetime",
            "from": "2023-01-01",
            "to": "2023-12-31",
            "dayProfile": "business",
            "description": "Timestamp indicating when the payment was created."
          },
          "status": {
            "kind": "enum",
            "values": [
              "created",
              "authorized",
              "captured",
              "refunded",
              "disputed"
            ],
            "weights": [
              0.3,
              0.4,
              0.2,
              0.05,
              0.05
            ],
            "description": "Current status of the payment, such as created, authorized, captured, refunded, or disputed."
          }
        }
      },
      "payment_events": {
        "description": "This table tracks various events associated with payments, detailing the type of event and when it occurred. Each event is linked to a payment through payment_id, allowing for a chronological view of payment actions.",
        "rows": {
          "per": "payments",
          "via": "payment_id",
          "min": 1,
          "max": 5,
          "skew": "heavy-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each payment event."
          },
          "payment_id": {
            "kind": "fk",
            "ref": "payments.id",
            "description": "Foreign key linking to the associated payment in the payments table."
          },
          "event_type": {
            "kind": "enum",
            "values": [
              "created",
              "authorized",
              "captured",
              "refunded",
              "disputed"
            ],
            "weights": [
              0.3,
              0.4,
              0.2,
              0.05,
              0.05
            ],
            "description": "Type of event that occurred, such as created, authorized, captured, refunded, or disputed."
          },
          "event_timestamp": {
            "kind": "datetime",
            "after": "payment_id.created_at",
            "withinDays": 30,
            "description": "Timestamp indicating when the event took place."
          }
        }
      },
      "refunds": {
        "description": "This table records details of refunds processed for payments, including the amount refunded and the timestamp of the refund. Each refund is associated with a specific payment via payment_id.",
        "rows": {
          "per": "payments",
          "via": "payment_id",
          "min": 0,
          "max": 1,
          "skew": "long-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each refund record."
          },
          "payment_id": {
            "kind": "fk",
            "ref": "payments.id",
            "description": "Foreign key linking to the payment that was refunded."
          },
          "refund_amount": {
            "kind": "decimal",
            "min": 0.01,
            "max": 10000,
            "scale": 2,
            "description": "Amount refunded in decimal format.",
            "distribution": "long-tail"
          },
          "refund_timestamp": {
            "kind": "datetime",
            "after": "payment_id.created_at",
            "withinDays": 30,
            "description": "Timestamp indicating when the refund was processed."
          }
        }
      },
      "disputes": {
        "description": "This table captures disputes related to payments, including the reason for the dispute and when it was raised. Each dispute is linked to a payment through payment_id, providing context for the issue.",
        "rows": {
          "per": "payments",
          "via": "payment_id",
          "min": 0,
          "max": 1,
          "skew": "long-tail"
        },
        "columns": {
          "id": {
            "kind": "pk",
            "description": "Unique identifier for each dispute record."
          },
          "payment_id": {
            "kind": "fk",
            "ref": "payments.id",
            "description": "Foreign key linking to the payment that is disputed."
          },
          "dispute_reason": {
            "kind": "sentence",
            "description": "Text description of the reason for the dispute."
          },
          "dispute_timestamp": {
            "kind": "datetime",
            "after": "payment_id.created_at",
            "withinDays": 30,
            "description": "Timestamp indicating when the dispute was raised."
          }
        }
      }
    },
    "suggestedQueries": [
      {
        "title": "Join Payments with Payment Events",
        "sql": "SELECT p.id, p.amount, pe.event_type FROM payments p JOIN payment_events pe ON p.id = pe.payment_id;",
        "dialect": "postgres"
      },
      {
        "title": "Count Payments by Status",
        "sql": "SELECT status, COUNT(*) FROM payments GROUP BY status;",
        "dialect": "postgres"
      },
      {
        "title": "Total Refunds by Payment",
        "sql": "SELECT p.id, SUM(r.refund_amount) AS total_refunds FROM payments p LEFT JOIN refunds r ON p.id = r.payment_id GROUP BY p.id;",
        "dialect": "postgres"
      },
      {
        "title": "Dispute Reasons Over Time",
        "sql": "SELECT dispute_reason, COUNT(*) FROM disputes GROUP BY dispute_reason ORDER BY COUNT(*) DESC;",
        "dialect": "postgres"
      },
      {
        "title": "Payment Events in a Date Range",
        "sql": "SELECT pe.event_type, COUNT(*) FROM payment_events pe WHERE pe.event_timestamp BETWEEN '2023-01-01' AND '2023-12-31' GROUP BY pe.event_type;",
        "dialect": "postgres"
      }
    ],
    "usageScenarios": [
      {
        "title": "Customer Support Analysis",
        "body": "A customer support manager may use this dataset to analyze the frequency and types of disputes raised by customers. By examining the dispute reasons and timestamps, they can identify patterns and common issues that lead to dissatisfaction, allowing them to improve customer service and payment processes."
      },
      {
        "title": "Financial Reporting",
        "body": "A financial analyst in a fintech company might leverage this dataset to generate reports on payment performance. By aggregating data on payment statuses and refund amounts, they can provide insights into revenue loss due to refunds and disputes, helping the organization make informed decisions about risk management and customer engagement strategies."
      },
      {
        "title": "Operational Efficiency Review",
        "body": "An operations manager could utilize this dataset to evaluate the efficiency of the payment processing system. By analyzing the time taken for payments to move through various statuses and correlating this with event timestamps, they can identify bottlenecks in the payment lifecycle, leading to potential process improvements."
      }
    ],
    "analysisQuestions": [
      "What are the most common reasons for payment disputes?",
      "How many payments are refunded compared to total payments?",
      "Which payment statuses are most frequently associated with events?"
    ]
  },
  "counts": {
    "payments": 100,
    "disputes": 27,
    "payment_events": 196,
    "refunds": 29
  },
  "stats": {
    "payments": {
      "rows": 100,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 100,
          "min": 1,
          "max": 100
        },
        "amount": {
          "nulls": 0,
          "distinct": 100,
          "min": 1.38,
          "max": 9691.5
        },
        "created_at": {
          "nulls": 0,
          "distinct": 100,
          "min": "2023-01-03 15:44:53",
          "max": "2023-12-25 19:26:23"
        },
        "status": {
          "nulls": 0,
          "distinct": 5,
          "min": "authorized",
          "max": "refunded"
        }
      }
    },
    "payment_events": {
      "rows": 196,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 196,
          "min": 1,
          "max": 196
        },
        "payment_id": {
          "nulls": 0,
          "distinct": 100,
          "min": 1,
          "max": 100
        },
        "event_type": {
          "nulls": 0,
          "distinct": 5,
          "min": "authorized",
          "max": "refunded"
        },
        "event_timestamp": {
          "nulls": 0,
          "distinct": 196,
          "min": "2023-01-10 03:38:39",
          "max": "2024-01-23 01:26:54"
        }
      }
    },
    "refunds": {
      "rows": 29,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 29,
          "min": 1,
          "max": 29
        },
        "payment_id": {
          "nulls": 0,
          "distinct": 29,
          "min": 3,
          "max": 99
        },
        "refund_amount": {
          "nulls": 0,
          "distinct": 29,
          "min": 42.83,
          "max": 9963.87
        },
        "refund_timestamp": {
          "nulls": 0,
          "distinct": 29,
          "min": "2023-02-05 07:29:52",
          "max": "2023-12-12 03:18:19"
        }
      }
    },
    "disputes": {
      "rows": 27,
      "columns": {
        "id": {
          "nulls": 0,
          "distinct": 27,
          "min": 1,
          "max": 27
        },
        "payment_id": {
          "nulls": 0,
          "distinct": 27,
          "min": 1,
          "max": 100
        },
        "dispute_reason": {
          "nulls": 0,
          "distinct": 27
        },
        "dispute_timestamp": {
          "nulls": 0,
          "distinct": 27,
          "min": "2023-01-19 20:31:04",
          "max": "2023-12-13 11:40:04"
        }
      }
    }
  },
  "artifacts": [
    {
      "file": "csv/payments.csv",
      "format": "csv",
      "table": "payments",
      "key": "datasets/payment-lifecycle-events/v2/csv/payments.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/csv/payments.csv",
      "bytes": 4118,
      "sha256": "ddf12aa2a294b0047219289f092fdc8985e1e63dd4d5f60c18506d43f51971f2",
      "rows": 100,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/disputes.csv",
      "format": "csv",
      "table": "disputes",
      "key": "datasets/payment-lifecycle-events/v2/csv/disputes.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/csv/disputes.csv",
      "bytes": 2227,
      "sha256": "2fd5d4edeac237b66f049f1bdc682f8c71ef1b5e8f11298f678868453b3bfdb9",
      "rows": 27,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/payment_events.csv",
      "format": "csv",
      "table": "payment_events",
      "key": "datasets/payment-lifecycle-events/v2/csv/payment_events.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/csv/payment_events.csv",
      "bytes": 7239,
      "sha256": "d93ef435490c3cda0c5bc5de148bcde5ef0fdf14ab9cfdee333a7202f6119074",
      "rows": 196,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "csv/refunds.csv",
      "format": "csv",
      "table": "refunds",
      "key": "datasets/payment-lifecycle-events/v2/csv/refunds.csv",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/csv/refunds.csv",
      "bytes": 1039,
      "sha256": "186c1083c2f76cbd76d52a8698e1ecfceaee5b3b21764b91b388b0611e9b475a",
      "rows": 29,
      "contentType": "text/csv; charset=utf-8"
    },
    {
      "file": "payment-lifecycle-events.json",
      "format": "json",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/payment-lifecycle-events.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/payment-lifecycle-events.json",
      "bytes": 47243,
      "sha256": "401de831df778819822d01ec718869155a6cf3b95cef4b93f69cfc86d255cfb8",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    },
    {
      "file": "sql/postgres.sql",
      "format": "sql-postgres",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/sql/postgres.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/sql/postgres.sql",
      "bytes": 21203,
      "sha256": "a8635260591927d13b43ab4c5222788fd64d352baca238bd575c932c68e53c91",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mysql.sql",
      "format": "sql-mysql",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/sql/mysql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/sql/mysql.sql",
      "bytes": 20754,
      "sha256": "9c5b0c6c392c5d44f607411c4b8b389f86e5162bf69132a6d2866b2a7b79887c",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/mssql.sql",
      "format": "sql-mssql",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/sql/mssql.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/sql/mssql.sql",
      "bytes": 21698,
      "sha256": "b0f45d398cc5f2f3861826d2459c92c61ad39d9f9d61ec851d2be0751f875389",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "sql/sqlite.sql",
      "format": "sql-sqlite",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/sql/sqlite.sql",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/sql/sqlite.sql",
      "bytes": 20603,
      "sha256": "4897d1abd25f49e993cda0998060eda752c0c96f60d44531aa13b449a218ee0c",
      "rows": null,
      "contentType": "application/sql; charset=utf-8"
    },
    {
      "file": "prisma/seed.ts",
      "format": "prisma-seed",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/prisma/seed.ts",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/prisma/seed.ts",
      "bytes": 42405,
      "sha256": "08b0da859c9729748143d58a5bde3bb7564bc806dd0f701fa8ec8bd36df1fec4",
      "rows": null,
      "contentType": "application/typescript; charset=utf-8"
    },
    {
      "file": "django/fixtures.json",
      "format": "django-fixture",
      "table": null,
      "key": "datasets/payment-lifecycle-events/v2/django/fixtures.json",
      "url": "https://database-sample-website.s3.eu-north-1.amazonaws.com/datasets/payment-lifecycle-events/v2/django/fixtures.json",
      "bytes": 63460,
      "sha256": "61577da9acf88bb8a53f0b8accf7ed898c3cd7bb1a91aa8457d3c9c47f69becf",
      "rows": null,
      "contentType": "application/json; charset=utf-8"
    }
  ],
  "publishedAt": 1788767405465,
  "updatedAt": 1788785360560
}
