PayFields: Create a New Payment Token

Prev Next

Tokenize a Payment Method with a $0 Authorization

Set up your PayFields.config parameters with the following values and process a transaction using a card or eCheck payment method:

PayFields.config.amount = '0';
// Use the transaction with tokenization mode.
PayFields.config.mode = 'txnToken';
// Set the transaction type to authorization
PayFields.config.txnType = 'auth';

Example Response

In this example response, the new customer payment method has been tokenized with a $0 authorization. You can use this new token value to process future transactions with the same payment method without having to manually re-enter details like the account number or expiration information. See the following example response:

{
    "response": {
        "data": [
            {
                "id": "t1_txn_123abc4d567890efg1h2i34",
                "created": "2024-11-12 18:16:28.455",
                "modified": "2024-11-12 18:16:32.9927",
                "creator": "t1_log_123abc4d567890efg1h2i34",
                "modifier": "t1_log_123abc4d567890efg1h2i34",
                "ipCreated": "54.86.50.139",
                "ipModified": "54.86.50.139",
                "merchant": "t1_mer_123abc4d567890efg1h2i34",
                "token": "a12bc3d4e56f789g0h1ij23kl456789",
                "payment": "t1_pmt_123abc4d567890efg1h2i34",
                "fortxn": null,
                "fromtxn": null,
                "batch": null,
                "subscription": null,
                "type": 1,
                "expiration": "1234",
                "currency": "USD",
                "platform": "VCORE",
                "authDate": null,
                "authCode": null,
                "captured": null,
                "settled": null,
                "settledCurrency": null,
                "settledTotal": null,
                "allowPartial": 0,
                "order": "",
                "description": "Zero Dollar Auth (0.00)",
                "descriptor": null,
                "terminal": null,
                "terminalCapability": null,
                "entryMode": null,
                "origin": "2",
                "tax": null,
                "total": 0,
                "cashback": null,
                "authorization": "30209",
                "approved": "0",
                "cvv": 0,
                "swiped": 0,
                "emv": 0,
                "signature": 0,
                "unattended": null,
                "clientIp": null,
                "first": "John",
                "middle": null,
                "last": "Doe",
                "company": null,
                "email": null,
                "address1": null,
                "address2": null,
                "city": null,
                "state": null,
                "zip": "12345",
                "country": null,
                "phone": null,
                "mid": "12345678",
                "status": "1",
                "refunded": 0,
                "reserved": 0,
                "misused": null,
                "checkStage": "postauth",
                "imported": 0,
                "inactive": 0,
                "frozen": 0,
                "discount": null,
                "shipping": null,
                "duty": null,
                "pin": 0,
                "traceNumber": null,
                "cvvStatus": "notProvided",
                "unauthReason": null,
                "fee": null,
                "fundingCurrency": "USD",
                "authentication": null,
                "authenticationId": null,
                "cofType": "single",
                "copyReason": null,
                "originalApproved": "0",
                "currencyConversion": null,
                "serviceCode": null,
                "authTokenCustomer": null,
                "debtRepayment": "0",
                "statement": null,
                "convenienceFee": 0,
                "surcharge": null,
                "channel": null,
                "funded": null,
                "fundingEnabled": "1",
                "requestSequence": 0,
                "processedSequence": 0,
                "mobile": null,
                "pinEntryCapability": null,
                "fbo": "WORLDPAY_FBO1",
                "returned": null,
                "txnsession": null,
                "networkTokenIndicator": null
            }
        ],
        "details": {
            "requestId": 1
        },
        "errors": []
    }
}

Process a Transaction with the New Token

To submit a transaction with a token using the API, add the token (which can be found on the customer’s profile page) to your POST request to the /txns endpoint. If the customer’s address information was saved, then it will be automatically included when a Merchant submits a transaction using their token.

The API syntax for card-on-file card payments and eCheck payments differs slightly as shown below:

POST /txns HTTP/1.1
Accept: application/json
Content-Type:application/json
Host: test-api.payrix.com
APIKEY:{apiKey}

Request Example:

{
    "merchant": "t1_mer_123abc4d567890efg1h2i34",
    "type": "1",
    "origin": "2",
    "token": "a12bc3d4e56f789g0h1ij23kl456789",
    "total": "10000"
}

Response Example:

{
    "response": {
        "data": [
            {
                "id": "t1_txn_123abc4d567890efg1h2i34",
                "created": "2024-11-12 18:16:28.455",
                "modified": "2024-11-12 18:16:32.9927",
                "creator": "t1_log_123abc4d567890efg1h2i34",
                "modifier": "t1_log_123abc4d567890efg1h2i34",
                "ipCreated": "54.86.50.139",
                "ipModified": "54.86.50.139",
                "merchant": "t1_mer_123abc4d567890efg1h2i34",
                "token": "a12bc3d4e56f789g0h1ij23kl456789",
                "payment": "t1_pmt_123abc4d567890efg1h2i34",
                "fortxn": null,
                "fromtxn": null,
                "batch": null,
                "subscription": null,
                "type": 1,
                "expiration": "1234",
                "currency": "USD",
                "platform": "VCORE",
                "authDate": null,
                "authCode": null,
                "captured": null,
                "settled": null,
                "settledCurrency": null,
                "settledTotal": null,
                "allowPartial": 0,
                "order": "",
                "description": "Zero Dollar Auth (0.00)",
                "descriptor": null,
                "terminal": null,
                "terminalCapability": null,
                "entryMode": null,
                "origin": "2",
                "tax": null,
                "total": 10000,
                "cashback": null,
                "authorization": "12345",
                "approved": "0",
                "cvv": 0,
                "swiped": 0,
                "emv": 0,
                "signature": 0,
                "unattended": null,
                "clientIp": null,
                "first": "John",
                "middle": null,
                "last": "Doe",
                "company": null,
                "email": null,
                "address1": null,
                "address2": null,
                "city": null,
                "state": null,
                "zip": "12345",
                "country": null,
                "phone": null,
                "mid": "12345678",
                "status": "1",
                "refunded": 0,
                "reserved": 0,
                "misused": null,
                "checkStage": "postauth",
                "imported": 0,
                "inactive": 0,
                "frozen": 0,
                "discount": null,
                "shipping": null,
                "duty": null,
                "pin": 0,
                "traceNumber": null,
                "cvvStatus": "notProvided",
                "unauthReason": null,
                "fee": null,
                "fundingCurrency": "USD",
                "authentication": null,
                "authenticationId": null,
                "cofType": "single",
                "copyReason": null,
                "originalApproved": "0",
                "currencyConversion": null,
                "serviceCode": null,
                "authTokenCustomer": null,
                "debtRepayment": "0",
                "statement": null,
                "convenienceFee": 0,
                "surcharge": null,
                "channel": null,
                "funded": null,
                "fundingEnabled": "1",
                "requestSequence": 0,
                "processedSequence": 0,
                "mobile": null,
                "pinEntryCapability": null,
                "fbo": "WORLDPAY_FBO1",
                "returned": null,
                "txnsession": null,
                "networkTokenIndicator": null
            }
        ],
        "details": {
            "requestId": 1
        },
        "errors": []
    }
}

Request Example:

{
    "merchant": "t1_mer_123abc4d567890efg1h2i34",
    "type": "7",
    "origin": "2",
    "token": "a12bc3d4e56f789g0h1ij23kl456789",
    "total": "10000"
}

Response Example:

{
    "response": {
        "data": [
            {
                "id": "t1_txn_123abc4d567890efg1h2i34",
                "created": "2024-11-12 18:16:28.455",
                "modified": "2024-11-12 18:16:32.9927",
                "creator": "t1_log_123abc4d567890efg1h2i34",
                "modifier": "t1_log_123abc4d567890efg1h2i34",
                "ipCreated": "54.86.50.139",
                "ipModified": "54.86.50.139",
                "merchant": "t1_mer_123abc4d567890efg1h2i34",
                "token": "a12bc3d4e56f789g0h1ij23kl456789",
                "payment": "t1_pmt_123abc4d567890efg1h2i34",
                "fortxn": null,
                "fromtxn": null,
                "batch": null,
                "subscription": null,
                "type": 7,
                "expiration": "1234",
                "currency": "USD",
                "platform": "VCORE",
                "authDate": null,
                "authCode": null,
                "captured": null,
                "settled": null,
                "settledCurrency": null,
                "settledTotal": null,
                "allowPartial": 0,
                "order": "",
                "description": null,
                "descriptor": null,
                "terminal": null,
                "terminalCapability": null,
                "entryMode": null,
                "origin": "2",
                "tax": null,
                "total": 10000,
                "cashback": null,
                "authorization": "12345",
                "approved": "0",
                "cvv": 0,
                "swiped": 0,
                "emv": 0,
                "signature": 0,
                "unattended": null,
                "clientIp": null,
                "first": "John",
                "middle": null,
                "last": "Doe",
                "company": null,
                "email": null,
                "address1": null,
                "address2": null,
                "city": null,
                "state": null,
                "zip": "12345",
                "country": null,
                "phone": null,
                "mid": "12345678",
                "status": "1",
                "refunded": 0,
                "reserved": 0,
                "misused": null,
                "checkStage": "postauth",
                "imported": 0,
                "inactive": 0,
                "frozen": 0,
                "discount": null,
                "shipping": null,
                "duty": null,
                "pin": 0,
                "traceNumber": null,
                "cvvStatus": "notProvided",
                "unauthReason": null,
                "fee": null,
                "fundingCurrency": "USD",
                "authentication": null,
                "authenticationId": null,
                "cofType": "single",
                "copyReason": null,
                "originalApproved": "0",
                "currencyConversion": null,
                "serviceCode": null,
                "authTokenCustomer": null,
                "debtRepayment": "0",
                "statement": null,
                "convenienceFee": 0,
                "surcharge": null,
                "channel": null,
                "funded": null,
                "fundingEnabled": "1",
                "requestSequence": 0,
                "processedSequence": 0,
                "mobile": null,
                "pinEntryCapability": null,
                "fbo": "WORLDPAY_FBO1",
                "returned": null,
                "txnsession": null,
                "networkTokenIndicator": null
            }
        ],
        "details": {
            "requestId": 1
        },
        "errors": []
    }
}

Notes

  • Do not use it in combination with Customer, since Customer is a unique token/card holder.

  • When creating a tokenized card, this creates a unique Customer.