COPY Transaction Examples
A guide for using the PayConex API to copy existing transactions between agent and sub-accounts.
Overview
The COPY transaction type allows you to duplicate an existing transaction from an agent account to one of its sub-accounts. This feature was specifically built for agent/sub-account structures and is particularly useful for scenarios where you need to replicate a transaction across different merchant accounts while maintaining transaction integrity.
API URLs
For the certification test environment:
https://cert.payconex.net/api/qsapi/3.8
For the production environment:
https://secure.payconex.net/api/qsapi/3.8
Basic COPY Transaction
At its most basic level, a COPY transaction requires the following parameters:
Required Parameters
Parameter | Type | Description |
---|---|---|
account_id | String | The agent account ID initiating the copy |
api_accesskey | String | API access key for the agent account |
dest_account | String | The destination sub-account ID (must be a sub-account of the agent) |
dest_apikey | String | API access key for the destination sub-account |
transaction_type | String | Must be set to "COPY" |
token_id | String | The transaction ID of the original transaction to copy |
response_format | String | Response format (JSON recommended) |
Basic Example
curl --request POST \
--url https://cert.payconex.net/api/qsapi/3.8 \
--header 'Content-Type: application/json' \
--data '{
"account_id": "220614982061",
"api_accesskey": "your_agent_api_key",
"dest_account": "220614965201",
"dest_apikey": "your_sub_account_api_key",
"transaction_type": "COPY",
"token_id": "000000001146",
"response_format": "JSON"
}'
Basic Response
{
"transaction_id": "000000000226",
"tender_type": "CARD",
"transaction_timestamp": "2025-09-05 16:19:18",
"card_brand": "VISA",
"transaction_type": "STORE",
"last4": "9990",
"card_expiration": "1230",
"authorization_message": "APPROVED",
"request_amount": "0",
"transaction_amount": "0",
"error": false,
"error_code": "0",
"error_message": null,
"error_msg": null,
"dest_account": "220614965201"
}
Advanced COPY Transaction with Additional Data
To preserve customer information and other transaction data from the original transaction, you can include additional parameters in your COPY request.
Additional Optional Parameters
Parameter | Type | Description |
---|---|---|
first_name | String | Customer's first name |
last_name | String | Customer's last name |
street_address1 | String | Customer's street address |
city | String | Customer's city |
state | String | Customer's state |
zip | String | Customer's ZIP code |
phone | String | Customer's phone number |
email | String | Customer's email address |
custom_data | String | Base64-encoded custom data |
Advanced Example
curl --request POST \
--url https://cert.payconex.net/api/qsapi/3.8 \
--header 'Content-Type: application/json' \
--data '{
"account_id": "220614982061",
"api_accesskey": "your_agent_api_key",
"dest_account": "220614965201",
"dest_apikey": "your_sub_account_api_key",
"transaction_type": "COPY",
"token_id": "000000001166",
"response_format": "JSON",
"first_name": "Ryan",
"last_name": "Cox",
"street_address1": "123 N Main St.",
"city": "Tulsa",
"state": "OK",
"zip": "12345",
"phone": "9182362857",
"email": "[email protected]",
"custom_data": "VGhpcyBpcyBhIHRlc3QgZm9yIHRoZSBjdXN0b20gZGF0YSBmaWVsZA=="
}'
Advanced Response
{
"transaction_id": "000000000226",
"tender_type": "CARD",
"transaction_timestamp": "2025-09-05 16:19:18",
"card_brand": "VISA",
"transaction_type": "STORE",
"last4": "9990",
"card_expiration": "1230",
"authorization_message": "APPROVED",
"request_amount": "0",
"transaction_amount": "0",
"first_name": "Ryan",
"last_name": "Cox",
"custom_data": "VGhpcyBpcyBhIHRlc3QgZm9yIHRoZSBjdXN0b20gZGF0YSBmaWVsZA==",
"error": false,
"error_code": "0",
"error_message": null,
"error_msg": null,
"dest_account": "220614965201"
}
Preserving Data from Original Transaction
To automate the inclusion of additional data fields, you should capture the data from the original QSAPI transaction response when the transaction is first processed, then include that data in your subsequent COPY request.
Example: Original Transaction Response
When you first process a transaction, capture the response data for later use in COPY requests:
{
"transaction_id": "000000001166",
"tender_type": "CARD",
"transaction_timestamp": "2025-09-05 14:02:48",
"card_brand": "VISA",
"transaction_type": "SALE",
"last4": "9990",
"card_bin": "41249399",
"card_expiration": "1230",
"authorization_code": "096674",
"authorization_message": "APPROVED",
"request_amount": 10,
"transaction_amount": 10,
"first_name": "Ryan",
"last_name": "Cox",
"keyed": true,
"swiped": false,
"entry_mode": "keyed",
"transaction_approved": true,
"custom_data": "VGhpcyBpcyBhIHRlc3QgZm9yIHRoZSBjdXN0b20gZGF0YSBmaWVsZA==",
"currency": "USD",
"program": "STANDARD",
"program_card": "",
"network_transaction_id": "014248124936674",
"error": false,
"error_code": 0,
"error_message": null,
"error_msg": null
}
Why Use Original QSAPI Response Data
- Parameter Consistency: QSAPI responses use the same parameter names as QSAPI requests (e.g.,
first_name
,last_name
) - Data Accuracy: Captures the exact data that was processed in the original transaction
- No Additional API Calls: Avoids the need for separate retrieval requests
- Real-time Availability: Data is immediately available when the original transaction completes
Response Format
COPY Transaction Response Fields
Field | Type | Description |
---|---|---|
transaction_id | String | The new transaction ID for the copied transaction |
tender_type | String | The tender type (typically "CARD") |
transaction_timestamp | String | Timestamp when the copy was created |
card_brand | String | The card brand (VISA, MASTERCARD, etc.) |
transaction_type | String | Will be "STORE" for copied transactions |
last4 | String | Last 4 digits of the card |
card_expiration | String | Card expiration date |
authorization_message | String | Authorization message (typically "APPROVED") |
request_amount | String | Requested amount (typically "0" for copies) |
transaction_amount | String | Transaction amount (typically "0" for copies) |
first_name | String | Customer first name (if included in request) |
last_name | String | Customer last name (if included in request) |
custom_data | String | Custom data (if included in request) |
error | Boolean | Indicates if there was an error |
error_code | String | Error code (0 for success) |
error_message | String | Error message (null for success) |
error_msg | String | Alternative error message field |
dest_account | String | The destination account ID |
Important Limitations
Data Preservation
- Automatic Copying: Only basic transaction data (card info, amounts, etc.) is automatically copied
- Manual Inclusion Required: Customer information, custom data, and other fields must be explicitly included in the COPY request
Account Structure Requirements
- Agent/Sub-account Only: The destination account must be a sub-account of the agent account
- Authentication: Both agent and sub-account API keys are required
- Transaction Type: Copied transactions are created as "STORE" type transactions
Updated about 8 hours ago