Skip to main content

Description

This hook is triggered when a new payment transaction is initiated.

Integration Details

  • Subscription Key: pay.transaction.created
  • Use Case: Track revenue in real-time or update an external financial ledger.
  • Related Events: pay.transaction.updated

Trigger

  • Event Type: pay_transaction_created
  • Source: Insertion of a record into the pay_transaction table.

Payload Example

{
  "id": 901,
  "external_id": "ext_tx_901",
  "currency_code": "USD",
  "total_amount": 50.00,
  "status": "pending",
  "payment_id": "pay_abc123",
  "order_id": 1001,
  "order": {
    "id": 1001,
    "external_id": "ext_ord_1001",
    "status": "open",
    "order_items": [
      {
        "id": 1101,
        "total_price": 50.00,
        "unit_price": 50.00,
        "quantity": 1,
        "coupon": {
          "id": 50,
          "code": "PROMO10",
          "external_id": "ext_cpn_50"
        },
        "item": {
          "id": 1201,
          "status": "active",
          "drive_occurrence_guest_id": 777,
          "sku": {
            "id": 1301,
            "name": "Assessment Credit",
            "currency_code": "USD",
            "tenant_id": 1,
            "type": "credit",
            "external_id": "sku_abc"
          }
        }
      }
    ]
  },
  "created_at": "2023-11-15T09:00:00Z",
  "created_by": 1,
  "updated_at": "2023-11-15T09:00:00Z"
}

Payload Type Showcase

{
  id: number;
  external_id: string | null;
  currency_code: string | null;
  total_amount: number;
  status: string;
  payment_id: string | null;
  order_id: number;
  order: {
    id: number;
    external_id: string | null;
    status: string;
    order_items: {
      id: number;
      total_price: number;
      unit_price: number;
      quantity: number;
      coupon: {
        id: number;
        code: string;
        external_id: string | null;
      } | null;
      item: {
        id: number;
        status: string;
        drive_occurrence_guest_id: number | null;
        sku: {
          id: number;
          name: string;
          external_id: string | null;
          currency_code: string;
          tenant_id: number;
          type: string | null;
        };
      };
    }[];
  };
  created_at: string;
  created_by: number;
  updated_at: string;
}