Skip to main content
Skip table of contents

Direct API payments

Submit eCheck and card not present payments by sending a POST request to the /txns endpoint of the Payrix API.

The Payrix API supports card and eCheck payments using a new or stored payment method. The same request can also tokenize a new payment method for future use.

This page provides details about using the /txns endpoint to submit card and eCheck payments. See the Payrix API reference for a complete definition of the /txns resource.

You must be PCI certified to submit card transactions directly via the API. Your application will need to handle protected customer and payment method data.

Note: Canadian Merchants will have different field parameter valid values than US, and currency type will auto default to CAD. All other parameter fields remain the same. See more details within each expand below.

Card Payments

View details about submitting payments using credit/debit cards.

To submit a card payment using the API, send a POST request to the /txns endpoint with the payment details in the body of the request. The examples below show request bodies for the following use cases:

  • New Card - Submit a transaction by sending the payment card details.

  • Saved Card - Submit a transaction using a previously stored payment token.

  • New Card + Tokenization - Submit a transaction by sending payment card details and create a new payment token.

Visit the Payrix API reference for additional details.

The examples below show the fields required by the API. Depending on your portfolio’s AVS and Risk settings, additional information (e.g. cardholder’s address) may be necessary for payment approval. Payrix recommends submitting all of the optional fields to increase the chances that the transaction will be approved. See the Payrix API reference for details about the optional fields.

API direct payments are calculated in pennies (cents). Therefore, the total field should be submitted in pennies. The sample transactions below are for $100.00.

Important Info for Canadian Merchants:

  • province fields replace the state fields (see valid values here).

  • postal fields replace zip fields (see valid values here).

  • currency will be in CAD.

New Card Payment

The example below shows a sample request body for card payment using a new payment method:

JSON
{
    "merchant": "t1_mer_59efbf4e69b27a4760b885d",
    "type": "1",
    "origin": "2",
    "payment": {
        "number": "4242424242424242",
        "cvv": "123",
        "expiration": "1020"
    },
    "total": "10000"
}

Stored Card Payment

The example below shows a sample request body for card payment using a stored token as the payment method:

JSON
{
    "merchant": "t1_mer_59efbf4e69b27a4760b885d",
    "type": "1",
    "origin": "2",
    "token": "b73443457d0202be0489fed2b5687f81",
    "total": "10000"
}

New Card Payment with Tokenization

The example below shows a sample request body for card payment using a new card as the payment method. The request will create and save a token for the payment method:

JSON
{
    "merchant": "t1_mer_59efbf4e69b27a4760b885d",
    "type": "1",
    "origin": "2",
    "token": {
        "payment": {
            "number": "4242424242424242",
            "cvv": "123",
            "expiration": "1020"
        },
        "customer": {}
    },
    "total": "10000"
}

eCheck Payments

View details about submitting payments using credit/debit cards.

To submit an eCheck payment using the API, send a POST request to the /txns endpoint with the payment details in the body of the request. equest bodies for the following use cases:

  • New eCheck - Submit a transaction by sending the account details.

  • Saved eCheck - Submit a transaction using previously saved account details.

  • New Card + Tokenization - Submit a transaction by sending new account details and create a new payment token.

The Payrix API reference includes additional details about optional fields and accepted values.

The eCheck payment documentation includes additional details about Payrix’s eCheck support.

Important Info for Canadian Merchants:

  • province fields replace the state fields (see valid values here).

  • postal fields replace zip fields (see valid values here).

  • currency will be in CAD.

New eCheck Payment

The example below shows a sample request body for submitting an eCheck payment using a new account:

CODE
{
	"merchant": "t1_mer_59efbf4e69b27a4760b885d",
	"type": "7",
	"origin": "2",
	"payment": {
		"method": "8",
		"number": "123456789",
		"routing": "123456789"
	},
	"total": "10000",
	"first": "First",
	"last": "Last"
}

Saved eCheck Payment

The example below shows a sample request body for submitting an eCheck payment using a saved account:

CODE
{
	"merchant": "t1_mer_59efbf4e69b27a4760b885d",
	"type": "7",
	"origin": "2",
	"token": "944afd0919c5561724f511d4846e40b9",
	"total": "10000"
}

New eCheck Payment with Tokenization

The example below shows a sample request body for submitting an eCheck payment using a new account and creating a new token:

CODE
{
	"merchant": "t1_mer_59efbf4e69b27a4760b885d",
	"type": "7",
	"origin": "2",
	"token": {
		"payment": {
			"method": "8",
			"number": "123456789",
			"routing": "123456789"
		},
		"customer": {
			"first": "First",
			"last": "Last"
		}
	},
	"total": "10000"
}

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.