Making a Credit Card Charge

How to Make a Simple Charge

Required Data

Data you will need to make a Simple Charge
Where to get this data from

The Amount to charge

A screenflow field or data stored in a record.

Tokenized credit card number

Output from the Paytram Credit Card Input custom Flow component

The raw credit card info is entered into a special protected field and traded for a secure token. This token is used to process the transaction through Salesforce.

Named Credential

API Name of the Credential you created with the Configuration steps above. Note: Cardknox has 2 named credentials. Some processes require specifying one of them, and some both.

This will generally be constant, but can vary if you are using Paytram with multiple gateway accounts

External Credential

API Name of the Credential you created with the Configuration steps above.

This will usually be constant on all Flows you create to use with Paytram

Paytram External Credential

API Name of the Credential you created with the Configuration steps above.

This will usually be constant on all Flows you create to use with Paytram

Logical next steps to do in your Screenflow

If the transaction was successful
If the transaction failed

Create a record in Salesforce that represents the charge that was made (e.g., a Payment record)

Show the error message response

Create your Flow

Start by creating a new Screen Flow. Collect the required data for the charge, either from record data, or screen input fields.

Below is a sample Flow that illustrates getting an Opportunity record (which has an Amount field that can be used as the Amount to Charge), and displaying a screen with user inputs for the credit card number. This screen can also contain additional, optional info like Billing Name and Address, if desired, or a currency field to enter the Amount to Charge manually. The Paytram Charge Card Subflow is mapped with data, and will return a response with a success or error message. If successful, a payment record is created. If not, an error message is displayed on the Flow Screen.

Tip: You may want to add additional fields in your payment form such as Name, address, email, etc. You can add fields for that data and prefill the fields from a related Contact or Account record.

You will need to add two of the custom Paytram components to this Screen Flow. These components are found in the Custom Components section of the Flow components area (the left side of every Flow Screen page).

The Credit Card Input (prefixed with the name of the gateway) component displays the secure credit card, expiration, and CVV fields on the page. These fields will not display on the Screen Flow builder canvas, but will display in debug or when the Flow runs. This component trades the raw credit card information with a secure token, which is used in the next step in the Flow to make the actual charge.

The Paytram Process Card Button component is used in place of the default ‘Next’ or ‘Make Charge’ button so you will likely want to place it on the bottom of the screen. This button is responsible for securely trading the raw credit card information for the secure token, and then navigating to the next step of the Flow.

  1. Add both components to your Screen Flow.

  2. You must configure the Paytram Process Card Button component first.

  3. The API Name is your choice. This example uses ‘processbtn’.

  4. The Label will be the text of the button. For example, ‘Process Card’, ‘Next’, or ‘Make Charge’ are suitable labels, but you can enter any term appropriate to your use case.

  5. Navigate on Click checkbox: This is almost always set to True (GlobalConstant.True). It sets the behavior of the Flow to move to the next Flow Component when clicked.

  1. Next, configure the Credit Card Input component.

  2. The API Name is your choice. In this example, the API Name is ‘credit_card_fields’. Keep note of the name as you will need it for the next step in your Flow.

  3. External Named Credential: Example ‘AcceptBlueExternal’, ‘AuthorizenetExternal’, or 'stripeExternal' (Important: Use the exact API Name, not the Label.) Refer to the Configuration section above if you are unsure about the correct name.

  4. Named Credential Paytram: Example ‘AcceptBluePaytram’ or ‘AuthorizenetPaytram’ or 'stripePaytram' (Important: Use the exact API Name, not the Label.) Refer to the Configuration section above if you are unsure about the correct name.

  5. Action: The process card button component.‘Action’. The first part of this will be the API name of the Process Card Button component lat you named earlier. For example, ‘processbtn.action’.

  6. Label: Credit Card field label (Optional)

  7. Using Sandbox: True or False depending on whether you are using a Sandbox.

  8. Because you will use the Paytram Process Card Button instead of the standard ‘Next’ or ‘Finish’ button, configure the Flow Footer to hide the standard button.

  9. Once you have completed the fields, click Done.

Tip: You may want to store the values used for credentials as Flow Variables or Constants so they can be reused in future components in this Flow. This is valuable for complex flows that handle many scenarios.

Transacting the charge

To transact the credit card charge, you will next configure the Charge Card/ACH subflow and map its fields. Note: The actual name of the subflow is prefixed with the gateway name- so you will see something like 'Paytram - Accept Blue - Charge Card/ACH')

  1. Add the Charge Card/ACH Subflow to your Flow canvas below your Screen Flow element. Map the Output fields as follows:

  2. CC_CreditCardToken: This is the output token of the Credit Card Input component you configured in the previous step. In this example, the API name is ‘credit_card_fields’, therefore the path is All Resources > creditcardscreen > credit_card_fields > Credit Card Token.

  3. Info_Amount: This maps the value for the amount you want to charge. This may be sourced from a previous step in the screenflow or directly from a record, depending on how you designed the Flow.

  4. Info_CardorACHorAUTH: Enter ‘Card’ or ‘ACH’ or ‘AUTH, depending on whether you want to charge a Credit Card, charge an ACH method, or charge (capture) a previously made Credit Card Authorization. To make an AUTH transaction (Authorize) instead of a charge (Capture), see here.

  5. Info_NamedCredential: Enter the API name of the Named credential. In this example, ‘AcceptBlue’.

  6. The other ‘Info_’ fields are self-explanatory and optional.

It is good practice to map the address fields for the AVS match that helps with security and results in lower credit card fees. As needed, you map name, address, phone, email, etc. to pass those fields to the gateway. As mentioned above, You can source that data from screenflow input fields, or directly from records utilizing the standard Get Records component.

Handling the Response

When the Flow runs and returns a response from the Gateway, it will contain the following Values.

Field
Type
Notes

WasError

Boolean

True or False if there was and Error processing the transaction

ErrorMessage

Text

The error message returned from the Gateway

TransactionID

Text

If succesful, the transaction ID will appear here.

GatewayLogRecord

Record

A record created with every call to the gateway (charge, refund, save card, etc), that can be used for auditing and record keeping

Use these values to update or create records according to your workflow needs.

Tip: You will likely want to add additional functions to the Flow. For example, you might want to add a step to create a Salesforce Payment Record if the payment was successful or you might want to display an Error on a Screen Component if it wasn’t.

It is important to store the Transaction ID with the payment record, so it can be used in the future for Voids or Refunds. It is good practice to reference the Gateway Log in a lookup field on the payment record as well.

Last updated