PayFanout API reference
    Preparing search index...

    Implements

    Index
    pspName: "payzen" = PAYZEN_PSP_NAME
    • Manual capture = Transaction/Validate: it confirms an AUTHORISED_TO_VALIDATE transaction for capture on its expected date. Transaction/Capture is NOT this operation — it is a Brazil-specific batch WS and must never be used here. Validation releases the full authorized amount; PayZen has no partial validate, so a differing amount is rejected. The required idempotencyKey cannot be delegated — PayZen has no idempotency channel — but replays are naturally safe: validating twice yields a status error, never a duplicate capture.

      Parameters

      • pspPaymentId: string
      • amount: number | undefined
      • _idempotencyKey: string

      Returns Promise<PaymentInfo>

    • PayZen has NO refund idempotency: a replayed Transaction/Refund creates a SECOND credit while the total stays within the original, and the refund request carries no metadata/reference field the adapter could pre-check against (idempotencyKey cannot be delegated OR reliably synthesized). Consequences, deliberately encoded here:

      • refund calls are never transport-retried, and their transport failures surface retryable: false (a lost response may mean the credit exists);
      • hosts must not blind-retry refunds — re-read the payment (amountRefunded) before trying again.

      Partial refunds go to Transaction/Refund (requires a captured source). Full refunds go through Transaction/CancelOrRefund AUTO, which cancels a not-yet-captured transaction instead — the result is mapped honestly (a cancellation releases the authorization; the shopper was never charged, so the refund "succeeded").

      Parameters

      Returns Promise<RefundResult>

    • Accepts either a transaction uuid (32-hex, from webhooks/refunds) or a PayFanout pspSessionId (= the derived orderId): the krypton form creates the transaction in-browser, so right after checkout the host may only hold the orderId. The orderId path reads the order and reports its most recent payment (DEBIT) attempt.

      Parameters

      • pspPaymentId: string

      Returns Promise<PaymentInfo>

    • "Test connection" probe: one single-shot, side-effect-free Charge/SDKTest call — PayZen's purpose-built connection test, which just echoes the submitted value back on valid credentials. Transport retries are disabled so a transient failure surfaces promptly instead of replaying (a "Test connection" click must not hang for multiples of the timeout). PayZen selects TEST vs LIVE by the key set, so the probe body carries no mode. The outcome is classified so a host UI can tell a wrong shopId/password (auth) from a transient outage (network); it resolves on every path instead of throwing, and never surfaces the credential.

      Returns Promise<VerifyCredentialsResult>

    • Webhook handling — same adapter, separate concerns. Both async: future PSPs may need remote key retrieval; the contract stays uniform. MUST operate on the RAW request body bytes/string — re-serializing a parsed body breaks signatures (the conformance suite tests this).

      Parameters

      • rawBody: string
      • headers: Record<string, string>

      Returns Promise<boolean>