Card Batch
Initiate a new card batch for processing multiple transactions efficiently within the Vortex platform.
Card Batch
This page provides a step-by-step guide to creating and closing a card batch in Vortex, using both structured JSON requests and JavaScript code examples. It covers the necessary transaction payloads, request formats, and response handling for seamless integration.
In this guide, you’ll find:
- Instructions on how to create a card batch with a sample payload.
- A code example for executing the card batch creation process in JavaScript.
- Guidance on closing an active card batch with an example script.
Vortex Envelope for Card Batch Transactions
To create a card batch in Vortex, structure your request as follows:
{
"arguments": [
{
"payment transaction payload as JSON"
}
],
"procedure": "batch.create",
"class": "rpc",
"requestId": "UUID"
}Ensure to replace "payment transaction payload as JSON" and "UUID" with your specific transaction details and a unique identifier, respectively.
Sample Payload
Below is an example payload to create a card batch:
{
"number": 976,
"reference": "MyReference718843069923",
"autoCloseTime": "2022-11-16T19:23:45Z",
"externalId": "Test233720977882601514",
"operatorInitials": "DKw",
"merchant": {
"number": "8739290200300003",
"processor": {
"name": "TSYS",
"bankNumber": "1234"
}
}
}This payload includes batch number, reference, scheduled auto-close time, an external identifier, operator initials, and merchant details.
Code Example
Execute a card batch creation with the following JavaScript example using the Broker Client Library:
const broker = require('@pps/broker-client');
const client = new broker.PaymentClient('EOS_YOUR_TENANT_TOKEN');
async function createCardBatch() {
try {
await client.open();
const transaction = {
// Insert your payload here (refer to the Sample Payload above)
};
const response = await client.rpc.cardBatch.create(transaction);
console.log(`Batch ID: ${response.id}`);
} catch (error) {
console.error('Failed to create card batch:', error);
} finally {
await client.close();
}
}
await createCardBatch();Remember to replace 'EOS_YOUR_TENANT_TOKEN' with your actual tenant token.
Response
Upon successful creation of a card batch, the response will look like this:
{
"code": 200,
"error": null,
"value": {
"id": "QwYFqSBmp9xNBOxTz0EkHw=="
},
"class": "response",
"id": "b1e8e0d1-17e8-5e21-ac96-91dca63a910d"
}Close Card Batch
Finalize an existing card batch to complete its processing.
Request
Code Example
Close an active card batch using the following code snippet:
const broker = require('@pps/broker-client');
const client = new broker.PaymentClient('EOS_YOUR_TENANT_TOKEN');
async function closeCardBatch() {
try {
await client.open();
await client.rpc.cardBatch.close('externalId');
console.log('Card batch closed successfully.');
} catch (error) {
console.error('Failed to close card batch:', error);
} finally {
await client.close();
}
}
await closeCardBatch();In this example, replace 'EOS_YOUR_TENANT_TOKEN' with your tenant token and 'externalId' with the specific ID of the batch you wish to close.
const broker = require('@pps/broker-client');
const client = new broker.PaymentClient('EOS_YOUR_TENANT_TOKEN');
async function getCardBatch() {
try {
await client.open();
const batch = await client.rpc.cardBatch.get('externalId');
console.log(batch);
} catch (error) {
console.error('Card batch not found', error);
} finally {
await client.close();
}
}
await getCardBatch();Updated 7 months ago
