Skip to main content

Booking Transaction Processed Trigger

The Booking Transaction Processed trigger starts a workflow when a payment transaction is processed for a booking in your CaptainBook system.

Jerome Bajou avatar
Written by Jerome Bajou
Updated this week

Overview

The Booking Transaction Processed trigger starts a workflow when a payment transaction is processed for a booking in your CaptainBook system.

When It Triggers

  • A payment transaction is successfully processed

  • Refunds are processed

  • Partial payments are completed

  • Transaction status changes to processed

Use Cases

  • Send payment confirmation emails

  • Generate receipts

  • Update accounting systems

  • Process commission payments

  • Notify partners about transactions

  • Track payment analytics

  • Handle refund notifications


Configuration

This trigger requires no additional configuration. It automatically triggers when any booking transaction is processed.


Available Data

When this trigger fires, it provides a transaction object with comprehensive transaction information, plus access to the related booking.

Transaction Object Structure

Basic Information

  • id - Transaction ID

  • booking_id - Related booking ID

  • customer_id - Customer ID

  • amount - Transaction amount

  • currency - Currency code

Payment Details

  • payment_method - Payment method used

  • charge_id - Payment processor charge ID

  • payment_provider_id - Payment provider ID

  • payment_provider_metadata - Provider-specific metadata

  • payment_provider_fee - Provider fees

Financial Information

  • fx_rate - Foreign exchange rate (if applicable)

  • tips - Tips amount

  • origin - Transaction origin

Refund Information

  • refund_for - Original transaction ID (if this is a refund)

  • refund_user_id - User who processed refund

Timestamps

  • created_at - Transaction creation date

  • updated_at - Last update date

  • deleted_at - Deletion date (if soft-deleted)

Booking Context

The trigger also provides access to the related booking through transaction.booking_id. You can use the "Get Booking" action to retrieve full booking details.

Accessing Transaction Data

{transaction.id} 
{transaction.amount}
{transaction.currency}
{transaction.payment_method}
{transaction.charge_id}

Example Workflows

1. Send Payment Confirmation

Workflow Steps:

  1. Trigger: Booking Transaction Processed

  2. Action: Get Booking (using {transaction.booking_id})

  3. Action: Send Notification

    • To: {booking.customer.email}

    • Subject: "Payment Received"

    • Body: Include transaction and booking details

2. Generate Receipt

Workflow Steps:

  1. Trigger: Booking Transaction Processed

  2. Condition: If {transaction.refund_for} is empty (not a refund)

  3. Action (True): Get Booking

  4. Action: Send Webhook (generate receipt PDF)

  5. Action: Send Notification (send receipt url)

3. Update Accounting System

Workflow Steps:

  1. Trigger: Booking Transaction Processed

  2. Action: Get Booking

  3. Action: Get Customer

  4. Action: Send Webhook

    • URL: Accounting system endpoint

    • Payload: Transaction, customer and booking data

4. Process Refund Notification

Workflow Steps:

  1. Trigger: Booking Transaction Processed

  2. Condition: If {transaction.refund_for} is not empty

  3. Action (True): Get Booking

  4. Action: Send Notification (refund confirmation)

5. Commission Calculation

Workflow Steps:

  1. Trigger: Booking Transaction Processed

  2. Action: Get Booking

  3. Condition: If {booking.reseller_id} is not empty

  4. Action (True): Calculate commission

  5. Action: Send Webhook (notify reseller)


Testing

When testing this trigger:

  1. Select a processed transaction from your system

  2. The workflow will use that transaction's data

  3. Review execution logs to see transaction details

Test Data

The trigger provides access to the last 20 processed transactions for testing.


Best Practices

  1. Get booking details - Use "Get Booking" action to access full booking context

  2. Handle refunds - Check refund_for to distinguish payments from refunds

  3. Validate amounts - Verify transaction amounts match expectations

  4. Secure webhooks - Use authentication for external system integrations

  5. Log transactions - Keep records of all processed transactions

  6. Handle errors - Set up error notifications for failed webhooks


Related Documentation

Did this answer your question?