Overview
Payment capture is the final step in the payment process where funds are transferred from the customer to the merchant. Openfront supports automatic payment capture through cart completion and manual capture for invoices.Complete Active Cart
Finalize a cart and capture payment to create an order.GraphQL Mutation
Unique identifier of the cart to complete
Payment session ID for paid orders. Omit for account/customer token orders (Openship flow)
Response
Returns a complete order object:Order unique identifier
Human-readable order number
Order status (“pending” after creation)
Total order amount
Subtotal before tax and shipping
Tax amount
Shipping cost
Secret key for guest order tracking (only for guest orders)
Delivery address details
Payment Flows
ThecompleteActiveCart mutation handles two different payment flows:
1. Paid Orders (Regular Storefront)
- Requires
paymentSessionId - Captures payment through Stripe, PayPal, or manual payment
- Creates payment record with status “captured” or “pending”
- Order is created immediately
2. Account Orders (Openship/Business Accounts)
- No
paymentSessionIdprovided - Requires authenticated user with active business account
- Validates credit limit before creating order
- Adds order to account as unpaid line item
- No immediate payment capture
Example - Complete Cart with Stripe Payment
Payment Status in Orders
When a payment is captured, the following occurs:- Payment record created with status “captured”
- Capture record created linking to the payment
- Order payment status updated to “captured”
- Order event created with type “PAYMENT_CAPTURED”
Complete Invoice Payment
Capture payment for an invoice.GraphQL Mutation
Payment session ID associated with the invoice
Response
Invoice unique identifier
Invoice status after payment
Whether payment was successful
Success or error message
Error details if payment failed
Example
Pay Invoice (Alternative Method)
Pay an invoice with custom payment data.GraphQL Mutation
Invoice unique identifier
Response
Payment success status
Updated invoice object
Created payment record
Result message
Error details if failed
Manual Payment Update
Update payment status directly (requires admin permissions):Payment Status Transitions
Valid payment status values:Payment initiated but not processed
Payment authorized but not captured
Payment successfully captured (triggers automatic capture record creation)
Payment processing failed
Payment canceled
Example - Capture Authorized Payment
- Sets
capturedAttimestamp - Creates a
Capturerecord - Updates order
paymentStatusto “captured” - Creates an order event “PAYMENT_CAPTURED”
Payment Provider Integration
Stripe Payment Capture
Stripe payments are captured automatically incompleteActiveCart:
- Payment intent retrieved from session data
- Payment status checked
- If
requires_capture, payment is captured via Stripe API - Payment record created with status “captured”
PayPal Payment Capture
PayPal payments are verified incompleteActiveCart:
- PayPal order verified via API
- Order status checked (COMPLETED or APPROVED)
- Payment record created with status “captured”
Manual Payments
For cash on delivery or manual payment methods:- Payment record created with status “manual_pending”
- Order created successfully
- Payment can be manually updated to “captured” later
Webhook Handling
Handle payment provider webhooks for asynchronous payment updates:Payment provider identifier
Webhook event data from payment provider
HTTP headers for signature verification