How it works
Authorize.net takes a JSON createTransactionRequest with your API login ID and transaction key inside it. You build that request as usual, put the Card Vault placeholders where the card data goes, and send it to the Card Vault proxy with the card's token. The proxy fills in the card data, sends the request to Authorize.net and returns its reply unchanged.
Before you start
- Your Authorize.net API login ID and transaction key (Account, then API Credentials & Keys). For testing, use a sandbox account; its requests go to
apitest.authorize.net. - A card stored in Card Vault, and its token. To send the CVV, store the card with a CVV and a
ttl; the CVV is kept only until then. - If you set a proxy domain allowlist on your client ID, add
api.authorize.net(andapitest.authorize.netfor testing).
Fill in your own values where the examples say YOUR_.... The card placeholders, such as ${ccn}, stay as they are: the proxy replaces them.
Charge a stored card (authCaptureTransaction)
Authorizes and captures the amount in one step. Change amount and refId for each order. Authorize.net checks the order of the fields, so keep them as shown.
What Authorize.net receives
POST https://api.authorize.net/xml/v1/request.api (testing: https://apitest.authorize.net/xml/v1/request.api), with this body (laid out for reading; the request sends it as one line):
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "YOUR_API_LOGIN_ID",
"transactionKey": "YOUR_TRANSACTION_KEY"
},
"refId": "1001",
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "10.00",
"payment": {
"creditCard": {
"cardNumber": "${ccn}",
"expirationDate": "${yyyy}-${mm}",
"cardCode": "${cvv}"
}
}
}
}
}
The Card Vault proxy request
$ENIGMA_TOKEN is your Enigma Vault access token and $CARD_TOKEN the stored card's token. The quoted EOF keeps your shell from touching the ${...} placeholders.
curl -X POST https://api.enigmavault.io/cardvault/proxy \
-H "Authorization: Bearer $ENIGMA_TOKEN" \
-H "x-api-version: 1.14" \
-H "cardToken: $CARD_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"url": "https://api.authorize.net/xml/v1/request.api",
"httpMethod": "POST",
"headers": [
{
"name": "Content-Type",
"value": "application/json"
}
],
"body": "{\"createTransactionRequest\":{\"merchantAuthentication\":{\"name\":\"YOUR_API_LOGIN_ID\",\"transactionKey\":\"YOUR_TRANSACTION_KEY\"},\"refId\":\"1001\",\"transactionRequest\":{\"transactionType\":\"authCaptureTransaction\",\"amount\":\"10.00\",\"payment\":{\"creditCard\":{\"cardNumber\":\"${ccn}\",\"expirationDate\":\"${yyyy}-${mm}\",\"cardCode\":\"${cvv}\"}}}}}"
}
EOF
Reading the reply
The proxy answers 200 with statusCode, contentType, headers and body from Authorize.net. Authorize.net answers HTTP 200 for approvals, declines and errors alike, and starts its JSON with a byte order mark that some JSON parsers reject (strip it first). "responseCode": "1" in transactionResponse is an approval; keep transId for refunds and voids. 2 is a decline, 3 an error and 4 held for review. When messages.resultCode is Error, the request itself was refused, for example for wrong credentials.
Authorize only (authOnlyTransaction)
Places a hold for the amount without capturing it. Capture it later with a priorAuthCaptureTransaction that carries the refTransId; that request has no card data, so send it to Authorize.net directly rather than through the proxy.
What Authorize.net receives
POST https://api.authorize.net/xml/v1/request.api (testing: https://apitest.authorize.net/xml/v1/request.api), with this body (laid out for reading; the request sends it as one line):
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "YOUR_API_LOGIN_ID",
"transactionKey": "YOUR_TRANSACTION_KEY"
},
"refId": "1002",
"transactionRequest": {
"transactionType": "authOnlyTransaction",
"amount": "10.00",
"payment": {
"creditCard": {
"cardNumber": "${ccn}",
"expirationDate": "${yyyy}-${mm}",
"cardCode": "${cvv}"
}
}
}
}
}
The Card Vault proxy request
$ENIGMA_TOKEN is your Enigma Vault access token and $CARD_TOKEN the stored card's token. The quoted EOF keeps your shell from touching the ${...} placeholders.
curl -X POST https://api.enigmavault.io/cardvault/proxy \
-H "Authorization: Bearer $ENIGMA_TOKEN" \
-H "x-api-version: 1.14" \
-H "cardToken: $CARD_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @- <<'EOF'
{
"url": "https://api.authorize.net/xml/v1/request.api",
"httpMethod": "POST",
"headers": [
{
"name": "Content-Type",
"value": "application/json"
}
],
"body": "{\"createTransactionRequest\":{\"merchantAuthentication\":{\"name\":\"YOUR_API_LOGIN_ID\",\"transactionKey\":\"YOUR_TRANSACTION_KEY\"},\"refId\":\"1002\",\"transactionRequest\":{\"transactionType\":\"authOnlyTransaction\",\"amount\":\"10.00\",\"payment\":{\"creditCard\":{\"cardNumber\":\"${ccn}\",\"expirationDate\":\"${yyyy}-${mm}\",\"cardCode\":\"${cvv}\"}}}}}"
}
EOF
Reading the reply
The proxy answers 200 with statusCode, contentType, headers and body from Authorize.net. Read the reply as for a charge: "responseCode": "1" is an approved authorization.
Things to know
- No CVV. For a repeat charge after the CVV has expired, leave out
cardCode. - Expiry.
${yyyy}-${mm}becomes theYYYY-MMdate Authorize.net accepts, for example2030-03. - Billing details. To send a name or address for AVS, add a
billToobject afterpayment, in the order Authorize.net documents. Card Vault inserts${firstName}and${lastName}exactly as stored, without JSON escaping, so write your own values for any field that may contain a quotation mark. - Allowlisting our addresses. If your account restricts the addresses it accepts, the proxy calls from
18.210.171.115and44.196.108.239(United States) and18.200.188.77and63.35.37.99(EU data residency).
See also all connectors, the API reference for POST /cardvault/proxy, and the proxy's addresses. Questions: support@enigmavault.io.