Make a payment with Credit Card
Audience:
Low-code EngineersSkill 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.
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
- Set up recurring payments. Use Create Subscription instead.
- Refund a settled payment. Use Refund a Transaction instead.
- Keep card data off your server. The card number passes through your site. If you don't want that, send the user to Authorize.Net with Add a Simple Checkout to a button.
Related Actions
| Action Name | Description |
|---|---|
| Make a payment with Electronic Check | Takes a payment from a bank account instead of a card. |
| Refund a Transaction | Refunds a settled transaction by its transaction ID. |
| Create Subscription | Creates a recurring payment in Authorize.Net. |
| Update Subscription | Changes an existing Authorize.Net subscription. |
| Add a Simple Checkout to a button | Sends the user to an Authorize.Net hosted payment page. |
| Stripe Checkout | Takes 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].
| Parameter | Description | Supports Tokens | Default | Required |
|---|---|---|---|---|
| API Login ID | The API Login ID of your Authorize.Net account. Use the sandbox login when Go Live is off. | Yes | empty string | Yes |
| Transaction Key | The Transaction Key that goes with the API Login ID. | Yes | empty string | Yes |
| Credit Card Transaction Type | The 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. | Yes | empty string | No |
| Go Live | When 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). | Yes | false | No |
| Payment description | What the payment is for, for example a product or service name. It's shown on receipts and in Authorize.Net. | Yes | empty string | No |
| Transaction's currency | The currency code: AUD, USD, CAD, GBP, NZD or EUR. The currency must be enabled on your Authorize.Net account. | Yes | empty string | No |
| Amount - total to pay | The total to charge, as a plain number with a dot for decimals and no currency symbol, for example 49.95 or [OrderTotal]. | Yes | empty string | Yes |
| Credit Card Number | The card number. Spaces and dashes are removed before it's sent. | Yes | empty string | Yes |
| Credit Card CCV | The card security code. Needed if your Authorize.Net account uses Card Code Verification. | Yes | empty string | No |
| Expiration Month | The expiration month, as two digits, for example 04. | Yes | empty string | Yes |
| Expiration Year | The 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. | Yes | empty string | Yes |
| First Name | The cardholder's first name. | Yes | empty string | No |
| Last Name | The cardholder's last name. | Yes | empty string | No |
| Address | The billing street address. | Yes | empty string | No |
| City | The billing city. | Yes | empty string | No |
| State | The billing state or province. | Yes | empty string | No |
| Country | The billing country. | Yes | empty string | No |
| Postal Code | The billing ZIP or postal code. Your Authorize.Net fraud settings, such as Address Verification, may require it. | Yes | empty string | No |
| Fields | Extra 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. | Yes | None | No |
| On Approved | Actions to run when the payment is approved (response code 1). | No | None | No |
| On Declined | Actions to run when the payment is declined (response code 2). | No | None | No |
| On Error | Actions to run when Authorize.Net returns an error (response code 3), for example for invalid credentials or a bad card number. | No | None | No |
| On Held For Review | Actions to run when the payment is held for review (response code 4), for example by your fraud filters. | No | None | No |
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.
| Parameter | Description |
|---|---|
| Output Authorize.Net Response Code Token Name | The response code: 1 approved, 2 declined, 3 error, 4 held for review. |
| Output Authorize.Net Response Reason Code Token Name | The Authorize.Net reason code, which explains the response in more detail. |
| Output Authorize.Net Response Reason Text Token Name | The reason as text, for example This transaction has been approved. |
| Output Authorize.Net Response Authorization Code Token Name | The authorization (approval) code. It's only set when Authorize.Net returns one. |
| Output Authorize.Net Response Transaction ID Token Name | The transaction ID that Authorize.Net assigned. Save it if you may need to refund, capture or look up the payment later. |
Transaction types
| Type | What it does |
|---|---|
AUTH_CAPTURE | Authorizes and captures the payment in one step. This is what happens when the type is empty. |
AUTH_ONLY | Only authorizes the amount. The money isn't collected until the payment is captured. |
PRIOR_AUTH_CAPTURE | Captures a payment that was authorized earlier with AUTH_ONLY. |
CAPTURE_ONLY | Captures a payment that was authorized outside Authorize.Net, for example by phone. |
CREDIT | Refunds a settled payment. |
VOID | Cancels 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
4111111111111111with 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
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