Create swipe event

This request creates a swipe event.

   Click here to learn more about this request

When a borrower uses a credit card to make a purchase, a seemingly singular transaction can consist of multiple operations in the background. For example, when a cardholder uses their card to purchase an item, an authorization operation occurs to ensure the line of credit has sufficient funds; later, when the transaction amount has been confirmed, a clearing operation occurs to finalize the transaction and draw on the account.

In some systems, these two operations represent two transactions with separate identifiers. In LoanPro, a single swipe ID is used throughout the transaction’s lifetime and swipe events are the actions that occur on the swipe. Each swipe event is represented by its own ID and is associated with a parent swipe, eliminating the need to build a solution that keeps track of how separate transactions are related to one another. As a transaction is created, updated, cleared, voided, etc., swipe events are created to update the swipe.

Note the following when using this request:

There are multiple types of swipe events, and a list of the available options can be found below in the payload details.

Swipe events update the handling of funds on a swipe. For example, a swipe event can alter the authorized, cleared, voided, disputed, and returned amounts of a swipe.

The payload of this request requires an event-id. This ID is generated via a Pre-request script.

The metadata field will likely include information that will be important to the issuer.

📘

This request uses a special set of headers.

Here's a breakdown of what they mean:

  • x-user-id : This is an ID associated with your Secure Payments account, and you will need to input this value yourself. You can also locate this value by logging in to your Secure Payments account and navigate to the Profile tab located within the Settings section.
  • x-signature : This header uses the swipe processor token from your account to create an SHA512 hash signature.
  • x-request-id : This is a randomly generated GUID that represents the request to create a swipe.

🚀

Testing this request yourself in a Postman workspace?

We've written a Pre-request Script to help you get this request working in your own workspace:

// Generate a swp-secret token and set it at the environment level:
let uuid = require('uuid');
pm.collectionVariables.set('event-id', uuid.v4());

const message = pm.request.body.raw.replace('{{swipe-id}}', pm.collectionVariables.get('swipe-id')).replace('{{event-id}}', pm.collectionVariables.get('event-id')).replace('{{card-uuid}}', pm.collectionVariables.get('card-uuid'));
var hashHmacSHA512 = CryptoJS.HmacSHA512(message, pm.collectionVariables.get('swp-secret')).toString();
pm.collectionVariables.set('signature', hashHmacSHA512);

Copy the script above and paste it into the Pre-request Script text section of your request.

The script will automatically generate some of the headers you'll need for this request; however, it will require a little bit of work on your end. You'll need to set some collection-level variables that represent card-uuid, event-id, and swipe-processor-token to get this script to work.


{
    "event-id": "9fc06537-2766-4f1b-b891-c9566be49cd5",
    "swipe-id": "e39ed072-3ebd-4e21-bd18-4adf4f67f5e3",
    "card-uuid": "54e7a88f-5c8b-464b-abc5-fe9f20d7a436",
    "amount": 24.97,
    "type": "clearing",
    "notes": "This is an optional note.",
    "metadata": "{}"
}
{
    "event-id": "9fc06537-2766-4f1b-b891-c9566be49cd5",
    "swipe-id": "e39ed072-3ebd-4e21-bd18-4adf4f67f5e3",
    "card-uuid": "54e7a88f-5c8b-464b-abc5-fe9f20d7a436",
    "amount": 24.97,
    "type": "clearing",
}

Results

Returns swipe event information and card object after a successful swipe event creation. A 200 response can be an error with a status and error_v2 object indicating the type of error (e.g. invalid card-uuid).

Language
Credentials
Click Try It! to start a request and see the response here!