QBitFlow Documentation

    Complete guide to integrating cryptocurrency payments with QBitFlow

    Session Checkouts

    Session checkouts are the foundation of accepting payments in QBitFlow. Learn how to create and manage checkout sessions for your customers.

    What is a Session Checkout?

    Payment Session

    A session checkout is a payment session initialized with a unique link that you share with your customer. When a customer wants to make a payment (one-time, subscription, or pay-as-you-go), you create a new session checkout and provide them with the link. The customer then visits this link to complete the payment in their preferred cryptocurrency.

    Creating Session Checkouts

    You can create session checkouts for different types of payments:

    1. One-Time Payment Session

    Create One-Time Payment Session
    Create a session for a single payment
    # Create a payment from an existing product
    response = client.one_time_payments.create_session(
    product_id=1,
    customer_uuid="customer-uuid", # optional
    webhook_url="https://your-domain.com/webhook",
    )
    # Or create a custom payment
    response = client.one_time_payments.create_session(
    product_name="Custom Product",
    description="Product description",
    price=99.99, # USD
    customer_uuid="customer-uuid",
    webhook_url="https://your-domain.com/webhook",
    )
    print(response.uuid) # Session UUID
    print(response.link) # Payment link for customer

    2. Subscription Session

    Create Subscription Session
    Create a session for recurring billing
    response = client.subscriptions.create_session(
    product_id=1,
    frequency=Duration(value=1, unit="months"), # Bill monthly
    trial_period=Duration(value=7, unit="days"), # 7-day trial (optional)
    min_periods=3, # Minimum billing periods (optional)
    webhook_url="https://your-domain.com/webhook",
    customer_uuid="customer-uuid",
    )
    print(response.link) # Send to customer

    3. Pay-As-You-Go Session

    Create Pay-As-You-Go Session
    Create a session for usage-based billing
    response = client.pay_as_you_go.create_session(
    product_id=1,
    frequency=Duration(value=1, unit="months"), # Bill monthly
    free_credits=100, # Initial free credits (optional)
    webhook_url="https://your-domain.com/webhook",
    customer_uuid="customer-uuid",
    )
    print(response.link)

    URL Placeholders

    When creating session checkouts, you can use placeholders in your success and cancel URLs. These placeholders are automatically replaced by QBitFlow when redirecting the customer:

    {{UUID}}

    Replaced with the session UUID. Use this to identify the payment/subscription in your success handler.

    {{TRANSACTION_TYPE}}

    Replaced with the transaction type (e.g., "payment", "createSubscription", "createPAYGSubscription").

    Example URL:

    https://yoursite.com/success?uuid={{UUID}}&type={{TRANSACTION_TYPE}}

    Becomes: https://yoursite.com/success?uuid=01997c89-d0e9-7c9a-9886-fe7709919695&type=payment

    Customer UUID (Optional)

    When creating a session checkout, you can optionally provide a customerUUID:

    ✅ With Customer UUID

    If you provide a customer UUID (matching an existing customer in your QBitFlow account), the payment will be automatically associated with that customer. The customer won't need to fill in their information again.

    📝 Without Customer UUID

    If you don't provide a customer UUID, the customer will be asked to fill in their information (name, email, etc.) during the checkout process. A new customer record will be created automatically if they don't already exist.

    Session Expiration

    Time Limit

    Session checkout links expire after a certain period (typically 24 hours). After expiration, the link will no longer be valid, and you'll need to create a new session for the customer. The expiration timestamp is included in the session creation response.

    Retrieving Session Details

    Get Session Information
    Fetch details about a session checkout
    session = client.one_time_payments.get_session("session-uuid")
    print(session.product_name, session.price)

    💡 Best Practice: Always include both a webhook URL and a success URL when creating sessions. Webhooks provide reliable server-to-server notifications, while success URLs give your customers immediate feedback. Learn more in the section.