The short answer

Before integrating a payment gateway, define who receives the money, when a reservation becomes confirmed, how fees and refunds work, and how the system handles a missed or repeated confirmation.

A marketplace payment is rarely just a customer paying a price. There may be a vendor, a platform commission, a gateway fee, a wallet balance, and a reservation that can be accepted, rejected, or cancelled.

If those decisions are unclear, calling the gateway API faster will not make the money flow correct.

Who receives each part of the payment?

Write the money movement down before designing the endpoints. Is the platform fee added to the vendor’s price or deducted from it? Who covers processing fees? When does the vendor’s balance become available?

A useful specification separates the customer’s charge, the vendor’s entitlement, the platform’s fee, and any processing cost. The exact treatment belongs to the business’s agreed rules.

When is the reservation actually confirmed?

Payment status and reservation status describe different things. The gateway may confirm a charge while the vendor has not accepted the booking. Decide whether that state is allowed and what the customer should see.

  • Does the vendor accept before or after payment?
  • What happens if the vendor rejects or cancels?
  • Which fees are returned during a refund?
  • Which currency and gateway apply to a cross-region reservation?

What happens if confirmation is missed or repeated?

Design the recovery path alongside the successful checkout. A repeated confirmation should not credit the vendor twice. A successful gateway payment with no local update should be discoverable through reconciliation.

The implementation must verify the gateway’s confirmation and make transaction-state updates safe to repeat. Exact mechanisms depend on the provider; the important product decision is what the system considers confirmed and how it repairs a disagreement.

What should be ready before implementation?

A small state diagram, a fee example, a refund example, and a list of failure cases are often more useful than starting with the SDK. Those decisions shape the database, wallet records, APIs, and customer messages.

Business rules → money movement → failure scenarios → reconciliation → gateway integration.

AI can help implement a defined flow. The engineering responsibility still includes understanding which flow the business needs.