UseePay Open API
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
  1. checkout session
  • Integration
    • Welcome to the UseePay Demo Page
    • About Payment Methods
      • Card
      • Apple Pay Web Integration (API Integration)
      • Apple Pay(Hosted Checkout)
      • Google Pay
      • Klarna
      • Naver pay
      • Kakao Pay
      • Toss Pay
      • Payco
      • Affirm
      • Blik
      • trustly
      • Cashapp
    • subscription
      • Get started with Subscription
    • online payment
      • Get started with online payments
    • Payment Capabilities
      • Adaptive Price
      • Supported Payment Methods for Checkout
    • checkout session
      • Checkout Session Guide
  • developer
    • Introduction
    • Authentication
    • Errors
    • error code
      • last_payment_error documentation
    • Best Integration
      • Quickly create a paymentIntent for a subscription
      • Auto-Charge Subscription Guide
    • Payment Intents
      • Payment Intent Overview
      • Quickly create a paymentIntent
      • Create a PaymentIntent
      • Retrieve a PaymentIntent
      • Update a PaymentIntent
      • Confirm a PaymentIntent
      • Cancel a PaymentIntent
      • Capture a PaymentIntent
      • List all payment intents
    • Customers
      • Create a customer
      • Retrieves a customer
      • Update a customer
      • List all customers
    • Subscriptions
      • Create a subscription
      • Retrieves a subscription
      • Update a subscription
      • List all subscriptions
      • Cancel a subscription
    • Invoices
      • Create a invoice
      • Retrieves a invoice
      • List all invoices
      • Pay a invoice
    • Payment Methods
      • Create a payment method
      • Retieve Payment Method Session
      • Retrieves a payment method
      • Update a payment method
      • List all payment methods
    • Mandates
      • Create a mandate
      • Retrieves a mandate
      • List all mandates
    • Refunds
      • Create a refund
      • Retrieves a refund
      • List all refunds
    • Webhooks
      • Webhook events
      • Webhook Activation/Signature Verification Steps
      • Webhook Events Documentation (testing)
      • Create a webhook
      • Retrieves a webhook
      • Update a webhook
      • List all webhooks
    • Embedded Checkout
      • Payment Elements
      • Express Checkout Elements
      • Checkout Session Element
    • case
    • objects
    • About Testing
      • Test Cards
      • ApplePay&GooglePay
    • Payment Method Configuration
      • Retieve Payment Method Configuration
    • Checkout Session
      • Create Checkout Session
      • Retrieve Checkout Session
    • Trackers
      • upload trackers
      • Retrieve a tracker
    • Schemas
      • CheckoutSessionCreateRequest
      • LineItem
      • Customer
      • Address
      • ProductData
      • Shipping
      • SubscriptionData
      • Error
      • DiscountPeriodConfig
      • DeviceData
      • CheckoutSessionResponse
      • ErrorResponse
      • Order
      • Product
      • PaymentMethodOptions
      • RiskControlOptions
      • Mandate
      • PaymentIntent
      • PaymentMethod
      • Billing
      • Card
      • AliPay
      • Wallet
      • Klarna
      • WechatPay
      • Refund
      • Subscription
      • Recurring
      • PriceData
      • SubscriptionItem
      • Invoice
      • NextAction
      • Webhook
      • CollectableOptions
      • PaymentLink
      • last_payment_error
      • discount_period_config
      • CreatePaymentIntentRequest
  • message
    • Messaging Element
  • FAQ
    • Unable to receive Webhook notifications
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
  1. checkout session

Checkout Session Guide

💳 Checkout Session Guide#

📖 Overview#

Checkout Session is a unified payment session object that simplifies the payment integration process. It supports both one-time payments and subscription payments, providing a seamless payment experience for merchants and customers.

✨ Key Features#

🎯 Unified Payment Interface - Single API for both one-time and subscription payments
🔄 Automatic Object Creation - Automatically creates PaymentIntent, Subscription, and Invoice
💰 Flexible Pricing - Support for discount periods, trial periods, and promotional pricing
🔐 Secure Payment Flow - Built-in security with client secrets and session expiration
📊 Real-time Status Tracking - Monitor payment progress through session status
🌍 Multi-currency Support - Accept payments in multiple currencies

APIURL
create sessionhttps://docs-v2.useepay.com/405702890e0
elementhttps://docs-v2.useepay.com/8034530m0

🏗️ Object Relationships#

Payment Mode (One-time Payment)#

Subscription Mode (Recurring Payment)#

Complete Object Relationship Diagram#

📋 Object Relationship Table#

ObjectCreated ByPurposeLifecycle
Checkout SessionMerchant API callPayment session container24 hours (default)
SubscriptionCheckout Session (subscription mode)Recurring billing configurationUntil canceled
InvoiceSubscriptionIndividual billing periodPer period
Payment IntentCheckout Session or InvoiceActual payment executionSingle use

🔄 Status Flow#

Checkout Session Status Flow#

Payment Status Flow#

Combined Status Flow (Session + Payment)#

📊 Status Combinations#

Session StatusPayment StatusDescriptionNext Action
openunpaid🟡 Awaiting paymentCustomer needs to confirm payment
completepaid✅ Payment succeededNo action needed
expiredunpaid⏰ Session expiredCreate new session

🎯 Use Cases#

1️⃣ One-time Payment#

Scenario: Customer purchases a product for $99.99
{
  "mode": "payment",
  "amount": 99.99,
  "currency": "USD",
  "line_items": [...]
}
Flow:
1.
Create Checkout Session
2.
Customer enters payment details
3.
Confirm payment → Creates PaymentIntent
4.
Payment succeeds → Session status: complete

2️⃣ Subscription (No Discount)#

Scenario: Customer subscribes to a monthly plan at $99.99/month
{
  "mode": "subscription",
  "amount": 99.99,
  "currency": "USD",
  "subscription_data": {},
  "collection_method": "auto_charge",
  "line_items": [{
    "price_data": {
      "recurring": {
        "interval": "month",
        "interval_count": 1
      }
    }
  }]
}
Flow:
1.
Create Checkout Session
2.
Confirm payment → Creates:
Subscription (recurring: $99.99/month)
Invoice #1 (amount: $99.99)
PaymentIntent (amount: $99.99)
3.
Payment succeeds → Session status: complete
4.
Future billing: System auto-creates Invoice #2, #3... at $99.99 each month

collection_method is empty (Merchant-managed subscription)#

If collection_method is empty / not provided, it means the merchant maintains the subscription lifecycle by themselves.
In this mode:
1.
Checkout Session is still used as a unified checkout container.
2.
For the initial confirmation, the system still creates objects in order:
Subscription → Invoice → PaymentIntent
3.
The difference is future billing is not automatically triggered by the system.
4.
The merchant triggers renewals when needed:
The merchant creates a new billing period by calling our Invoice API (with subscription_id)
Then calls invoice.pay to charge the customer for that invoice
5.
The merchant is responsible for subscription lifecycle management (schedule, cancel/pause/resume, retries, etc.).

3️⃣ Subscription with Discount Period#

Scenario: First month 0.01,then99.99/month
{
  "mode": "subscription",
  "amount": 99.99,
  "currency": "USD",
  "subscription_data": {
    "discount_period_config": {
      "discount_period_count": 1,
      "discount_period_amount": 0.01
    }
  },
  "collection_method": "auto_charge"
}
Flow:
1.
Create Checkout Session
2.
Confirm payment → Creates:
Subscription (recurring: 99.99/month,discount:1period@0.01)
Invoice #1 (amount: $0.01 - discount period)
PaymentIntent (amount: $0.01)
3.
Payment succeeds → Session status: complete
4.
Month 2+: System auto-creates Invoice #2, #3... at $99.99 each month
Pricing Timeline:

🔐 Security Features#

Client Secret#

Each Checkout Session has a unique client_secret for secure access:
{
  "id": "cs_1A2B3C4D5E6F7G8H",
  "client_secret": "cs_1A2B3C4D5E6F7G8H_secret_abc123"
}
Usage: Pass client_secret when confirming payment to ensure only authorized clients can complete the transaction.

Session Expiration#

Default: 24 hours from creation
Purpose: Prevent stale sessions and reduce security risks
Behavior: Expired sessions cannot be confirmed

📝 API Workflow#

Complete Payment Flow (Sequence Diagram)#

Payment Mode Flow (Flowchart)#


🎨 Best Practices#

✅ DO#

✅ Set appropriate expiration time - Default 24 hours is suitable for most cases
✅ Store session_id - Save it in your database for status tracking
✅ Use metadata - Pass custom data that will be propagated to Subscription/Invoice
✅ Validate amounts - Ensure line_items total matches the session amount
✅ Handle webhooks - Listen for payment status changes asynchronously

❌ DON'T#

❌ Don't reuse expired sessions - Create a new session instead
❌ Don't expose client_secret - Keep it secure on the client side
❌ Don't skip validation - Always validate input before creating sessions
❌ Don't hardcode prices - Use dynamic pricing from your product catalog

🔍 Troubleshooting#

Common Issues#

IssueCauseSolution
❌ "mode required"Missing required fieldInclude mode in request
❌ "amount not equals to item lines"Line items total ≠ amountRecalculate line items total
❌ "subscription_data required"Subscription mode missing configAdd subscription_data object
❌ "Session expired"Session > 24 hours oldCreate new session
❌ "current period start time required"Missing subscription start timeSystem auto-sets (no action needed)

📚 Related Objects#

Quick Reference#

ObjectAPI EndpointPurpose
Checkout Session/v1/checkout/sessionsPayment session management
Payment Intent/v1/payment_intentsExecute individual payments
Subscription/v1/subscriptionsManage recurring billing
Invoice/v1/invoicesIndividual billing periods
Customer/v1/customersCustomer management

💡 Examples#

Minimal One-time Payment#

{
  "mode": "payment",
  "amount": 99.99,
  "currency": "USD",
  "merchant_order_id": "order_123",
  "customer": {
    "email": "customer@example.com",
    "name": "John Doe",
    "merchant_customer_id": "cust_123"
  },
  "line_items": [{
    "quantity": 1,
    "price_data": {
      "product_data": {
        "name": "Premium Product"
      },
      "unit_amount": 99.99
    }
  }],
  "payment_method_types": ["card"]
}

Minimal Subscription#

{
  "mode": "subscription",
  "amount": 99.99,
  "currency": "USD",
  "merchant_order_id": "sub_123",
  "customer": {
    "email": "subscriber@example.com",
    "name": "Jane Smith",
    "merchant_customer_id": "cust_456"
  },
  "line_items": [{
    "quantity": 1,
    "price_data": {
      "product_data": {
        "name": "Monthly Plan"
      },
      "unit_amount": 99.99,
      "recurring": {
        "interval": "month",
        "interval_count": 1
      }
    }
  }],
  "subscription_data": {},
  "collection_method": "auto_charge",
  "payment_method_types": ["card"]
}

🎓 Summary#

Checkout Session is your all-in-one payment solution:
🚀 Simple Integration - One API for all payment types
🔄 Automatic Management - Handles object creation and lifecycle
💰 Flexible Billing - Support for discounts, trials, and promotions
📊 Real-time Tracking - Monitor payment status in real-time
🔐 Enterprise Security - Built-in security features
Start accepting payments in minutes with Checkout Session! 🎉

Modified at 2026-01-27 05:16:28
Previous
Supported Payment Methods for Checkout
Next
Introduction
Built with