Skip to main content

View Transactions

After completing the Process Process guide, you may want to pull detailed information about the payment and transactions.

Getting Started

To get started, you will need a PublicSquare Account.

Get your Secret Key

Next you will need your Secret Key. Go to your Developers section and click Reveal for your Secret Key and copy the value.

Save the Secret Key as it will be used in the next steps of this guide.

Retrieve a Payment

We will need to reference the payment's transaction_id to pull information about the payment.

For example, given you have a payment:

{
"id": "pmt_2YKewBonG4tgk12MheY3PiHDy",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "successful",
"transaction_id": "trx_95rvMJvAVeG68W4NtLdfkN3LG",
...
}

We need to make a call to (Get Transaction)(/api/get-transaction-by-id) endpoint:

Get Transaction by ID
curl 'https://api.publicsquare.com/transactions/trx_95rvMJvAVeG68W4NtLdfkN3LG?include_type=true' \
-H 'X-API-KEY: <API_KEY>' \

Given the above examples, you should see a transaction response similar to:

{
"id": "trx_95rvMJvAVeG68W4NtLdfkN3LG",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "successful",
"amount": "1000",
"fee_amount": "36",
"net_amount": "964",
"currency": "USD",
"type_id": "pmt_2YKewBonG4tgk12MheY3PiHDy",
"type": "payment",
"payment": {
"id": "pmt_2YKewBonG4tgk12MheY3PiHDy",
"account_id": "acc_B518niGwGYKzig6vtrRVZGGGV",
"environment": "test",
"status": "successful",
"transaction_id": "trx_95rvMJvAVeG68W4NtLdfkN3LG",
"amount": "1000",
"amount_charged": "1000",
"amount_refunded": "0",
"refunded": "false",
"currency": "USD",
"payment_method": {
"card": {
"id": "card_AjkCFKAYiTsjghXWMzoXFPMxj",
"cardholder_name": "John Smith",
"last4": "4242",
"exp_month": "12",
"exp_year": "2025",
"fingerprint": "CC2XvyoohnqecEq4r3FtXv6MdCx4TbaW1UUTdCCN5MNL"
}
},
"customer": {
"id": "cus_7Ay5mcUXAxwrN6wQEQUVEHBCJ",
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@email.com",
},
"billing_details": {
"address_line_1": "111 Test St.",
"city": "Des Moines",
"state": "IA",
"postal_code": "51111",
"country": "US"
},
"shipping_address": {
"address_line_1": "111 Colorado Ave.",
"address_line_2": "Apt 403",
"city": "Des Moines",
"state": "IA",
"postal_code": "51111",
"country": "US"
},
"created_at": "2024-06-30T01:02:29.212Z",
"modified_at": "2024-06-30T01:02:29.212Z"
},
"created_at": "2024-06-30T01:02:29.212Z",
"modified_at": "2024-06-30T01:02:29.212Z"
}

Conclusion

This guide showed you how to retrieve a transaction. Every payment, refund, and settlement in the system generates a transaction.