Skip to main content
Version: 1.28 (Current)

Make a payment with Credit Card

Audience: Low-code Engineers

Skill Prerequisites: Actions, Tokens, Authorize.Net account

Charges a credit card through Authorize.Net. The card details are sent from your server to Authorize.Net, and the action then runs one of four action lists, depending on whether the payment was approved, declined, held for review or ended in an error.

By default the payment is authorized and captured in one step. You can also only authorize it, or use the other Authorize.Net transaction types.

note

This action is part of the Authorize.Net add-on (DnnSharp.Authorize.Net). The add-on is installed separately and needs the AUTHORIZE feature in your license. If it isn't licensed, the action fails with a "not licensed" error. If you don't see the Authorize.Net actions, the add-on isn't installed.

Typical Use Cases​

  • Charge a customer when they submit an order or registration form
  • Take a card payment from an API endpoint
  • Authorize a card now and capture the payment later
  • Save the transaction ID, so the payment can be refunded later with Refund a Transaction

Don't use it to​

Action NameDescription
Make a payment with Electronic CheckTakes a payment from a bank account instead of a card.
Refund a TransactionRefunds a settled transaction by its transaction ID.
Create SubscriptionCreates a recurring payment in Authorize.Net.
Update SubscriptionChanges an existing Authorize.Net subscription.
Add a Simple Checkout to a buttonSends the user to an Authorize.Net hosted payment page.
Stripe CheckoutTakes a payment through Stripe instead.

Input Parameter Reference​

In Forms and API endpoints, the card and billing parameters are dropdowns where you pick a field, or switch to an expression. In other modules they're text boxes where you type a value or tokens, for example [CardNumber].

ParameterDescriptionSupports TokensDefaultRequired
API Login IDThe API Login ID of your Authorize.Net account. Use the sandbox login when Go Live is off.Yesempty stringYes
Transaction KeyThe Transaction Key that goes with the API Login ID.Yesempty stringYes
Credit Card Transaction TypeThe Authorize.Net transaction type: AUTH_CAPTURE, AUTH_ONLY, CAPTURE_ONLY, PRIOR_AUTH_CAPTURE, CREDIT or VOID. If it's empty, Authorize.Net processes the payment as AUTH_CAPTURE. See Transaction types.Yesempty stringNo
Go LiveWhen on, the payment goes to the production gateway and the card is really charged. When off, it goes to the Authorize.Net sandbox (https://test.authorize.net/gateway/transact.dll).YesfalseNo
Payment descriptionWhat the payment is for, for example a product or service name. It's shown on receipts and in Authorize.Net.Yesempty stringNo
Transaction's currencyThe currency code: AUD, USD, CAD, GBP, NZD or EUR. The currency must be enabled on your Authorize.Net account.Yesempty stringNo
Amount - total to payThe total to charge, as a plain number with a dot for decimals and no currency symbol, for example 49.95 or [OrderTotal].Yesempty stringYes
Credit Card NumberThe card number. Spaces and dashes are removed before it's sent.Yesempty stringYes
Credit Card CCVThe card security code. Needed if your Authorize.Net account uses Card Code Verification.Yesempty stringNo
Expiration MonthThe expiration month, as two digits, for example 04.Yesempty stringYes
Expiration YearThe expiration year, as two or four digits, for example 28 or 2028. It's appended to the month, so 04 and 28 are sent as 0428.Yesempty stringYes
First NameThe cardholder's first name.Yesempty stringNo
Last NameThe cardholder's last name.Yesempty stringNo
AddressThe billing street address.Yesempty stringNo
CityThe billing city.Yesempty stringNo
StateThe billing state or province.Yesempty stringNo
CountryThe billing country.Yesempty stringNo
Postal CodeThe billing ZIP or postal code. Your Authorize.Net fraud settings, such as Address Verification, may require it.Yesempty stringNo
FieldsExtra Authorize.Net fields to send. Each row has an Authorize.Net Field name, for example x_invoice_num or x_email, and a Value. See Extra fields.YesNoneNo
On ApprovedActions to run when the payment is approved (response code 1).NoNoneNo
On DeclinedActions to run when the payment is declined (response code 2).NoNoneNo
On ErrorActions to run when Authorize.Net returns an error (response code 3), for example for invalid credentials or a bad card number.NoNoneNo
On Held For ReviewActions to run when the payment is held for review (response code 4), for example by your fraud filters.NoNoneNo

Which fields are really required depends on your Authorize.Net account settings. The gateway rejects the payment, and On Error runs, if a field it needs is missing.

Output Parameters Reference​

Type a name without brackets, for example AnetTransactionId, and use it later as [AnetTransactionId]. The tokens are set before the On Approved, On Declined, On Error or On Held For Review actions run, so you can use them there.

ParameterDescription
Output Authorize.Net Response Code Token NameThe response code: 1 approved, 2 declined, 3 error, 4 held for review.
Output Authorize.Net Response Reason Code Token NameThe Authorize.Net reason code, which explains the response in more detail.
Output Authorize.Net Response Reason Text Token NameThe reason as text, for example This transaction has been approved.
Output Authorize.Net Response Authorization Code Token NameThe authorization (approval) code. It's only set when Authorize.Net returns one.
Output Authorize.Net Response Transaction ID Token NameThe transaction ID that Authorize.Net assigned. Save it if you may need to refund, capture or look up the payment later.

Transaction types​

TypeWhat it does
AUTH_CAPTUREAuthorizes and captures the payment in one step. This is what happens when the type is empty.
AUTH_ONLYOnly authorizes the amount. The money isn't collected until the payment is captured.
PRIOR_AUTH_CAPTURECaptures a payment that was authorized earlier with AUTH_ONLY.
CAPTURE_ONLYCaptures a payment that was authorized outside Authorize.Net, for example by phone.
CREDITRefunds a settled payment.
VOIDCancels a payment that hasn't settled yet.

The action has no parameters for the original transaction ID or authorization code. Types other than AUTH_CAPTURE and AUTH_ONLY need them, so add them in Fields, for example x_trans_id, as described in Authorize.Net's AIM guide. The action still sends the card fields for every type. To refund a payment, Refund a Transaction is simpler, because it only needs the transaction ID and amount.

Extra fields​

The action uses Authorize.Net's AIM interface, and the Fields rows are sent as extra AIM fields. Both the field names and the values can contain tokens. Common fields are x_invoice_num, x_cust_id, x_email and x_test_request.

You can't use Fields to change a value that the action already sends, such as x_amount, x_type or x_card_num. A duplicate name makes the action fail with an error.

Considerations​

  • Card data passes through your server. The card number, security code and expiration date are read from the form or tokens on your server and sent to Authorize.Net over TLS 1.2. That puts your site in scope for PCI DSS. Don't save card numbers or security codes in your database, logs, emails or saved form state.
  • Test with the sandbox first. With Go Live off, payments go to the Authorize.Net sandbox, which only accepts sandbox account credentials. Use the test card 4111111111111111 with any future expiration date. Turn Go Live on, with your production API Login ID and Transaction Key, only when you're ready to take real payments.
  • Keep the credentials out of the form. The Transaction Key is a password field, but it's stored with the action. You can also use tokens, for example from a setting, so the keys aren't typed into each action.
  • The actions after it always run. A declined or failed payment doesn't stop execution by itself. Put the actions that should only happen after a payment, such as saving the order or sending a receipt, in On Approved. End On Declined and On Error with an action that ends execution, such as Display Error Message, if nothing else should run.
  • Declines aren't errors. A declined card runs On Declined, not On Error. Connection problems, such as a timeout reaching Authorize.Net, don't run On Error either. They make the action fail with an exception that starts with Error:. To handle those, put the action inside Execute Actions and use its On Error.
  • Amount format. The amount is sent as typed, after tokens are replaced. Round it to two decimals and don't include a currency symbol or thousands separators.
  • Form templates. In Forms, the Pay With Credit Card, Authorize.Net template gives you a form that already has the card and billing fields.

Examples​

tip

To understand how to use the below examples, please see Running Examples.

1. Charge a card in the sandbox​

This action charges the order total on a form's submit, in the sandbox. The card and billing parameters point to the form fields with those names. The API Login ID and Transaction Key come from the AnetLoginId and AnetTransactionKey tokens. On approval, the transaction ID is shown to the user. A declined or failed payment shows the reason and ends execution.

{
"Title": "Make a payment with Credit Card",
"ActionType": "Pay with Credit Card",
"Description": "Charge the order total",
"Parameters": {
"AuthorizeNetAPILoginID": "[AnetLoginId]",
"AuthorizeNetTransactionKey": "[AnetTransactionKey]",
"AuthorizeNetTransactionType": "AUTH_CAPTURE",
"AuthorizeNetLiveMode": false,
"AuthorizeNetTitle": "Order [OrderId]",
"AuthorizeNetCurrency": "USD",
"AuthorizeNetAmount": "[OrderTotal]",
"AuthorizeNetCardNumber": "CardNumber",
"AuthorizeNetCCV": "CardCode",
"AuthorizeNetExpirationMonth": "ExpMonth",
"AuthorizeNetExpirationYear": "ExpYear",
"AuthorizeNetFirstName": "FirstName",
"AuthorizeNetLastName": "LastName",
"AuthorizeNetAddress": "Address",
"AuthorizeNetCity": "City",
"AuthorizeNetState": "State",
"AuthorizeNetCountry": "Country",
"AuthorizeNetPostalCode": "PostalCode",
"AuthorizeNetFields": [
{
"name": "x_invoice_num",
"value": "[OrderId]"
}
],
"AuthorizeNetResponseCodeTokenName": "AnetResponseCode",
"AuthorizeNetResponseReasonCodeTokenName": "AnetReasonCode",
"AuthorizeNetResponseReasonTextTokenName": "AnetReasonText",
"AuthorizeNetResponseAuthorizationCodeTokenName": "AnetAuthCode",
"AuthorizeNetResponseTransactionIDTokenName": "AnetTransactionId",
"OnApproved": [
{
"Title": "Display Message",
"ActionType": "ShowMessage",
"Parameters": {
"Message": "<p>Thank you! Your payment was approved. Transaction ID: [AnetTransactionId]</p>"
}
}
],
"OnDeclined": [
{
"Title": "Display Error Message",
"ActionType": "ShowError",
"Parameters": {
"Message": "<p>Your card was declined: [AnetReasonText]</p>"
}
}
],
"OnError": [
{
"Title": "Display Error Message",
"ActionType": "ShowError",
"Parameters": {
"Message": "<p>We couldn't process your payment: [AnetReasonText]</p>"
}
}
],
"OnHeldForReview": [
{
"Title": "Display Message",
"ActionType": "ShowMessage",
"Parameters": {
"Message": "<p>Your payment is being reviewed. We'll email you when it's confirmed.</p>"
}
}
]
}
}

2. Authorize now, capture later​

This action only authorizes the amount, for example when an order is shipped later. It saves the transaction ID in the AnetTransactionId token, so a later step can capture the payment. It runs in production, so use it only with real credentials.

{
"Title": "Make a payment with Credit Card",
"ActionType": "Pay with Credit Card",
"Description": "Authorize the order total",
"Parameters": {
"AuthorizeNetAPILoginID": "[AnetLoginId]",
"AuthorizeNetTransactionKey": "[AnetTransactionKey]",
"AuthorizeNetTransactionType": "AUTH_ONLY",
"AuthorizeNetLiveMode": true,
"AuthorizeNetTitle": "Order [OrderId]",
"AuthorizeNetCurrency": "USD",
"AuthorizeNetAmount": "[OrderTotal]",
"AuthorizeNetCardNumber": "CardNumber",
"AuthorizeNetCCV": "CardCode",
"AuthorizeNetExpirationMonth": "ExpMonth",
"AuthorizeNetExpirationYear": "ExpYear",
"AuthorizeNetFirstName": "FirstName",
"AuthorizeNetLastName": "LastName",
"AuthorizeNetPostalCode": "PostalCode",
"AuthorizeNetResponseReasonTextTokenName": "AnetReasonText",
"AuthorizeNetResponseTransactionIDTokenName": "AnetTransactionId"
}
}

Revised 09/27/2026