PayFanout API reference
    Preparing search index...

    Implements

    Index
    pspName: "gocardless" = GOCARDLESS_PSP_NAME
    • Cancels whichever stage the id names: a billing request pre-fulfilment (expires its flows), or a payment — GoCardless only cancels pending_submission payments, anything later rejects with invalid_state (cancellation_failed) -> invalid_request, never retried. The caller's key rides the Idempotency-Key header (GoCardless accepts it on POST actions).

      Parameters

      • pspPaymentId: string
      • idempotencyKey: string

      Returns Promise<PaymentInfo>

    • Creates a subscription GoCardless itself bills (POST /subscriptions) against an existing MANDATE — savedPaymentMethodToken is the mandate id (MD...), and GoCardless derives the customer from it, so pspCustomerId is ignored. Cadence is weekly/monthly/yearly only: interval "day" and RRULE schedules reject (invalid_request) instead of approximating. merchantRefNum rides the dedicated name field (max 255 chars; GoCardless also sets it as the description on each payment created) — never payment_reference, which is restricted to accounts with their own Service User Number. startAt maps to the date-only start_date (the instant's stated calendar date); omitted, the first charge lands on the mandate's next_possible_charge_date. planId rejects: GoCardless subscriptions have no plan object.

      Returns Promise<NativeSubscriptionRecord>

    • Side-effect-free credential probe — the engine behind a host "Test connection" button. Makes ONE read-only GET /payments (limit 1) and reads the RAW HTTP status so an auth rejection (401/403) is told apart from an outage (429/5xx) directly from the status line, never from a body that a proxy or edge error page may not carry. A single shot with no transport retry loop: a "Test connection" click cannot hang on backoff, and a bad key is not replayed. Never mutates PSP state, never puts the token in the result.

      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>