View as Markdown

llms.txt

This guide isn't available right now

This instance couldn't load its guide catalog. The guide returns as soon as the catalog is readable again.

Back to the guides

No such guide

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

Back to the guides

That guide is part of the product documentation

This guide is written for someone operating WinkPG through its screens rather than integrating against it, so it lives in the application's own help section instead of here. Sign in to WinkPG and open Help to read it.

Back to the guides

Guides Integration

Sending a stored card or bank account to a gateway through an outbound vault route

Send your gateway's own request through an outbound vault route with a token reference in place of a card or bank account number, and WinkPG puts the real values in and relays the gateway's answer with the number masked.

An outbound vault route sits between your server and one payment gateway. Your server builds the request the gateway documents. For a card, it puts the card's pt_ reference where the card number goes and its cva_ alias where the CVV goes. For a bank account, it puts the account's pt_ reference where the account number goes and where the routing number goes. It sends the request to the route on WinkPG instead of to the gateway. WinkPG puts the real values into the request, in memory, sends it to the gateway once, and hands you the gateway's answer with the card number or account number masked.

Your server never holds a card number, a CVV, or a bank account number, and it still talks to the gateway in the gateway's own format.

What your server sends What the gateway receives
A card's pt_ reference The card number
The card's cva_ alias The CVV
A bank account's pt_ reference at the account number path The bank account number
The same reference at the routing number path The routing number
Every other field The same field, byte for byte
Your Authorization header and your other headers The same headers
Your WinkPG api-key header Nothing
Headers the hosting platform adds, such as X-Client-IP Nothing
Nothing, on a route that signs A timestamp, a nonce, and a signature over the request as sent

When to use an outbound route

Use one only when your gateway has no processor connection on WinkPG. A charge through a connected processor belongs on POST /api/transactions: it keeps a transaction, reports, refunds, and webhooks, and a relayed request has none of those. WinkPG creates no transaction for a relay. The gateway's answer is the only record of the charge or debit.

Before you start

  • Outbound routes are turned on for your account. While they're off, every relay answers 404.
  • A route for your gateway. WinkPG creates it for you and gives you its vr_ public ID.
  • An API key bound to your merchant with the vault:outbound scope, no other scope, and a source address restriction. WinkPG refuses to save a key with that scope otherwise, and every other key is refused at the relay.
  • A pt_ reference for a card or bank account your merchant owns. A token shared from another merchant is refused. Inbound vault routes shows how a pt_ and a cva_ reach your server.

Your gateway's host has to be on the platform's list, which only WinkPG can change. A route always sends over HTTPS on port 443.

Send a request

Replace the gateway's base address with the route's relay address and keep the rest of the path.

curl -X POST "https://YOUR_HOST/api/vault-proxy/outbound/YOUR_ROUTE_ID/charges" \
  -H "api-key: YOUR_API_KEY" \
  -H "Authorization: Bearer YOUR_GATEWAY_CREDENTIAL" \
  -H "Idempotency-Key: order-1042" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1250,
    "card": {
      "number": "pt_YOUR_TOKEN_REFERENCE",
      "cvv": "cva_YOUR_CVV_ALIAS",
      "expiry": "12/30"
    }
  }'
  • The route accepts POST, PUT, and PATCH. It reads a JSON body unless it's set up for a form-encoded one (see below). XML and multipart bodies are refused.
  • Authorization is your gateway's credential. It goes to the gateway unchanged.
  • Send the expiration date and the cardholder name yourself. A route reveals the card number and the CVV of a card, and nothing else from it.
  • The route's filters name the paths in your body. Ask for them to match the gateway's request shape.

Charge a stored card with no CVV

A stored card has no live alias once the alias has expired. To get a new one for a card you already hold, open a hosted payment page session with cvvOnlyCardReference: the payer enters only the security code, and your page receives a fresh cva_ alias. Otherwise, leave out the CVV field or send it as null, and the card number goes out with no CVV.

A value at the CVV path has to be a live alias. An expired alias, an alias for another card, or an alias anywhere the route doesn't look for one refuses the request. WinkPG never turns an alias failure into a charge without the CVV.

Send a form-encoded request

A gateway that takes application/x-www-form-urlencoded bodies gets a route set up to read one. Each of its paths is a form field name exactly as the gateway names it, such as card[number] and card[cvc].

curl -X POST "https://YOUR_HOST/api/vault-proxy/outbound/YOUR_ROUTE_ID/charges" \
  -H "api-key: YOUR_API_KEY" \
  -H "Authorization: Bearer YOUR_GATEWAY_CREDENTIAL" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "amount=1250" \
  --data-urlencode "card[number]=pt_YOUR_TOKEN_REFERENCE" \
  --data-urlencode "card[cvc]=cva_YOUR_CVV_ALIAS"
  • A field name matches exactly, case included, after decoding, so card%5Bnumber%5D is card[number].
  • A field the route fills has to appear once. Other repeated fields are yours.
  • The body is UTF-8: no charset, or charset=utf-8. A % has to be followed by two hex digits.
  • Only the values in the route's fields change. Every other byte reaches the gateway as you sent it.

Send an encrypted card number

A gateway that takes the card number encrypted with its RSA public key, in a field such as card.encrypted_pan, gets a route set up to encrypt the value at that path. Send the pt_ reference at that field, as for any other route. WinkPG puts the card number into the route's plaintext template (for example, 00000000 followed by the number), encrypts it with the gateway's key, and writes the result in base64 or hex.

  • The route holds the gateway's public key, the algorithm (RSA-OAEP with SHA-256, RSA-OAEP with SHA-1, or RSA PKCS #1 v1.5), the template, and the output encoding. A request can't supply or change any of them.
  • The route shows the key's SHA-256 fingerprint. Compare it with the key the gateway publishes.
  • The route can name a key WinkPG keeps for the gateway in place of its own copy. It then shows that key's name and fingerprint, and a change to the named key reaches every route that names it, with no change to your request.
  • A CVV, an account number, or a routing number can be encrypted the same way. Each field is either encrypted or sent as it is.
  • An encrypted value the gateway repeats comes back unchanged, because it's ciphertext. A card number repeated in clear is still masked.
  • If the route can't encrypt a value, the request is refused with VaultProxy:RelayEncryptionFailed and nothing is sent.

Sign the request for the gateway

Some gateways require every request to carry an HMAC signature made with a key they issue. Your server can't make it, because the gateway signs over the card number and your server holds only the pt_ reference. A route for one of these gateways signs each request itself, after it puts the real values in. Send the request as for any other route, without the timestamp, nonce, or signature headers.

WinkPG writes the current time and a new lowercase UUID to the route's timestamp and nonce headers, such as X-Timestamp and X-Nonce. It joins the route's components with a line feed, computes HMAC-SHA256 of the result with the gateway's key, and writes it to the route's signature header, such as X-Signature, in padded Base64 or lowercase hexadecimal. A component is the method in upper case, the path as sent with no query string, one header's value as sent, or the lowercase hexadecimal SHA-256 of the exact body the gateway receives.

  • The route holds the gateway signing key, the header names, the formats, and the components. A request can't supply or change any of them.
  • The key is never returned. The route shows only that a key is set and when.
  • A request that carries the timestamp, nonce, or signature header, or that sends a signed header of its own missing or more than once, is refused with VaultProxy:RelaySigningHeaderConflict and nothing is sent.
  • If the route can't sign, the request is refused with VaultProxy:RelaySigningFailed and nothing is sent.
  • The gateway signing key isn't the route signing secret, which signs what an inbound route forwards to your own server.

Debit a stored bank account

The route has to carry an account number filter. The field names and the path in this example are placeholders: use the ones your gateway documents.

curl -X POST "https://YOUR_HOST/api/vault-proxy/outbound/YOUR_ROUTE_ID/debits" \
  -H "api-key: YOUR_API_KEY" \
  -H "Authorization: Bearer YOUR_GATEWAY_CREDENTIAL" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 1250,
    "orderId": "order-1042",
    "bankAccount": {
      "accountNumber": "pt_YOUR_TOKEN_REFERENCE",
      "routingNumber": "pt_YOUR_TOKEN_REFERENCE",
      "accountType": "Checking"
    }
  }'
  • Both paths hold the same reference. The account number path has to be filled. The routing number filter is optional: on a route without one, send the routing number yourself. On a route with one, the value at that path has to be the pt_ reference, and a routing number there is refused.
  • You send the rest. That includes the account type and the name on the account. A route reveals the account number and the routing number of a bank account, and nothing else from it.
  • A request names one payment method. A route can carry card filters and bank filters. A body that fills a card path and a bank path is refused, and so is a body that fills neither on a route with both.
  • A token is a card or a bank account. A card's reference at a bank path, or a bank account's reference at a card path, is refused before anything is sent.
  • An account number of four digits or fewer is refused. Its last four digits would be the whole number, so no response could be masked. Charge a token like that through a connected processor.

You originate the debit

WinkPG isn't the originator of a relayed debit, and it holds no NACHA evidence for it. A relayed debit has no transaction in WinkPG, so WinkPG has no authorization record, no SEC code, and no return or notice of change for it. Your business and your gateway own those. Collect and keep the authorization that the NACHA Operating Rules require, and handle returns with your gateway.

What comes back

You get the gateway's status and body, not a WinkPG envelope.

  • The card number, or an account number of nine digits or more, is masked. If the answer repeats that number, with or without spaces or dashes, it's masked to its last four digits in the body and the headers: ************1111. The status doesn't change.
  • An account number under nine digits is masked only when it stands alone. A number that short is masked when it's a whole value, such as a JSON value or a query parameter, written without spaces or dashes. Inside a longer reference, amount, or date, those digits don't change, so a gateway's reference stays correct. A spaced or dashed form of a number that short doesn't change either.
  • The routing number isn't masked. It identifies a bank, not an account, and it's published.
  • A CVV under a CVV field name is masked. If the answer repeats the CVV the request carried under a name such as cvv, cvc, or security_code, every digit is masked, in the body and the headers.
  • Other numbers stay as they are. Only the number WinkPG sent is masked. A different card-shaped value passes through unchanged, and the relay records that it saw one.
  • A body WinkPG can't read is withheld. You get the status, an empty body, and X-WinkPG-Vault-Response-Withheld: true. The gateway may have taken the payment, so check with the gateway.
  • Set-Cookie is removed.
  • X-Correlation-Id is always WinkPG's. Every answer carries it, the gateway's or a refusal. A gateway header with the same name is removed. If your request sends X-Correlation-Id, the answer carries your value. Quote it to support: it finds the record of that request.

Retries

WinkPG sends the request once and never retries it.

WinkPG keeps no record of the charge, and using an alias doesn't consume it. Sending the same request again charges the gateway again unless the gateway refuses the duplicate, so send the gateway's own idempotency header on every request. After a timeout, 504 tells you only that no answer arrived. Ask the gateway before you send the request again. If you can't tell whether a request left for the gateway, give support its X-Correlation-Id. The record of that request says whether it was sent.

A debit has more reach than a card charge. A bank account has no alias to expire, so nothing on the route limits how long a pt_ reference can be sent again, and each send is a new debit at the gateway. Your server owns stopping a duplicate. Use a unique order ID on every debit, send the gateway's idempotency header if it has one, and look the debit up at the gateway before you send it again.

Responses and errors

A refusal from WinkPG has this shape:

{ "error": { "code": "VaultProxy:RelayTokenInactive", "message": "..." } }

Nothing reaches the gateway on any refusal, except the three the table marks as sent.

Status Code Meaning What to do
400 VaultProxy:RelayRawCardNumber A value in the body looks like a card number Send the pt_ reference
400 VaultProxy:RelayCardReferenceRequired The card number path holds no pt_ reference Check the body against the route's filters
400 VaultProxy:RelayBankReferenceRequired The account number path holds no pt_ reference, or the routing number path holds anything other than that same reference Check the body against the route's filters
400 VaultProxy:RelayInstrumentAmbiguous The body fills a card path and a bank path, or neither on a route with both Send one payment method
400 VaultProxy:MalformedBody The body isn't valid JSON Fix the body
400 VaultProxy:AmbiguousProperty A filter path matches more than one value Remove the duplicate property
400 VaultProxy:RelayMalformedFormBody On a form-encoded route, a % isn't followed by two hex digits, or the text isn't UTF-8 Encode the body as UTF-8 form data
400 VaultProxy:RelayDuplicateFormField On a form-encoded route, a field the route fills appears more than once Send the field once
400 VaultProxy:InvalidUpstreamPath The path tries to leave the route's base path Fix the path
400 VaultProxy:RelaySigningHeaderConflict On a route that signs, the request carries a header WinkPG writes, or a signed header is missing or sent more than once Remove the timestamp, nonce, and signature headers, and send each signed header once
403 KEY_SCOPE_INSUFFICIENT The key doesn't hold vault:outbound Use a key with that scope
403 VaultProxy:RelayApiKeyRequired A signed-in session reached the relay Use an API key
403 VaultProxy:RelayHostNotAllowed The gateway's host isn't on the platform's list, or the route isn't HTTPS on port 443 Contact WinkPG
403 VaultProxy:RelayTokenNotOwned The token isn't owned directly by the route's merchant Use a token your merchant owns
404 VaultProxy:RelayRouteNotFound No enabled outbound route has this ID for your merchant, or the feature is off Check the ID and the key's merchant
413 VaultProxy:BodyTooLarge The body is over the route's limit Send a smaller body
415 VaultProxy:UnsupportedMediaType On a JSON route, the body isn't JSON Send JSON
415 VaultProxy:RelayFormBodyRequired On a form-encoded route, the body isn't application/x-www-form-urlencoded UTF-8 Send form data
422 VaultProxy:RelayTokenInactive The token isn't active Use an active token
422 VaultProxy:RelayTokenFieldUnavailable The token holds no number that can be sent Use another token
422 VaultProxy:RelayTokenKindMismatch A bank account's reference at a card path, or a card's reference at a bank path Use a token of the kind the path takes
422 VaultProxy:RelayAccountNumberTooShort The account number has four digits or fewer, so a response couldn't be masked Charge the token through a connected processor
422 VaultProxy:RelayCvvAliasInvalid The alias is expired, belongs to another card or merchant, or sits where the route doesn't resolve it Collect the CVV again
429 More than 600 requests in a minute for this route and key Wait and retry
500 VaultProxy:RelayFailed The relay failed, and the request may have been sent Check with the gateway before you retry
500 VaultProxy:RelayEncryptionFailed The route couldn't encrypt a value. Nothing was sent Contact WinkPG to check the route's key
500 VaultProxy:RelaySigningFailed The route couldn't sign the request. Nothing was sent Contact WinkPG to check the route's signing settings
502 VaultProxy:RelayUpstreamUnreachable Sent once. The gateway couldn't be reached Check with the gateway before you retry
503 VaultProxy:RelayCvvAliasStoreUnavailable The alias couldn't be read Retry
503 VaultProxy:RelayVaultUnavailable The vault couldn't be read Retry
504 VaultProxy:RelayUpstreamTimeout Sent once. The gateway didn't answer in time, and it may have taken the payment Check with the gateway before you retry

What you never get back

  • No card number or bank account number. The relay sends it to the gateway and to nobody else. A number the gateway repeats comes back masked, on the terms in What comes back.
  • No CVV. It goes to the gateway and to nobody else. A CVV the gateway repeats under a CVV field name, such as cvv, cvc, or security_code, comes back masked. A gateway must never return a CVV. If yours does, stop and contact WinkPG.
  • No stored record of the request. The card number, the CVV, the alias, the account number, and the routing number are never written to a log, an audit record, an event, or a stored document.

See also

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.