Skip to content

Accept Testimony Offer

Confirm payment and accept a testimony offer after successful Stripe checkout. This endpoint completes the acceptance process by validating the Stripe payment session and transitioning the testimony to the "accepted" state.

See Payment Integration for the complete payment integration guide.

Payment Flow

The complete offer acceptance flow involves three steps:

  1. Initiate Checkout - Call Checkout Offer to get a Stripe checkout URL
  2. Complete Payment - Redirect user to Stripe where they complete payment
  3. Confirm Acceptance - Call this endpoint with the session ID returned from Stripe

After successful confirmation, the testimony transitions from offered to accepted state.

HTTP Request

POST /api/v1/testimonies/offers/accept

Note: This endpoint does NOT include an offer ID in the URL. The offer is identified from the Stripe session.

Parameters

ParameterDescription
sessionId stringThe Stripe checkout session ID returned after successful payment.

Request Example

json
{
  "sessionId": "cs_test_a1B2c3D4e5F6g7H8i9J0k1L2m3N4o5P6q7R8s9T0"
}

Response

204 No Content

Indicates the offer was successfully accepted and the testimony has transitioned to the "accepted" state.

Error Handling

Validation Errors

422 Unprocessable Content

json
{
  "type": "about:blank",
  "title": "Unprocessable Content",
  "status": 422,
  "detail": "Invalid session ID or payment not completed.",
  "errors": {
    "sessionId": [
      "Invalid session ID or payment not completed."
    ]
  }
}

Returned when:

  • Session ID is missing or invalid
  • Payment was not completed successfully
  • Session has already been used
  • Session does not belong to the authenticated user
  • Offer is no longer available

System Errors

500 Internal Server Error

json
{
  "type": "about:blank",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "An unexpected error occurred."
}

Returned when the system cannot process the acceptance due to an internal error.

Authentication

Requires authentication via Bearer token.

401 Unauthorized

json
{
  "message": "Unauthenticated."
}

Business Logic

  • The offer can only be accepted if the testimony is in offered state
  • After successful acceptance:
    • The testimony transitions to accepted state
    • The offer is marked as accepted
    • The expert is notified
    • Payment is processed through Stripe
    • Commission is calculated and transferred