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.
Here's what you need to know about creating swipe events:
- 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 a
swipe-id
and anevent-id
. These IDs are 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-qualifier
: Leave this field blank.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 and set variables used in the headers and payload of the request: 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
,swipe-id
, andswipe-processor-token
to get this script to work.
Sample Payloads
{
"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",
}