Fetch Payment Information

Fetch Payment Information by ID

Retrieve comprehensive details about a payment using its unique identifier. This endpoint returns all information about the payment including order details, customer information, payment method, and transaction status.


Fetch Payment Info Flow


Retrieve Payment Information

To fetch detailed information about a payment, send a GET request with the paymentId.

Request

$curl -H 'Content-Type: application/json' \
> -H 'API-KEY: YOUR_API_KEY' \
> -H 'API-SECRET: YOUR_API_SECRET' \
> -H 'MERCHANT-ID: YOUR_MERCHANT_ID' \
> YOUR_API_URL/payments/:paymentId

Response

1{
2 "paymentId": "550e8400-e29b-41d4-a716-446655440000",
3 "orderId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
4 "terminalId": "TERM123456",
5 "merchantId": "MERCH789",
6 "paymentStatus": "COMPLETED",
7 "paymentMethod": "CARD",
8 "amount": {
9 "value": 150.00,
10 "currency": "NOK"
11 },
12 "customer": {
13 "name": "John Doe",
14 "email": "john.doe@example.com",
15 "phone": "+4712345678"
16 },
17 "card": {
18 "maskedPan": "****1234",
19 "cardScheme": "VISA",
20 "expiryMonth": "12",
21 "expiryYear": "2025"
22 },
23 "orderLines": [
24 {
25 "id": "ITEM001",
26 "name": "Product Name",
27 "quantity": 2,
28 "unitPrice": 75.00
29 }
30 ],
31 "timestamps": {
32 "created": "2024-01-15T10:00:00Z",
33 "authorized": "2024-01-15T10:01:00Z",
34 "completed": "2024-01-15T10:01:30Z"
35 },
36 "refunds": [],
37 "metadata": {}
38}

Response Attributes

Main Payment Attributes

AttributeTypeDescription
paymentIdStringUnique identifier for the payment
orderIdStringAssociated order identifier
terminalIdStringTerminal used for the payment
merchantIdStringMerchant identifier
paymentStatusStringCurrent payment status
paymentMethodStringPayment method used (CARD, SVIPPS, NSWISH, KLARNA, CTOKEN)

Amount Object

AttributeTypeDescription
valueNumberTransaction amount
currencyStringISO 4217 currency code

Customer Object

AttributeTypeDescription
nameStringCustomer’s full name
emailStringCustomer’s email address
phoneStringCustomer’s phone number

Card Object (when applicable)

AttributeTypeDescription
maskedPanStringMasked card number (last 4 digits visible)
cardSchemeStringCard scheme (VISA, MASTERCARD, etc.)
expiryMonthStringCard expiry month
expiryYearStringCard expiry year

Timestamps Object

AttributeTypeDescription
createdStringISO 8601 timestamp when payment was created
authorizedStringISO 8601 timestamp when payment was authorized
completedStringISO 8601 timestamp when payment was completed
voidedStringISO 8601 timestamp when payment was voided (if applicable)
refundedStringISO 8601 timestamp when payment was refunded (if applicable)

Refunds Array

AttributeTypeDescription
refundIdStringUnique identifier for the refund
amountNumberRefund amount
statusStringRefund status
timestampStringWhen refund was processed
reasonStringRefund reason code

Order Lines Array

Each order line contains:

AttributeTypeDescription
idStringUnique line item identifier
nameStringProduct/service name
descriptionStringProduct/service description
quantityNumberNumber of items
unitPriceNumberPrice per unit
totalAmountNumberTotal for this line (quantity × unitPrice)
vatPercentNumberVAT percentage
vatAmountNumberVAT amount

Use Cases

1. Order Fulfillment

Retrieve payment details to verify completion before shipping:

1async function verifyPaymentForShipping(paymentId) {
2 const payment = await fetchPaymentInfo(paymentId);
3
4 if (payment.paymentStatus === 'COMPLETED') {
5 // Proceed with shipping
6 return {
7 canShip: true,
8 customer: payment.customer,
9 orderLines: payment.orderLines
10 };
11 }
12
13 return { canShip: false, reason: payment.paymentStatus };
14}

2. Customer Support

Display payment history and details for customer inquiries:

1async function getPaymentDetailsForSupport(paymentId) {
2 const payment = await fetchPaymentInfo(paymentId);
3
4 return {
5 transactionId: payment.paymentId,
6 amount: `${payment.amount.value} ${payment.amount.currency}`,
7 status: payment.paymentStatus,
8 cardLast4: payment.card?.maskedPan,
9 timestamp: payment.timestamps.completed
10 };
11}

3. Refund Processing

Check payment details before processing a refund:

1async function canRefundPayment(paymentId) {
2 const payment = await fetchPaymentInfo(paymentId);
3
4 const totalRefunded = payment.refunds
5 .reduce((sum, r) => sum + r.amount, 0);
6
7 const remainingRefundable = payment.amount.value - totalRefunded;
8
9 return {
10 canRefund: payment.paymentStatus === 'COMPLETED' && remainingRefundable > 0,
11 maxRefundAmount: remainingRefundable
12 };
13}

Error Handling

Payment Not Found

1{
2 "error": "PAYMENT_NOT_FOUND",
3 "message": "No payment found with the specified ID",
4 "paymentId": "invalid-payment-id"
5}

Invalid Payment ID Format

1{
2 "error": "INVALID_PAYMENT_ID",
3 "message": "Payment ID must be a valid UUID",
4 "paymentId": "malformed-id"
5}

EndpointPurpose
GET /payments/:paymentId/statusQuick status check only
GET /orders/:orderIdFull order details including multiple payments
GET /orders/:orderId/tokensRetrieve tokenization data