Skip to main content
GET
/
Gateway
/
v
{version}
/
Transaction
/
by-ref
/
{identifier}
curl --request GET \
  --url https://gateway.dev.waypay.live/Gateway/v1/Transaction/by-ref/550e8400-e29b-41d4-a716-446655440000 \
  --header 'SWICH-API-Key: pk_test_xxxxxxxx'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 1000.00,
  "currency": "PKR",
  "fee": 25.00,
  "netAmount": 975.00,
  "txType": 0,
  "txnType": "Payment",
  "description": "Product Purchase",
  "transactionNotes": "Payment completed successfully",
  "txnprovider": "JazzCash",
  "txnRef": "WP20251212123456",
  "status": 3,
  "statusText": "Success",
  "createdAtUtc": "2025-12-12T10:30:00Z",
  "isLive": false,
  "transactionMode": "Test",
  "merchantOrderRef": "ORD123456",
  "paymentIntentId": "770e8400-e29b-41d4-a716-446655440000",
  "appliedFeeRuleName": "Standard Fee",
  "feeCalculationBreakdown": "2.5% of 1000.00 = 25.00"
}

Overview

Retrieve detailed information about a specific transaction using one of three identifiers: the payment intent ID, your merchant order reference, or the Waypay transaction reference. This flexibility allows you to query transactions using whichever identifier is most convenient for your system.

Path Parameters

identifier
string
required
Transaction identifier - can be one of three types:You can provide any of the following:
  • Payment Intent ID - The UUID returned when creating a payment (e.g., 550e8400-e29b-41d4-a716-446655440000)
  • Merchant Order Reference - Your orderRef provided when creating the transaction (e.g., ORD123456)
  • Transaction Reference - The txnRef returned by Waypay (e.g., WP20251212123456)
Recommended: Use your merchant order reference for the easiest integration with your existing systems.
version
string
required
API version (e.g., “1”)

Response

id
uuid
Unique transaction identifier
amount
number
Transaction amount
currency
string
Currency code (e.g., “PKR”, “USD”)
fee
number
Transaction processing fee
netAmount
number
Net amount after fees
txType
integer
Transaction type:
  • 0 - Payment
  • 1 - Refund
  • 2 - Payout
  • 3 - Settlement
  • 4 - Fee
  • 5 - Adjustment
  • 6 - Chargeback
  • 7 - Reversal
  • 8 - Transfer
txnType
string
Transaction type description
description
string
Transaction description
transactionNotes
string
Additional transaction notes
txnprovider
string
Payment provider used
txnRef
string
Transaction reference number
status
integer
Transaction status:
  • 1 - Pending
  • 2 - Processing
  • 3 - Success
  • 4 - Failed
  • 5 - Cancelled
  • 6 - Expired
  • 7 - Refunded
  • 8 - PartiallyRefunded
  • 9 - Disputed
  • 10 - OnHold
  • 11 - RequiresAction
  • 12 - Declined
statusText
string
Human-readable status description
createdAtUtc
datetime
Transaction creation timestamp (UTC)
isLive
boolean
Whether this is a live or test transaction
transactionMode
string
Transaction mode (e.g., “Live”, “Test”)
merchantOrderRef
string
Your merchant order reference (the orderRef you provided)
paymentIntentId
uuid
Payment intent identifier
appliedFeeRuleName
string
Name of the fee rule applied to this transaction
feeCalculationBreakdown
string
Detailed breakdown of how the fee was calculated
curl --request GET \
  --url https://gateway.dev.waypay.live/Gateway/v1/Transaction/by-ref/550e8400-e29b-41d4-a716-446655440000 \
  --header 'SWICH-API-Key: pk_test_xxxxxxxx'
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "amount": 1000.00,
  "currency": "PKR",
  "fee": 25.00,
  "netAmount": 975.00,
  "txType": 0,
  "txnType": "Payment",
  "description": "Product Purchase",
  "transactionNotes": "Payment completed successfully",
  "txnprovider": "JazzCash",
  "txnRef": "WP20251212123456",
  "status": 3,
  "statusText": "Success",
  "createdAtUtc": "2025-12-12T10:30:00Z",
  "isLive": false,
  "transactionMode": "Test",
  "merchantOrderRef": "ORD123456",
  "paymentIntentId": "770e8400-e29b-41d4-a716-446655440000",
  "appliedFeeRuleName": "Standard Fee",
  "feeCalculationBreakdown": "2.5% of 1000.00 = 25.00"
}

Query by Payment Intent ID, Order Reference, or Transaction Reference

This endpoint supports querying transactions using three types of identifiers, giving you maximum flexibility:

Payment Intent ID (paymentIntentId)

  • What it is: A UUID generated by Waypay when you create any payment, deposit, or withdrawal order
  • Format: UUID (e.g., 550e8400-e29b-41d4-a716-446655440000)
  • Where to get it: Returned immediately in the API response when creating a transaction
  • Use case: Query transactions right after creation using the payment intent ID you just received

Merchant Order Reference (orderRef)

  • What it is: Your own order reference that you provided when creating the transaction
  • Format: Your custom format (e.g., ORD123456, ORDER-2025-001, INV-2025-12345)
  • Where to get it: From your own system/database
  • Use case: Query transactions using your internal order tracking system without storing Waypay IDs

Transaction Reference (txnRef)

  • What it is: A unique reference generated by Waypay after the transaction is processed
  • Format: Waypay’s format (e.g., WP20251212123456)
  • Where to get it: Returned in webhook notifications and transaction details
  • Use case: Query transactions when you have the Waypay transaction reference from webhooks or receipts
Recommended Approach: Use your merchant order reference (orderRef) for the easiest integration. This allows you to query transactions without storing any Waypay-generated identifiers.

Which Identifier Should You Use?

IdentifierBest ForAvailabilityFormat
Payment Intent IDImmediate status checks after creating a transactionAvailable instantly in API responseUUID
Order ReferenceIntegration with existing order management systemsAlways available (you provide it)Your custom format
Transaction ReferenceWebhook processing and customer receiptsAvailable after transaction processingWaypay format

Response Fields Explained

Transaction Types (txType)

The txType field indicates what type of transaction this is:
ValueTypeDescription
0PaymentCustomer payment/deposit
1RefundMoney returned to customer
2PayoutWithdrawal/disbursement
3SettlementMerchant payout
4FeeTransaction fee
5AdjustmentBalance adjustment
6ChargebackDisputed transaction reversal
7ReversalTransaction reversal
8TransferInternal transfer

Transaction Status (status)

The status field shows the current state of the transaction:
ValueStatusDescription
1PendingTransaction initiated, awaiting completion
2ProcessingCurrently being processed
3SuccessTransaction completed successfully
4FailedTransaction failed
5CancelledTransaction cancelled by user or system
6ExpiredTransaction expired (timeout)
7RefundedFully refunded
8PartiallyRefundedPartially refunded
9DisputedUnder dispute/chargeback
10OnHoldTemporarily on hold
11RequiresActionRequires additional action
12DeclinedPayment declined

Best Practices

  • Use Order Reference: Query by your orderRef for the easiest integration - no need to store Waypay identifiers
  • Store Payment Intent ID: If you need immediate status checks, save the paymentIntentId returned from transaction creation
  • Poll Wisely: Don’t poll too frequently. Use webhooks for real-time updates instead
  • Handle 404s: A 404 response means the identifier doesn’t exist or you don’t have access to it
  • Store Transaction IDs: Save the id field from responses for your records and reconciliation
  • Check Status: Always verify the status field before processing the transaction
  • Fee Transparency: Use feeCalculationBreakdown to understand fee calculations
  • Reconciliation: Use merchantOrderRef to match transactions with your orders
  • Live vs Test: Check isLive to distinguish between production and test transactions
  • Choose the Right Identifier: Use payment intent ID for immediate checks, order reference for long-term tracking

Use Cases

Check transaction status immediately after creating a payment using the payment intent ID.
// Step 1: Create payment
const paymentResponse = await createPayment({
  amount: 1000,
  orderRef: { orderRef: 'ORD123456' },
  description: 'Product Purchase'
});

// Step 2: Immediately check status using payment intent ID
const transaction = await getTransactionByRef(paymentResponse.paymentIntentId);
console.log(`Payment ${paymentResponse.paymentIntentId} status: ${transaction.statusText}`);
Display transaction status to customers on your order status page by querying with your order reference.
const orderRef = 'ORD123456'; // From your database
const transaction = await getTransactionByRef(orderRef);
console.log(`Order ${orderRef} status: ${transaction.statusText}`);
Verify webhook notifications by querying the transaction using the txnRef from the webhook payload.
function handleWebhook(webhookData) {
  const txnRef = webhookData.data.TransactionReference;
  const transaction = await getTransactionByRef(txnRef);
  // Verify the webhook data matches the actual transaction
  if (transaction.status === 3) {
    fulfillOrder(transaction.merchantOrderRef);
  }
}
Match transactions with your internal orders for accounting and reconciliation.
const internalOrders = await getOrdersFromDatabase();
for (const order of internalOrders) {
  const transaction = await getTransactionByRef(order.orderRef);
  await updateOrderStatus(order.id, transaction.status);
}
Look up transaction details when customers contact support with their order number.
const customerOrderNumber = 'ORD123456';
const transaction = await getTransactionByRef(customerOrderNumber);
console.log(`Transaction Status: ${transaction.statusText}`);
console.log(`Amount: ${transaction.amount} ${transaction.currency}`);
console.log(`Payment Method: ${transaction.txnprovider}`);
console.log(`Waypay Reference: ${transaction.txnRef}`);
Generate detailed payment receipts using the payment intent ID or transaction reference.
const paymentIntentId = '550e8400-e29b-41d4-a716-446655440000';
const transaction = await getTransactionByRef(paymentIntentId);

const receipt = {
  orderId: transaction.merchantOrderRef,
  amount: transaction.amount,
  fee: transaction.fee,
  netAmount: transaction.netAmount,
  transactionRef: transaction.txnRef,
  paymentMethod: transaction.txnprovider,
  status: transaction.statusText,
  date: transaction.createdAtUtc
};

await generateReceipt(receipt);

Common Error Scenarios

ErrorCauseSolution
404 Not FoundIdentifier doesn’t exist or access deniedVerify the identifier is correct and belongs to your merchant account
400 Bad RequestInvalid identifier formatEnsure the identifier string is properly formatted (UUID for payment intent, your format for order ref)
401 UnauthorizedInvalid or missing API keyCheck your API key is correct and has not expired

Security Considerations

  • Keep API keys secure and never expose them in client-side code
  • Use HTTPS for all API communications
  • Implement proper error handling for failed queries
  • Log all transaction queries for audit purposes
  • Rate limit your queries to avoid overwhelming the API
  • Validate transaction data before using it in your system

Next Steps