Payments

Check Payment Status

Payment status is crucial for merchants to track payments being processed, completed, or cancelled. You can retrieve the status of a payment using the Check Payment Status API.

Prerequisites

API Credentials

API-KEY, API-SECRET, and MERCHANT-ID

Payment ID

paymentId returned from the Initiate Payment API

Check Status

Include the paymentId in your request to the Check Payment Status API:

$curl -X GET \
> -H 'Content-Type: application/json' \
> -H 'API-KEY: your-api-key' \
> -H 'API-SECRET: your-api-secret' \
> -H 'MERCHANT-ID: your-merchant-id' \
> 'https://api.sagapay.no/payments/{paymentId}/status'

Payment Status Values

StatusDescription
PAYMENT_INITIATEDPayment has been initiated (waiting for user action)
PAYMENT_PROCESSINGPayment is being authorized
PAYMENT_PROCESSEDPayment has been successfully authorized
PAYMENT_COMPLETEDPayment is successfully completed (transactionId returned)
PAYMENT_FAILEDPayment failed (failureReason returned)
PAYMENT_CANCELLEDPayment cancelled by user or via terminal

You can also get payment status by integrating webhooks for real-time updates, eliminating the need for frequent polling.

On successful completion of a payment, an associated transaction record is created. The transaction details can be fetched using the Transaction APIs.


Fetch Payment Information by ID

Fetching payment information allows you to retrieve specific transaction details using the unique payment identifier. This helps resolve issues and verify payment records. You can also generate and display a receipt directly from the API response.

Prerequisites

API Credentials

API-KEY, API-SECRET, and MERCHANT-ID

Payment ID

paymentId from the Initiate Payment API

Fetch Payment Details

$curl -X GET \
> -H 'Content-Type: application/json' \
> -H 'API-KEY: your-api-key' \
> -H 'API-SECRET: your-api-secret' \
> -H 'MERCHANT-ID: your-merchant-id' \
> 'https://api.sagapay.no/payments/{paymentId}'

Response Attributes

AttributeDescription
paymentStatusStatus of the payment
transactionIdAvailable for completed or failed payments
merchantIdMerchant who performed the payment
terminalIdTerminal from which payment was made
orderIdOrder ID for the payment
paymentIdUnique ID of the payment
storeIdStore where payment was made
currencyCurrency of the payment
amountAmount in minor currency units (e.g., 1000 = 10.00)
methodPayment method used
typePayment type (purchase or return)
timestampTimestamp in ISO 8601 format
truncatedPanLast 4 digits of card PAN
cardLabelCard brand (AID Label)
posEntryModeEntry mode: 01 (Manual), 02 (Magnetic stripe), 07 (Chip with PIN)
terminalVerificationResultEMV terminal verification results
userMessageMessage from terminal
aidApplication Identifier of the card
customerResponseCode00 for approved, 05 for declined
cvmMethodCardholder Verification Method used
rrnRetrieval Reference Number (ISO 8583)
authenticationModeISSUER or CARD
arcAuthorization Response Code (if applicable)
tsiTransaction Status Information (if applicable)
voidedWhether payment has been voided

CVM Method Values

CodeDescription
1Offline plaintext PIN
2Online PIN
3Offline plaintext PIN/Signature
4Offline PIN
5Offline PIN/Signature
ESignature
FNo CVM

Manage Transactions

Fetch Transactions by ID

Use the Fetch Transactions by ID API to retrieve all transactions associated with an order ID, transaction ID, or payment ID. This is useful when a single order was paid through multiple partial payments.

Prerequisites

  • API credentials
  • paymentId, transactionId, or orderId of the transaction

Example Request

$curl -X GET \
> -H 'Content-Type: application/json' \
> -H 'API-KEY: your-api-key' \
> -H 'API-SECRET: your-api-secret' \
> -H 'MERCHANT-ID: your-merchant-id' \
> 'https://api.sagapay.no/transactions/{id}/list'

Response Attributes

AttributeDescription
transactionIdUnique identifier for the transaction
merchantIdMerchant who performed the transaction
storeIdStore where transaction occurred
terminalIdTerminal used for transaction
orderIdOrder ID for the transaction
paymentIdUnique payment identifier
referenceIdExternal reference ID
rrnRetrieval Reference Number (ISO 8583)
amountTransaction amount in minor currency units
currencyCurrency code (SEK, EUR, DKK, NOK)
methodPayment method (default: CARD)
typeTransaction type (purchase or return)
orderSummaryShort summary with line items
timestampISO 8601 timestamp
voidedWhether transaction has been voided
issuerCountryCountry of card issuer
interchangeDomainInterchange domain for processing
cardCategoryConsumer or Commercial
cardUsageDebit, Credit, or Prepaid
feeTransaction fees based on billing plan
settlementStatusPROCESSED, SETTLED, NOT_SETTLED, ERROR
payoutFinal amount transferred to merchant
settlementRefSettlement reference ID
settlementDateSettlement date (ISO format)
truncatedPanLast 4 digits of card PAN
cardLabelCard brand (AID Label)
posEntryModePOS entry mode code
issuerApplicationPayment application for the card
terminalVerificationResultEMV verification results
aidApplication Identifier
customerResponseCode00 (approved) or 05 (declined)
cvmMethodCardholder Verification Method
authModeAuthentication mode (ISSUER or CARD)
cardBrandCard brand (VISA, MASTERCARD, AMEX)

Fetch All Transactions

Retrieve a complete list of transactions processed by a specific merchant.

Example Request

$curl -X GET \
> -H 'Content-Type: application/json' \
> -H 'API-KEY: your-api-key' \
> -H 'API-SECRET: your-api-secret' \
> -H 'MERCHANT-ID: your-merchant-id' \
> 'https://api.sagapay.no/transactions'

Query Parameters

ParameterDescription
startDateFilter by start date
endDateFilter by end date

If no query parameters are specified, transactions will be returned from latest to oldest.


Search Transactions

Use the Transaction Search API to perform a free text search on transaction data.

Example Request

$curl -X GET \
> -H 'Content-Type: application/json' \
> -H 'API-KEY: your-api-key' \
> -H 'API-SECRET: your-api-secret' \
> -H 'MERCHANT-ID: your-merchant-id' \
> 'https://api.sagapay.no/transactions/search?query=822faedca'

You can search by any field including orderId, transactionId, amount, or any other transaction detail.


Fetch Settlement Reports

Retrieve a detailed summary of completed transactions for a specific merchant. Reports can be generated for specific periods (daily or monthly).

Prerequisites

  • API credentials
  • merchantId from the Create Merchant API

Example Request

$curl -X GET \
> -H 'Content-Type: application/json' \
> -H 'API-KEY: your-api-key' \
> -H 'API-SECRET: your-api-secret' \
> -H 'MERCHANT-ID: your-merchant-id' \
> 'https://api.sagapay.no/merchants/{merchantId}/reports'

Response Attributes

AttributeDescription
payoutIdID for the specific payout
merchantIdMerchant whose report is generated
transactionStartDateStart date of first transaction (YYYY-MM-DD)
transactionEndDateEnd date of last transaction (YYYY-MM-DD)
settlementDateDate of completed payment (YYYY-MM-DD)
reportTypeMONTHLY or DAILY
urlURL to detailed settlement report
totalSaleTotal sales value for the period
totalRefundTotal refunded value for the period
feeTotal fees collected from transactions
payoutFinal amount paid to merchant after deductions