View as Markdown

llms.txt

The API reference isn't available right now

This instance couldn't load its API specification. The reference returns as soon as the specification is readable again.

Back to the API reference

No such operation

This instance documents no operation under that identifier. It may have been renamed, or it may belong to a feature this installation hasn't enabled.

Back to the API reference

This reference may be out of date

This instance couldn't reach its API specification on the last attempt, so this page shows the copy fetched before that. Anything added or changed since then is missing here, and the reference updates itself as soon as the specification is readable again. Last fetched 2026-10-22 22:09 UTC.

API reference Tokens

Creates a reusable token from the payment method a previous transaction stored.

POST /api/tokens/create-from-transaction-async deprecated

No permission required.

This is the tokenize-after-the-fact path, for a card or check already charged. The transaction is read within `merchantId` only: one belonging to another merchant is reported as not found. The resulting token charges like any other, so supply its public reference as `TokenData.Token`. No card number or full account number crosses the wire in either direction: the request carries only identifiers, and the response carries the token handles plus masked and last-four values. A transaction that stored no reusable payment method is refused with a coded business error. `customerId` is accepted so callers can pass the customer they intend to attach the token to, but it is not stored on the token itself.

Signed in, you can send this request to your own sandbox merchant from the console and read the answer. Sign in to try it.

Example request

Every block below sends the same request. Replace {{BASE_URL}} with the address of the API you are calling and {{API_KEY}} with your own key.

The request body is a . See the Request body section below for its fields.

Code sample language

cURL

curl -X POST "{{BASE_URL}}/api/tokens/create-from-transaction-async" \
  -H "api-key: {{API_KEY}}"

PowerShell

$headers = @{
    'api-key' = '{{API_KEY}}'
}

$response = Invoke-RestMethod -Method POST -Uri '{{BASE_URL}}/api/tokens/create-from-transaction-async' `
    -Headers $headers

npm install @winkpg/winkpg-api

TypeScript (SDK)

import { Configuration, TokensApi } from '@winkpg/winkpg-api';

const api = new TokensApi(new Configuration({
  basePath: '{{BASE_URL}}',
  apiKey: '{{API_KEY}}',
}));

const { data } = await api.tokensCreateFromTransaction();

TypeScript (raw HTTP)

const response = await fetch('{{BASE_URL}}/api/tokens/create-from-transaction-async', {
  method: 'POST',
  headers: {
    "api-key": "{{API_KEY}}",
  },
});

const data = await response.json();

dotnet add package WinkPg.Api.Client

C# (SDK)

using WinkPg.Api.Client.Api;
using WinkPg.Api.Client.Client;

var config = new Configuration { BasePath = "{{BASE_URL}}" };
config.AddApiKey("api-key", "{{API_KEY}}");

var api = new TokensApi(config);
var result = await api.TokensCreateFromTransactionAsync();

C# (raw HTTP)

using var http = new HttpClient { BaseAddress = new Uri("{{BASE_URL}}") };

var request = new HttpRequestMessage(new HttpMethod("POST"), "/api/tokens/create-from-transaction-async");
request.Headers.Add("api-key", "{{API_KEY}}");

var response = await http.SendAsync(request);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();

pip install winkpg-api

Python (SDK)

import winkpg_api

configuration = winkpg_api.Configuration(host="{{BASE_URL}}")
configuration.api_key["ApiKey"] = "{{API_KEY}}"

with winkpg_api.ApiClient(configuration) as client:
    api = winkpg_api.TokensApi(client)
    result = api.tokens_create_from_transaction()

pip install requests

Python (raw HTTP)

import requests

headers = {
    "api-key": "{{API_KEY}}",
}

response = requests.request(
    "POST",
    "{{BASE_URL}}/api/tokens/create-from-transaction-async",
    headers=headers,
)
response.raise_for_status()
data = response.json()

Parameters

Name In Type Description
transactionId required query string (uuid) The prior transaction to mint the token from.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
merchantId required query string (uuid) The owning merchant. Must be within the caller's scope, and the transaction must belong to it.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
customerId required query string (uuid) Optional customer the caller intends to attach the token to. Not stored on the token.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
suppressNulls required query boolean If true, omit properties with null values.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

Request body

application/json , required

Field Type Description

This request body has no documented fields.

Responses

200 OK

Body: CreateStandaloneTokenResponseDto CreateStandaloneTokenResponseDto Each item has these fields.

Field Type Description
id required string (uuid) The internal vault record id of the minted token. Deprecated for external use: charge with `publicReference` instead.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
numericToken required integer (int64) Legacy numeric form of the token, retained for existing internal callers and back-compat. Not the preferred external handle: use `publicReference`. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
cardFormatToken required string Legacy card-format (PAN-shaped) form of the token, retained for existing internal callers and back-compat. Not the preferred external handle: use `publicReference`. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
publicReference required string The chargeable public reference of the minted token (the opaque `pt_`-prefixed handle). nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
maskedPaymentDetails required PaymentDetailSnapshot PaymentDetailSnapshot
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

Fields of PaymentDetailSnapshot:

Field Type Description
cardData required CardData CardData Conditional: When CardData is not null.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
checkData required CheckData CheckData Conditional: When CheckData is not null.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
tokenData required TokenData TokenData Conditional: When TokenData is not null.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
processorTokens required array of StoredProcessorToken array of StoredProcessorToken Processor-issued reusable tokens (e.g. TSYS `RequestToken`) captured at auth time and stored alongside the card. Keyed by processor + processor profile; a repeat sale prefers a matching token at the rail and falls back to the PAN. An empty list when no processor token is held. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
networkToken required StoredNetworkToken StoredNetworkToken A stored network token (DPAN) for this payment method. Not populated: network-token acquisition is not yet supported, so this is always absent.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
paymentMethodType required TokenPaymentMethodType TokenPaymentMethodType read only
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
Unknown Not classified.
Card A card, keyed or read.
Check A bank account debited over ACH, or a check.
DigitalWallet A digital wallet (Apple Pay, Google Pay, Paze), which rides the card networks.
AlternativePayment An alternative payment method approved inside a provider and presented as an approval reference.

This body has no documented fields.

type required TokenType TokenType Defines the supported token types used in transaction-related models. Also aliased as the platform's payment-method category (`InitializeContext` imports it as `PaymentMethodCategory`), which is what the processor-profile pre-filter narrows on.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
Card A card, keyed or read.
Check A bank account debited over ACH, or a check.
Cash Cash, which carries no instrument block of its own.
DigitalWallet A digital wallet (Apple Pay, Google Pay, Paze), which rides the card networks.
AlternativePayment An alternative payment method approved inside a provider (PayPal, Venmo, Pay Later, Affirm, Klarna, Afterpay) and presented to the gateway as an approval reference.
category required TokenCategory TokenCategory Defines the category of a token used in transaction processing.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
Internal
Network
Wallet
idempotencyStatus required StandaloneTokenCreateIdempotencyStatus StandaloneTokenCreateIdempotencyStatus What create idempotency did to the request that produced this response.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
NotRequested The request carried no idempotencyKey, so there was nothing to deduplicate. A repeat send mints a second token for the same card.
KeyAccepted The request carried an idempotencyKey and this request claimed it. This is the original create; a repeat send of the same request inside the deduplication window returns this token instead of minting another.
Replayed The idempotencyKey matched a create that had already produced a token for this merchant and credential, so nothing was minted. The response body is that original token exactly as it stands, with its original identifiers and public reference.

This response has no documented body fields.

403 Forbidden

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

401 Unauthorized

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

400 Bad Request

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

404 Not Found

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

501 Not Implemented

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

500 Internal Server Error

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

default The request failed. The body carries the standard error envelope: a machine-readable `error.code`, a human-readable `error.message`, and `error.validationErrors` when the failure was a validation rejection. The error reference lists the values `error.code` can take. The request failed. The body carries the standard error envelope: a machine-readable `error.code`, a human-readable `error.message`, and `error.validationErrors` when the failure was a validation rejection. The error reference lists the values `error.code` can take.

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

429 The request was refused because a rate limit was exceeded, or because something a later retry can clear stopped it. A rate limit refusal carries an `application/problem+json` body: wait at least the interval `Retry-After` names before retrying, then back off. Limits are tuned per deployment, so read the allowance from the response headers rather than assuming a fixed ceiling. Any other refusal carries the standard error envelope as `application/json`, and its `error.code` names the cause.

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

Errors

A failed request returns the platform error envelope. The error reference lists every value error.code can carry and shows the four response shapes.

Codes declared by

Authentication

    Reconnecting to the server

    Could not reconnect

    This session has ended

    Attempt 1

    Your work on this page is still here. Retrying keeps it; reloading starts the page again.

    The server no longer holds this page's state, so it has to be loaded again.