POST api/PaymentJS/ProcessTokenizedPayment

Description

Completes or continues a payment using the tokenized card. Called by the client after PaymentJS tokenization (once the webhook has delivered the token). Request: bookingId (or BookingID) and clientToken from AuthorizeSession. Idempotent: may return already-approved, 3DS challenge, or current status without submitting again. Possible outcome categories: validation/resolution errors (e.g. invalid bookingId, session mismatch, tokenization failed); still processing (webhook pending); already approved; 3DS challenge required (challengeUrl, threeDSFormFields); 3DS method form required (threeDSMethodFormHtml); payment approved (redirectUrl, bookingID); payment failed; existing transaction status (e.g. WAITING_3DS). See remarks for full response shapes.

Response shapes

  • Error/validation: { completed: false, error: "..." } or { completed: true, success: false, data: { reason, gatewayReason, clientToken } }.
  • Still processing: { completed: false } (no error; client should retry).
  • Already approved: { completed: true, success: true, data: { orderId, bookingID, bookingHash, redirectUrl, status: "APPROVED", transactionId, message } }.
  • 3DS challenge: { completed: false, challengeRequired: true, challengeUrl, threeDSFormFields, data: { orderId, status: "Pending3DSChallenge", message } }.
  • 3DS method form: { completed: false, threeDSMethodRequired: true, threeDSMethodFormHtml, transactionId, threeDSecureTransId, data: { orderId, status: "Pending3DSMethod", message } }.
  • Payment approved: Same data shape as already approved.
  • Payment failed: { completed: true, success: false, data: { orderId, status: "FAILED", message, reason, gatewayReason } }.
  • Existing transaction status: { completed: bool, success: bool, data: { orderId, status, message } }.
  • Full document: Docs/ProcessTokenizedPayment-Outcomes.md in the solution.

Request

URI parameters

None.

Body

BookingId (or BookingID) and ClientToken. Order is resolved from BookingId; payment tracking must match OrderID and ClientToken.

ProcessTokenizedPaymentRequest
NameDescriptionTypeAdditional information
bookingId

string

None.

clientToken

Required: Client token from the PaymentJS AuthorizeSession response.

string

None.

Sample request

application/json, text/json

Sample:
{
  "bookingId": "sample string 1",
  "clientToken": "sample string 2"
}

Response

Resource description

JSON object with one of many shapes: completed, success, error, data (orderId, bookingID, redirectUrl, status, message), challengeRequired, challengeUrl, threeDSFormFields, threeDSMethodRequired, threeDSMethodFormHtml, etc. Full list in remarks. Always 200 OK.

IHttpActionResult

None.

Sample response

application/json, text/json

Sample:

Sample not available.