Integrate payment collection with orders using your own payment provider or managed payment sessions
Orders and payment collection work together to handle purchases in the Connect API. Orders track what a customer is buying, while payments — collected through your own provider or via managed payment sessions — fulfill the payment requirement before the order can be submitted.
The Connect API gives you full flexibility in how you collect payments. You can use your own payment infrastructure or leverage managed payment sessions depending on your needs.
Your Own Provider (Recommended)
Collect payment through your existing payment stack (Stripe, Adyen, Braintree, etc.) and pass the reference when submitting the order. Full control over the checkout experience, payment methods, and provider relationship.
Hosted Payment Page
Use a managed payment session with hosted: true to get a provider-hosted checkout URL. Redirect customers to a pre-built payment page with no frontend payment UI to build.
Embedded Payment Widget
Use a managed payment session with hosted: false to get provider credentials for rendering a payment form directly in your UI using the provider’s SDK.
Teams with an existing payment infrastructure who want full control over the payment experience, provider selection, and checkout flow
Hosted payment page
Quick integrations where you want a turnkey payment UI without building frontend payment components
Embedded widget
Teams who want a managed payment backend but need to customize the payment UI within their application
Most integrations use the external payment approach because it lets you keep your
existing payment provider, maintain a single payment relationship, and have
complete control over the customer checkout experience.
Collect payment through your existing payment provider (Stripe, Adyen, Braintree, or any other provider). This approach gives you full control over the checkout experience and lets you use your existing payment infrastructure without any additional dependencies.After collecting payment on your side, submit the order with an externalPayment reference:
Copy
Ask AI
// Step 1: Collect payment through your own provider// (This happens in your existing payment flow)// Step 2: Submit the order with the payment referenceconst submitResponse = await fetch( `https://connect.telnesstech.com/api/v2/orders/${orderId}/submit`, { method: "POST", headers: { "X-API-Key": process.env.CONNECT_API_KEY, "Content-Type": "application/json", }, body: JSON.stringify({ externalPayment: { reference: "pi_3ABC123def456", receiptDescription: "Subscription activation payment", receiptUrl: "https://yourapp.com/receipts/abc123", }, }), },);const submittedOrder = await submitResponse.json();console.log("Order state:", submittedOrder.state);
The externalPayment object accepts:
Field
Required
Description
reference
Yes
The payment reference or transaction ID from your provider
receiptDescription
No
A human-readable description of the payment
receiptUrl
No
A URL to the payment receipt or confirmation page
When using external payments, you are responsible for collecting the correct
amount and handling refunds through your payment provider.
If you prefer a managed payment flow, create a payment session with hosted: true to get a checkout URL. Redirect the customer to the provider-hosted payment page.
After the customer completes payment, they are redirected to your returnUrl. Poll the payment session to confirm the status before submitting the order.