Inbound vault routes and the CVV alias charge
Post your existing payment form through an inbound vault route so card numbers, CVVs, and bank account numbers never reach your server, then charge the vaulted card with its short-lived CVV alias.
An inbound vault route sits between your card form and your server. Your form keeps posting the request it posts today, with the same path, headers, authorization, and body. Only the base address changes: the form posts to the route's capture address on WinkPG instead of to your server. WinkPG stores the card number in your vault, replaces it with a payment token reference, replaces the CVV with a short-lived alias, and forwards everything else to your server, signed.
Your server never receives a card number or a CVV. It receives a pt_ token reference it can charge, and a cva_ alias it sends beside that reference to charge the card with its CVV while the alias lives.
| What your card form sends | What your server receives |
|---|---|
| The card number | The token's pt_ reference |
| The CVV | A cva_ alias that lives for the route's alias lifetime |
| Every other field | The same field, byte for byte |
| Your path, query string, and headers | The same path, query string, and headers, plus two signature headers |
When to use a vault route
WinkPG offers three ways to keep card data off your own systems. Pick by how much of your checkout you want to keep.
| Path | You keep | WinkPG renders |
|---|---|---|
| Hosted payment page | Nothing on the payment step | The whole payment page |
| Embedded payments SDK | Your page, around a card field | The card field, inside your page |
| Inbound vault route | Your page, your card form, and your server's request shape | Nothing. It sits on the network path |
Use a vault route when your checkout already posts card data to your own server and you want to take that server out of card data scope with a base address change. Use the hosted payment page or the SDK when you're building the payment step from scratch.
An inbound vault route only captures. No endpoint returns a card number or a CVV to you. You charge the card through WinkPG, as the rest of this guide shows. If your gateway has no processor connection on WinkPG, an outbound vault route sends the stored card to that gateway from your server's own request.
Before you start
- Vault routes are turned on for your account. While they're off, every route operation and every capture answers
404. - An API key bound to your merchant. The examples send it in an
api-keyheader asYOUR_API_KEY. A key restricted to scopes needsvault:routesfor every route operation, reads included,transactions:writeto charge, andtransactions:refundfor a refund, void, reversal, or capture. A key holdingadminalso reaches every route operation. A key with no scope restriction reaches all of them. - The base address of your WinkPG deployment. The examples use
https://your-gateway-host. - A server that accepts JSON over HTTPS on a public DNS name.
Set up a route
Create the route with POST /api/vault-proxy/routes. The filters tell the route where each card field sits in your request body and what to do with it.
curl -X POST "https://your-gateway-host/api/vault-proxy/routes" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"kind": "Inbound",
"merchantId": "YOUR_MERCHANT_ID",
"name": "Guest checkout",
"upstreamBaseUrl": "https://api.example.com/v2",
"allowedOrigins": ["https://checkout.example.com"],
"allowNativeClients": false,
"enrichmentEnabled": true,
"cvvAliasTimeToLiveMinutes": 60,
"filters": [
{ "path": "card.cardNumber", "classifier": "CardNumber", "action": "Vault" },
{ "path": "card.cvv", "classifier": "Cvv", "action": "VolatileAlias" },
{ "path": "card.expiryMonth", "classifier": "ExpirationMonth", "action": "Keep" },
{ "path": "card.expiryYear", "classifier": "ExpirationYear", "action": "Keep" },
{ "path": "card.nameOnCard", "classifier": "NameOnCard", "action": "Keep" }
]
}'
The response is the route. Three of its fields are the ones you use next:
| Field | Meaning |
|---|---|
publicId |
vr_ followed by 24 characters. The only route identifier in a capture address |
capturePath |
The path your card form posts to on your WinkPG host, before your own path |
signingSecret |
The key your server verifies each forwarded request with. Returned on this response only |
Store the signing secret where your server can read it. A later read of the route returns null for it. To replace it, call POST /api/vault-proxy/routes/{id}/rotate-signing-secret: the new secret is returned once and signs every request from then on, so update your server's copy before your next capture.
Route fields
| Field | Rule |
|---|---|
kind |
Inbound. |
merchantId |
The merchant that owns the route. Captured cards go into this merchant's vault. Required, and fixed once the route exists. |
upstreamBaseUrl |
Your server. An absolute https address with a DNS host name. An IP address, localhost, and hosts that WinkPG serves are refused. No query string or fragment. |
allowedOrigins |
Exact origins a browser may post from: scheme, host, and an optional port, with no path. https only, no wildcards, up to 20. |
allowNativeClients |
Turn on to accept requests that carry no Origin header, such as a native mobile app. Off by default. |
requireBotChallenge |
Turn on to refuse a request that doesn't carry a valid bot challenge token. Inbound routes only. Off by default. On an update, leaving it out keeps the route's current value. See Require a bot challenge. |
filters |
Where each card or bank account field is in your body and what the route does with it. A route needs a CardNumber filter, an AccountNumber filter, or both, and at most one filter of each classifier. |
enrichmentEnabled |
Turn on to write the details of the captured card or bank account beside the reference. |
cvvAliasTimeToLiveMinutes |
How long a CVV alias lives: 1 to 60 minutes. Defaults to 15. |
maxBodyBytes |
The largest body the route accepts: 1,024 to 1,048,576 bytes. Defaults to 65,536. |
upstreamTimeoutSeconds |
How long WinkPG waits for your server: 1 to 30 seconds. Defaults to 10. |
Filters
A filter path names one value in your JSON body: property names joined by dots, each optionally followed by array indexes, and ending on a property name. card.cardNumber matches {"card": {"cardNumber": "..."}}, and payment.cards[0].number matches {"payment": {"cards": [{"number": "..."}]}}.
Property names match without regard to case, so card.expiryYear matches expiryYear, ExpiryYear, and EXPIRYYEAR. If one object holds two properties whose names differ only by case, the route can't tell which one your server reads, and refuses the request.
| Classifier | Allowed actions | What happens |
|---|---|---|
CardNumber |
Vault |
The card number is stored in your vault and replaced with the token's pt_ reference |
Cvv |
VolatileAlias, Strip |
VolatileAlias replaces the CVV with a cva_ alias. Strip removes the property. A CVV is never kept or stored |
ExpirationMonth, ExpirationYear, ExpirationDate |
Keep, Strip |
The value is written onto the token, and either forwarded or removed |
NameOnCard |
Keep, Strip |
The name is written onto the token, and either forwarded or removed |
AccountNumber |
Vault |
The bank account number is stored in your vault and replaced with the token's pt_ reference |
RoutingNumber, AccountType, NameOnCheck |
Keep, Strip |
The value is written onto the token, and either forwarded or removed |
Every filter names both a classifier and an action. A create or update that sends a filter missing either one is refused with HTTP 400, and the validation error names the missing field. The route management error codes are in the error reference at /docs/errors, under the VaultProxy prefix.
Post a card through the route
Point your card form at the capture address: your WinkPG host, then the route's capturePath, then the path your form posts to today.
Before: POST https://api.example.com/v2/checkout/card?session=abc
After: POST https://your-gateway-host/api/vault-proxy/inbound/vr_YOUR_ROUTE_ID/checkout/card?session=abc
WinkPG forwards that request to https://api.example.com/v2/checkout/card?session=abc.
This request posts the published sandbox Visa debit test card the way a browser on the allowed origin would:
curl -X POST "https://your-gateway-host/api/vault-proxy/inbound/vr_YOUR_ROUTE_ID/checkout/card?session=abc" \
-H "Origin: https://checkout.example.com" \
-H "Content-Type: application/json" \
-d '{
"orderId": "order-1042",
"card": {
"cardNumber": "4002 9600 0111 1116",
"cvv": "123",
"expiryMonth": "12",
"expiryYear": "2030",
"nameOnCard": "Jane Doe"
}
}'
Your server receives the same request with the card number and the CVV replaced, and the enrichment fields written beside the reference:
{
"orderId": "order-1042",
"card": {
"cardNumber": "pt_EXAMPLE00000000000000001","cardLastFour":"1116","cardBrand":"Visa","cardBin":"400296","cardPanLength":16,"cardReferenceIsNew":true,
"cvv": "cva_EXAMPLE00000000000000001",
"expiryMonth": "12",
"expiryYear": "2030",
"nameOnCard": "Jane Doe"
}
}
The route edits the body in place rather than rebuilding it, so every byte it doesn't replace reaches your server exactly as the browser sent it, whitespace included. That's why the enrichment fields sit on the same line as the reference.
What your server answers goes back to the card form unchanged: its status, its headers, and its body.
What the route accepts
POST,PUT, andPATCHare captured. A request with any other method is never forwarded.- The body must be JSON:
application/json, or a media type ending in+json. An empty body is forwarded unchanged. - A card number must be 13 to 19 digits that pass the Luhn check. Spaces and dashes between digits are allowed. A CVV must be 3 or 4 digits.
- A body with no card number at the card number path and no bank account number at the account number path is forwarded with no vaulting.
- Any value outside the card number path that looks like a card number is refused, and nothing is forwarded. This check runs on every request, including one with no card at the card number path.
- A path that contains a
.or..segment, or an encoded slash or backslash, is refused.
Enrichment fields
With enrichment on, the route writes fields beside the reference, in the same object. A capture writes the fields for what it captured, and no others.
For a card, the route writes five fields:
| Field | Type | Holds |
|---|---|---|
cardLastFour |
string | The last four digits |
cardBrand |
string or null |
The card brand from the BIN lookup, or null when the BIN isn't recognized |
cardBin |
string | The first six digits |
cardPanLength |
number | How many digits the card number has |
cardReferenceIsNew |
boolean | true when this capture vaulted the card as a new token; false when the card matched a token already in your vault |
For a bank account, the route writes four fields:
| Field | Type | Holds |
|---|---|---|
accountLastFour |
string or null |
The last four digits of the account number, or null when the account number has four digits or fewer, because they'd be the whole number |
routingLastFour |
string | The last four digits of the routing number |
vaultedAccountType |
string | Checking or Savings: the type on the token, which is Checking when neither the capture nor the token names one |
accountReferenceIsNew |
boolean | true when this capture vaulted the account as a new token; false when the account matched a token already in your vault |
If your body already has a property with one of these names in that object, its value is replaced. Read these fields when your server needs the last four or the brand: WinkPG doesn't issue a format-preserving card alias, a value shaped like a card number that keeps the real first six and last four digits, because every log scanner and redaction control treats such a value as a card number.
Read cardReferenceIsNew or accountReferenceIsNew before you remove a token after a one-time purchase. Remove the token only when the capture that returned it reported true, on a route with enrichment on:
falsemeans the token was already in your vault, and it can be a payment method another customer saved. Keep the token.truedescribes that capture only. A later post of the same card or account reportsfalsewith the same reference, even when the first post reportedtrue, so a retry after a decline doesn't change the first answer.- On a route with enrichment off, WinkPG doesn't write or replace this field, so any value your server receives there came from the caller. Don't act on it.
- A token reported
truecan gain a second use before you remove it. Another capture of the same card or account in that window gets the same reference withfalse, and removing the token ends that use too. Remove the token as soon as the purchase finishes, and ask for the payment method again if a charge on a saved reference fails because the token is gone.
The same card again, and a different card
A card that's already in your vault returns the same pt_ reference. Every capture returns a new cva_ alias. So when a cardholder corrects a CVV after a decline and posts the form again, your server receives the same reference and a new alias. On a route that requires a bot challenge, that second post needs a new token. A different card returns a different reference.
The same card posted through routes that belong to two different merchants gets a separate token in each merchant's vault. If a capture carries a new expiration date or cardholder name for a card that's already in your vault, the stored token is updated. A capture that's refused, for example because the CVV alias can't be stored, leaves the stored token as it was. If the update itself can't be saved, the capture still goes through with the same reference and the token keeps its earlier values; the next capture of the card tries the update again.
Capture a bank account
Add an AccountNumber filter and a RoutingNumber filter to a route. AccountType and NameOnCheck are optional. A route with both card and bank account filters takes either one in a request, and refuses a request that holds both.
{
"filters": [
{ "path": "bank.accountNumber", "classifier": "AccountNumber", "action": "Vault" },
{ "path": "bank.routingNumber", "classifier": "RoutingNumber", "action": "Keep" },
{ "path": "bank.accountType", "classifier": "AccountType", "action": "Keep" },
{ "path": "bank.accountName", "classifier": "NameOnCheck", "action": "Keep" }
]
}
An AccountNumber filter needs a RoutingNumber filter, and a RoutingNumber, AccountType, or NameOnCheck filter needs an AccountNumber filter.
- An account number must be 1 to 17 digits.
- A routing number must be nine digits that pass the ABA checksum.
- An account type must be
CheckingorSavings, in any case. - A value that fails one of these checks is refused before anything is vaulted or forwarded.
- A name that can't be read is forwarded as the route says but isn't written onto the token.
The check for an unvaulted card number can't recognize a bank account number, because an account number has no format of its own. Add a filter for every property that holds one, and post a test body through the route to confirm what your server receives.
An account that's already in your vault returns the same pt_ reference. The match is on the account number and the routing number together, so the same account number at another bank is another account. The same account posted through routes that belong to two different merchants gets a separate token in each merchant's vault. If a capture carries a new name or account type for an account that's already in your vault, the stored token is updated.
Charge a captured account with its pt_ reference as tokenData.token, through POST /api/transactions. There's no alias to send.
Charge the card with its CVV alias
Your server charges a captured card through the ordinary transaction create, POST /api/transactions. Send the pt_ reference as the token and the cva_ alias in cvvAlias. WinkPG supplies the CVV to the processor with the card, so your request carries neither the card number nor the CVV.
curl -X POST "https://your-gateway-host/api/transactions" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"transactionType": "Sale",
"idempotencyKey": "order-1042-attempt-1",
"tokenData": {
"token": "pt_YOUR_TOKEN_REFERENCE"
},
"cvvAlias": "cva_YOUR_CVV_ALIAS",
"invoiceData": {
"amounts": { "base": 25.00 }
}
}'
- Use an API key bound to the merchant the route belongs to, with the
transactions:writescope. The key's merchant is used when you omitmerchantId. tokenData.tokenmust be thept_reference the same capture returned. Another form of the same token is refused.- Don't send a CVV in
cardDatatogether withcvvAlias. You can still sendcardDatawith a billing address for address verification. - The card must belong to the merchant directly. A card your merchant reaches only through reseller token sharing can't be charged with an alias.
The response is the usual transaction. Branch on responseData.resultCode, the same as for any other charge.
A decline is a result, not an error
When the issuer declines, the create still succeeds at the HTTP level and returns a declined transaction. The CVV check result is in responseData.processorResponseDetail.cvResponse.
{
"id": "6f3b2c18-0a4d-4a9e-9d4f-2b71c2f0a911",
"transactionType": "Sale",
"responseData": {
"resultCode": "Decline"
}
}
Return the decline to your card form the way you do today, so the cardholder can correct the card and post again.
Retry without charging twice
A guest checkout retries in one of two shapes, and each takes a different request.
| What happened | What you send |
|---|---|
| Your create timed out or the connection dropped, so you don't know whether the card was charged | The same request again: the same pt_ reference, the same cva_ alias, and the same idempotencyKey |
| The issuer declined, and the cardholder corrected the CVV or entered another card | A new create with the reference and the new alias from the new capture, and a new idempotencyKey |
The same alias works again until it expires, which is what makes the first retry possible. The same idempotencyKey is what makes it safe: the card is charged once, where deduplication is enabled for your merchant. Read the transaction back if the retry also fails to answer, as you would for any timed-out charge.
The second shape needs a new alias because the cardholder entered a new CVV. If they entered the same card, the reference is the same one you already hold. If they entered a different card, it's a different reference.
When the alias can't be used
When the alias can't be used, nothing is charged and the create answers with one of these codes:
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 409 | Transactions:CvvAliasInvalid |
The alias expired, is unknown, or belongs to a different card or merchant, or your merchant reaches the card only through reseller token sharing | For an expired or mismatched alias, ask the cardholder to enter the CVV again. The new capture returns a new alias. A shared card is refused with any alias, so charge it from the merchant that owns it |
| 400 | Transactions:CvvAliasRequiresPublicTokenReference |
tokenData.token isn't the card's pt_ reference, or the request is a force, repeat sale, or unlinked return, which don't take an alias |
Send the pt_ reference the capture returned, on a sale or an authorization |
| 429 | Transactions:CvvAliasStoreUnavailable |
The alias couldn't be checked right now | Retry with the same alias and the same idempotencyKey |
| 403 | Transactions:CvvAliasNotSupported |
Vault routes aren't turned on for your merchant | Ask your WinkPG contact to turn vault routes on |
A cvvAlias that isn't shaped like an alias, one sent without a token, or one sent with a CVV is refused with a validation error before anything else happens.
Later charges on the same card
The pt_ reference is a stored payment method. Once the alias has expired, charge the card again without one: send the reference in tokenData.token and leave cvvAlias out, exactly as Reusing a stored payment method with payment tokens describes. That guide also covers declaring whether the customer is present for each charge, which applies to a captured card like any other.
Refunds, voids, reversals, and captures don't take an alias. They run through the transaction operations endpoint like any other transaction's, with a key that carries the transactions:refund scope:
curl -X POST \
"https://your-gateway-host/api/transactions/by-merchant/YOUR_MERCHANT_ID/{transactionId}/operations" \
-H "api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operationType": "Refund",
"amount": 5.00,
"reason": "Returned one item"
}'
Read Refunds, voids, and reversals for which operation a transaction accepts at each point in its lifecycle.
What cvvSource reads on a later transaction
Every transaction you read back carries cvvSource: StoredCardAlias when WinkPG supplied the CVV for a cvvAlias, Provided when the request carried the CVV, and null when the charge sent none. WinkPG sets it once, from the request that creates the transaction, and never copies it from an original:
- A void, a reversal, a capture, or an adjustment changes the original transaction in place, so the original's
cvvSourcestays as it was. - A refund, a repeat, or a retry sent to the operations endpoint is a new transaction built from the original's stored details. Those never include the CVV, so it reads
null, even when the original readsStoredCardAlias. - A refund or a repeat sale sent to the transaction create endpoint records what that request carried.
- A recurring billing charge, and an invoice charged automatically to a stored card, read
null.
To see how a card was first charged, read the original transaction.
Verify the signature on your server
Every request the route forwards carries two headers:
| Header | Value |
|---|---|
X-WinkPG-Vault-Timestamp |
The time WinkPG signed the request, in Unix seconds |
X-WinkPG-Vault-Signature |
v1=sha256: followed by a lowercase hex HMAC-SHA-256 |
The signed input is the timestamp, the method in upper case, and the path with its query string, each followed by a dot, then the exact body bytes:
{timestamp}.{METHOD}.{path and query}.{body}
The key is your route's signing secret, encoded as UTF-8. The path is the one your server receives, for example /v2/checkout/card?session=abc.
To verify a request:
- Read the raw body bytes before any parsing.
- Build the signed input and compute the HMAC-SHA-256 with your signing secret.
- Compare the result with the signature header using a constant-time comparison.
- Refuse a timestamp outside your tolerance window, for example five minutes, to block a replayed request.
C#, in an ASP.NET Core server:
using System.Security.Cryptography;
using System.Text;
using Microsoft.AspNetCore.Http.Features;
static bool IsFromVaultRoute(HttpRequest request, byte[] body, string signingSecret)
{
var timestamp = request.Headers["X-WinkPG-Vault-Timestamp"].ToString();
var signature = request.Headers["X-WinkPG-Vault-Signature"].ToString();
if (!long.TryParse(timestamp, out var seconds)
|| Math.Abs(DateTimeOffset.UtcNow.ToUnixTimeSeconds() - seconds) > 300)
{
return false;
}
// The raw request target is the path and query exactly as signed. Path and PathBase are
// decoded, so a percent-encoded character would no longer match.
var target = request.HttpContext.Features.Get<IHttpRequestFeature>()!.RawTarget;
var prefix = Encoding.UTF8.GetBytes($"{timestamp}.{request.Method.ToUpperInvariant()}.{target}.");
var hash = HMACSHA256.HashData(Encoding.UTF8.GetBytes(signingSecret), [.. prefix, .. body]);
var expected = "v1=sha256:" + Convert.ToHexString(hash).ToLowerInvariant();
return CryptographicOperations.FixedTimeEquals(
Encoding.ASCII.GetBytes(expected), Encoding.ASCII.GetBytes(signature));
}
JavaScript, in a Node.js server with Express:
const crypto = require("node:crypto");
const express = require("express");
const app = express();
const signingSecret = process.env.VAULT_ROUTE_SIGNING_SECRET;
function isFromVaultRoute(req) {
const timestamp = req.get("X-WinkPG-Vault-Timestamp") ?? "";
const signature = req.get("X-WinkPG-Vault-Signature") ?? "";
const seconds = Number(timestamp);
if (!/^\d+$/.test(timestamp) || Math.abs(Date.now() / 1000 - seconds) > 300) {
return false;
}
// express.raw leaves an empty object, not a buffer, when the request has no body.
const body = Buffer.isBuffer(req.body) ? req.body : Buffer.alloc(0);
// originalUrl is the path and query string exactly as the request line carried them.
const prefix = Buffer.from(`${timestamp}.${req.method.toUpperCase()}.${req.originalUrl}.`, "utf8");
const hash = crypto
.createHmac("sha256", Buffer.from(signingSecret, "utf8"))
.update(Buffer.concat([prefix, body]))
.digest("hex");
const expected = Buffer.from(`v1=sha256:${hash}`, "ascii");
const received = Buffer.from(signature, "ascii");
return expected.length === received.length && crypto.timingSafeEqual(expected, received);
}
// express.raw keeps the body as the exact bytes that were signed. Its limit must be at least the
// route's maxBodyBytes, or Express refuses a capture the route accepted.
app.post("/v2/checkout/card", express.raw({ type: "*/*", limit: "1mb" }), (req, res) => {
if (!isFromVaultRoute(req)) {
return res.status(401).end();
}
const order = Buffer.isBuffer(req.body) && req.body.length > 0 ? JSON.parse(req.body) : {};
// order.card.cardNumber is the pt_ reference and order.card.cvv is the cva_ alias.
res.status(200).json({ received: true });
});
A caller can't send its own signature headers: WinkPG removes them before it forwards the request.
Headers on the way through
Your request headers reach your server unchanged, including Authorization and any idempotency header, with these exceptions:
| Direction | Removed | Added or set |
|---|---|---|
| To your server | Connection-level headers (Connection, Keep-Alive, Transfer-Encoding, and others), Cookie, X-WinkPG-Bot-Challenge, the signature headers, and any forwarding headers the caller sent |
Host (your server's host), X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Proto, X-Correlation-Id, and the two signature headers |
| To the card form | Connection-level headers, Set-Cookie, Access-Control-*, and any X-Correlation-Id your server sent |
The route's CORS headers and X-Correlation-Id |
X-Correlation-Id is always WinkPG's. Every answer to the card form carries it, your server's or a refusal. A header with the same name from your server is removed. If the card form's request sends X-Correlation-Id, the answer carries that value, and so does the request to your server. A card form in a browser can read it from the answer, because the route's CORS answer exposes the header. A refusal never reaches your server, so for a refused capture that's the only copy. Quote it to support: it finds the record of that capture.
WinkPG doesn't follow a redirect your server returns: a 3xx reaches the card form like any other response.
Origins and preflight
A browser sends a preflight request (OPTIONS) before a cross-origin POST with JSON. WinkPG answers it with the route's CORS policy and never forwards it:
- From an allowed origin, the answer allows
POST,PUT, andPATCH, allows the headers the browser asked for, and allows credentials. - From any other origin, the answer carries no allow headers, and the browser blocks the request.
CORS stops only browsers, so WinkPG also checks the Origin header on every capture:
Origin header |
Result |
|---|---|
| One of the route's allowed origins | Accepted |
| Any other origin | Refused with 403 and VaultProxy:OriginNotAllowed |
Absent, with allowNativeClients on |
Accepted |
Absent, with allowNativeClients off |
Refused with 403 and VaultProxy:OriginRequired |
Each route accepts up to 30 requests a minute from one source address, and a preflight counts toward that limit. One source address can also send up to 120 capture requests a minute across all routes. A request over either limit gets 429.
Require a bot challenge
The Origin check stops a browser on another site, not a script. Turn on requireBotChallenge on a route whose form is open to the public, such as a guest checkout, to make every request prove that it passed a bot protection provider. The route checks the token before anything is vaulted or forwarded, so a request it refuses leaves nothing behind.
The route uses the provider your platform administrator selected, Cloudflare Turnstile or Google reCAPTCHA v3. Before you turn on the option, ask your administrator for the provider's site key, and to add your form's host name to that key's domain list at the provider.
Send the token
- Load the provider's widget or script in your form, with the site key.
- Get a token from the provider when the cardholder submits the form. With reCAPTCHA v3, name the action
vault_capture. A token with any other action is refused. - Send the token in the
X-WinkPG-Bot-Challengeheader, once, with the request you already post.
const response = await fetch(captureUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-WinkPG-Bot-Challenge": challengeToken,
},
body: JSON.stringify(checkout),
});
The header is removed before the request is forwarded, so your server never receives it. The route's preflight answer allows it.
Ship the form change first. A route with the option off removes the header and ignores it, but a route with the option on refuses every request without a token from the moment you save it. The option covers every request on the route, including a request with no card in it and a request with an empty body.
Retry after a decline
A provider accepts a token once, so every post needs its own. This is the flow when a cardholder corrects a CVV:
- The form gets a token and posts. Your server charges the card, and the charge is declined.
- Your server answers the form, and the decline reaches the cardholder.
- The cardholder corrects the CVV. The form resets the widget or asks the provider for a new token.
- The form posts again with the new token. Your server receives the same
pt_reference and a newcva_alias.
If step 3 is skipped and the form resends the first token, the post is refused with VaultProxy:BotChallengeFailed, nothing is forwarded, and the form must get a new token. Get a new token after a refusal too.
Native apps
allowNativeClients waives the Origin check and nothing else. On a route with this option on, a native app sends the same X-WinkPG-Bot-Challenge header, with no Origin header. Get the token the way your provider documents for mobile apps. An app that can't produce a token can't post to this route: give it a separate route with the option off.
When the provider can't answer
The route waits up to 5 seconds for the provider. If no provider is selected, or the provider doesn't give an answer in that time, the route refuses the request with 503 and VaultProxy:BotChallengeUnavailable. It never lets a request through unchecked, so a provider outage stops captures on this route until the provider recovers. If a route must keep taking captures through an outage, leave the option off.
Capture errors
When WinkPG refuses a capture, nothing is forwarded, and the answer is JSON:
{ "error": { "code": "VaultProxy:OriginNotAllowed", "message": "This origin is not allowed to post to the vault route." } }
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 404 | VaultProxy:CaptureRouteNotFound |
No enabled inbound route has that id, or vault routes are off for your account | Check the vr_ id in the address and that the route is enabled |
| 403 | VaultProxy:OriginNotAllowed |
The Origin header isn't one of the route's allowed origins |
Add the exact origin to allowedOrigins |
| 403 | VaultProxy:OriginRequired |
The request carried no Origin header, and the route doesn't accept native clients |
Turn on allowNativeClients for a native app |
| 403 | VaultProxy:BotChallengeRequired |
The route requires a bot challenge, and the request carries no usable token: the X-WinkPG-Bot-Challenge header is missing, empty, sent twice, or over 8,192 characters |
Send one token in the header |
| 403 | VaultProxy:BotChallengeFailed |
The provider refused the token: it's expired, already used, or failed the provider's check | Get a new token and post again |
| 413 | VaultProxy:BodyTooLarge |
The body is larger than the route's maxBodyBytes. Checked before the body is read |
Raise maxBodyBytes, or send a smaller body |
| 415 | VaultProxy:UnsupportedMediaType |
The body isn't JSON | Post application/json |
| 400 | VaultProxy:MalformedBody |
The body isn't valid JSON | Fix the body your form builds |
| 400 | VaultProxy:AmbiguousProperty |
A property on a filter path appears twice in one object, by the same name or by names that differ only by case | Send each property once |
| 400 | VaultProxy:InvalidCardNumber |
The value at the card number path isn't 13 to 19 digits that pass the Luhn check | Ask the cardholder to check the number |
| 400 | VaultProxy:InvalidCvv |
The value at the CVV path isn't 3 or 4 digits | Ask the cardholder to check the CVV |
| 400 | VaultProxy:CvvWithoutCardNumber |
The body carries a CVV but no card number | Send the card number with the CVV |
| 400 | VaultProxy:UnvaultedCardNumber |
A value outside the card number path looks like a card number. No token is created | Add a filter for that path, or stop sending the value |
| 400 | VaultProxy:InvalidAccountNumber |
The value at the account number path isn't 1 to 17 digits. No token is created | Ask the account holder to check the number |
| 400 | VaultProxy:InvalidRoutingNumber |
The value at the routing number path is missing, or isn't nine digits that pass the ABA checksum. No token is created | Ask the account holder to check the number |
| 400 | VaultProxy:InvalidAccountType |
The value at the account type path isn't Checking or Savings. No token is created |
Send one of the two names, or leave the field out |
| 400 | VaultProxy:CardAndBankAccount |
The body carries a card number and a bank account number. A capture takes one. No token is created | Post one payment method per request |
| 400 | VaultProxy:RoutingNumberWithoutAccountNumber |
The body carries a routing number but no bank account number | Send the account number with the routing number |
| 400 | VaultProxy:InvalidUpstreamPath |
The path after the route id contains a . or .. segment, or an encoded slash or backslash |
Post to a plain path |
| 503 | VaultProxy:CvvAliasStoreUnavailable |
The CVV alias couldn't be stored. No token is created or changed | Ask the cardholder to try again |
| 503 | VaultProxy:VaultUnavailable |
The vault couldn't be read or written | Ask the cardholder to try again |
| 503 | VaultProxy:BankAccountVaultUnavailable |
The vault couldn't be read or written for a bank account. Nothing is forwarded | Ask the account holder to try again |
| 503 | VaultProxy:BotChallengeUnavailable |
The token couldn't be checked: no provider is selected, or the provider gave no answer within 5 seconds | Get a new token and try again. If it keeps happening, ask your platform administrator to check the provider |
| 504 | VaultProxy:UpstreamTimeout |
Your server didn't answer within the route's timeout. The request was sent once and isn't retried | Treat it as any timeout on a card post: your server may have received it |
| 502 | VaultProxy:UpstreamUnavailable |
Your server couldn't be reached, or its host resolves to a private or reserved address | Check your server is reachable on a public address |
WinkPG never retries a capture. A capture is a payment post, and a retry the customer didn't ask for is a second charge attempt you didn't ask for.
What you never get back
- No card number. Not on a capture, not on a route read, not on a transaction.
- No CVV. The CVV is held encrypted outside your vault for the alias's lifetime, at most 60 minutes, and is never written to a token, a log, or an audit record.
- No alias echo. The alias is never stored with the transaction and is never returned in a response.
- Nothing that returns the card to you. No endpoint returns a card number or a CVV to you. If you're coming from a vault proxy product, charge through
POST /api/transactions, or send the card to a gateway WinkPG has no connection to through an outbound vault route. A route sends the card to the gateway, never to you.
The alias is bound to the card reference and the merchant it was issued for. It can't reveal the CVV for any other card or merchant.
See also
- Reusing a stored payment method with payment tokens covers charging the
pt_reference after the alias has expired. - Refunds, voids, and reversals covers the operations a captured card's transaction accepts.
- Understanding declines and rejections covers reading a declined result and deciding whether to retry.