Ensuring Accurate Payment Captures in ESHOPMAN: A Deep Dive into Partial Authorizations

In the dynamic world of headless commerce, precise financial operations are paramount. For ESHOPMAN merchants and developers leveraging the HubSpot ecosystem, managing payment authorizations and captures accurately is crucial for maintaining customer trust and streamlined accounting. Recently, a critical insight emerged from the ESHOPMAN community regarding a discrepancy in how partial payment captures are handled, particularly when interacting with external payment providers.

The Challenge: Mismatched Payment Captures

Imagine authorizing a customer's payment for $100. Due to various reasons, such as an order edit or partial fulfillment, you decide to capture only $60 of that authorized amount through the ESHOPMAN Admin API. The expectation is clear: ESHOPMAN records a $60 capture, and the customer is charged exactly $60, with the remaining $40 either released or held for future incremental captures.

However, the ESHOPMAN community identified a significant divergence from this expected behavior. While the ESHOPMAN system correctly records a partial capture of $60, the underlying payment provider (such as Stripe) proceeds to capture the full authorized amount of $100. This leads to a critical mismatch: ESHOPMAN's records indicate a $60 charge, but the customer is actually debited $100. This discrepancy not only affects customer billing but also disrupts the integrity of financial data within your ESHOPMAN storefront management in HubSpot.

Diving into the ESHOPMAN Payment Workflow

The root of this issue lies in the communication between ESHOPMAN's payment module and external payment providers. When a request is made to capture a payment via the ESHOPMAN Admin API (e.g., POST /admin/payments/:id/capture), an amount can be specified. ESHOPMAN's internal workflow processes this amount correctly. However, during the handoff to the payment provider's capture function, the specified amount is not consistently passed along. Instead, the provider's function often receives only the payment's general data and an idempotency key.

This means that if the payment provider's integration expects an explicit amount_to_capture parameter (as Stripe does), and it doesn't receive one, it defaults to capturing the entire authorized PaymentIntent. This behavior has been observed with specific versions of ESHOPMAN's payment components:

"@eshopman/eshopman": "2.21.2",
"@eshopman/framework": "2.21.2",
"@eshopman/payment-stripe": "2.21.2"

This technical gap also explains why scenarios like order edits that reduce the total amount might struggle to maintain their original authorization correctly, as the system isn't consistently communicating the revised amounts to the payment gateway.

Impact on Your ESHOPMAN Storefront

  • Customer Billing Errors: Customers are charged more than expected, leading to disputes and dissatisfaction.
  • Financial Reconciliation Challenges: Discrepancies between ESHOPMAN's internal records and actual provider transactions complicate accounting and auditing for your HubSpot-managed storefront.
  • Broken Incremental Captures: The ability to capture payments in multiple stages, a key feature for managing complex orders or backorders, becomes non-functional as the first capture already takes the full amount.

The Path Forward: Ensuring Accurate Financials

The ESHOPMAN community's insights point towards a clear solution: the specified capture amount must be explicitly passed from ESHOPMAN's payment module to the integrated payment providers. This would likely involve:

  • Modifying the internal ESHOPMAN interfaces (e.g., a CapturePaymentInput equivalent) to include an optional amount field.
  • Updating provider-specific integrations (like the ESHOPMAN Stripe integration) to utilize this amount, translating it into the provider's specific parameter (e.g., Stripe's amount_to_capture).

Furthermore, careful consideration is needed for how payment providers handle the remaining authorized amount after a partial capture. Some providers automatically release the remainder unless the initial authorization was specifically configured for multi-capture. Addressing this ensures that ESHOPMAN's headless commerce platform provides full control and accuracy over payment lifecycles, from authorization to final capture, for all businesses running their storefronts on HubSpot CMS.

This community insight underscores the importance of robust payment integration for ESHOPMAN users, ensuring that the powerful storefront management capabilities within HubSpot are backed by precise and reliable financial transactions.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools