Skip to navigation

Link Existing Entities

View as Markdown

Link source-system ids to EXISTING PaymentKit entities (“map, don’t create”).

For a migration into an account that already holds the relevant catalogue or customers (e.g. a shared processor account), record source_id -> existing pk_id mappings so a later subscription load resolves to those entities instead of creating duplicates. Linkable types: product, price, customer, payment_method.

Each link is validated independently — the target must exist and belong to this account, and its type must match. A source id already mapped to the SAME id is a no-op; one mapped to a DIFFERENT id is rejected unless overwrite=true, and even then a mapping a real load wrote is never re-pointed (only a prior link is).

Returns 200 with per-link results (in request order, 1:1) whenever the request is well-formed — INSPECT results for rejected links; the HTTP status is not the outcome. Only a malformed body (empty/oversized links, bad shape) is a 4xx.

Idempotent and safe to retry: re-sending the same links yields noop for the ones already recorded. Valid links commit together; rejected links write nothing.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

migration_idstringRequired

Migration ID (e.g., mig_dev_abc123)

account_idstringRequired

Headers

Idempotency-Keystring or nullOptional>=8 characters
A unique key for this request. A retry with the same key returns the first response instead of running again, for 24 hours. Keys are per caller.

Request

This endpoint expects an object.
overwritebooleanOptionalDefaults to false

When true, a source id already mapped to a DIFFERENT PaymentKit id is re-pointed instead of rejected — but ONLY when the existing mapping was itself a link; a mapping written by a real load is never overwritten, with or without this flag.

Response

Successful Response
resultslist of objects

One result per input link, in request order (1:1 positional).

linkedinteger

Count of newly written or re-pointed mappings

noopinteger
Count already mapped to the same PaymentKit id
rejectedinteger

Count rejected (see each result’s reason)

Errors

422
Unprocessable Entity Error