Checkout 3.0
Finalize Purchase

On this page, you will find information about how to Process the result and the different Purchase states throughout the CheckOut session.

Processing the Result

The last step occurs when the customer finishes working with the form and there’s a result available. The client script signals this by calling the done callback function (see Showing the Check-Out Form).

The done callback doesn’t contain any information about whether the payment succeeded or not. It only signals that the customer is done working with the form. The partner site back-end must check what the actual result was. We have designed it this way as a security measure so that the partner integrators aren’t tempted to trust the client script. Unfortunately, there’s no way to prevent malicious customers from modifying the script since it runs in their browsers.

The implementation of the done function is up to partners. However, a common scenario verifies the result, passing the Purchase ID is a parameter of the payment status API function

Payment Status

Returns information about a single purchase identified by a Purchase ID.

GET: {api_url}/api/partner/payments/{purchaseid}
Authorization: Bearer {partner_access_token}
{
  "purchaseId": "string",
  "extraIdentifiers": {
    "description": "string",
    "orderReference": "string",
    "loyaltyNumber": "string",
    "productGroup": "string",
    "attachment": "string",
    "referenceName": "string"
  },
  "totalPrice": 0,
  "createdUtc": "2020-05-27T10:15:21.195Z",
  "expiredUtc": "2020-05-27T10:15:21.195Z",
  "checkoutSite": {
    "siteCode": "string",
    "countryCode": "string",
    "currencyCode": "string"
  },
  "mode": "B2C",
  "b2C": {
    "step": {
      "customerToken": "string",
      "current": "Initialized",
      "rememberMe": "Hidden",
      "smsNewsletterSubscription": "Hidden",
      "emailNewsletterSubscription": "Hidden"
    },
    "userInputs": {
      "email": "string",
      "zip": "string",
      "ssn": "string",
      "phone": "string"
    },
    "invoicingAddress": {
      "address1": "string",
      "address2": "string",
      "zip": "string",
      "city": "string",
      "country": "AF",
      "careOfAddress": true,
      "firstName": "string",
      "lastName": "string"
    },
    "deliveryAddress": {
      "address1": "string",
      "address2": "string",
      "zip": "string",
      "city": "string",
      "country": "AF",
      "careOfAddress": true,
      "firstName": "string",
      "lastName": "string",
      "type": "Default",
      "viewType": "Unchecked"
    }
  },
  "b2B": {
    "step": {
      "customerToken": "string",
      "current": "Initialized",
      "rememberMe": "Hidden",
      "smsNewsletterSubscription": "Hidden",
      "emailNewsletterSubscription": "Hidden"
    },
    "userInputs": {
      "email": "string",
      "zip": "string",
      "organizationNumber": "string",
      "customerSsn": "string",
      "phone": "string"
    },
    "customerInfo": {
      "firstName": "string",
      "lastName": "string"
    },
    "invoicingAddress": {
      "address1": "string",
      "address2": "string",
      "zip": "string",
      "city": "string",
      "country": "AF",
      "careOfAddress": true,
      "name": "string"
    },
    "deliveryAddress": {
      "address1": "string",
      "address2": "string",
      "zip": "string",
      "city": "string",
      "country": "AF",
      "careOfAddress": true,
      "firstName": "string",
      "lastName": "string",
      "type": "Default",
      "viewType": "Unchecked"
    }
  },
  "authenticationType": "None",
  "paymentMethods": {
    "selectedPayment": {
      "type": "Invoice",
      "recurringPayment": "Hidden",
      "recurringPaymentToken": "string"
    }
  },
  "cardPaymentState": {
    "maskedCardNumber": "string",
    "cardBrand": "string",
    "cardExpirationDate": "string"
  },
  "customerBalance": 0
}

Response Data Type Description

NameData TypeDescription
PurchaseIdstringThe ID that the partner uses to identify the purchase.
StateGpsStateTypeGeneral state of purchase.
ExtraIdentifiersGetPaymentExtraIdentifiersPartner’s identifiers
TotalPricedecimalThe total price that the customer has to pay.
CreatedUtcDateTimeUTC time of purchase creations
ExpiredUtcDateTimeUTC time of purchase expiration
CheckoutSiteGetPaymentCheckoutSiteCheckout site information
ModePurchaseModeSelected purchase mode (B2B/B2C)
B2CGetPaymentB2CState
B2BGetPaymentB2BState
CardPaymentStateCardStateInformation about card payment
PaymentMethodsGetPaymentFormPaymentsInformation about Payment methods
AuthenticationTypeAuthenticationTypeType of third party authentication
CustomerBalancedecimalCustomerBalance

Enumeration States

There are different checkout flows for B2B and B2C purchase mode. Current step is described in detail by enumerations: B2BStepType and B2CStepType. This document describes the mapping of property State type: (GpsStateType) based on detailed B2BStepType and B2CStepType flow steps. The B2BStepType and B2CStepType represent steps that could be extended anytime, while the GpsStateType gives a more specific state depending on the flow used by the customer, such as the payment method. GpsStateType remains stable and will not be extended.

State Mapping

GpsStateTypeDescriptionB2CStepTypeB2BStepType
PreInitializedThe purchase ID was granted but has not yet been initialized, waiting for the first step.B2CStepType.PreInitializedB2BStepType.PreInitialized
InitializedThe purchase has been initialized, but no further steps have occurred.B2CStepType.InitializedB2BStepType.Initialized
InProcessThe purchase is active, and the customer is entering information.B2CStepType.EmailZipEntry, B2CStepType.SsnEntry, B2CStepType.PhoneNumberEntry, B2CStepType.PersonalInfo, B2CStepType.AmountSelectionB2BStepType.EnterCompanyInfo, B2BStepType.CompanyAddressInfo, B2BStepType.CompanyAddressInfoWithoutSsn
WaitingForExternalServiceWaiting for an external payment service or third-party action (e.g., BankID).B2CStepType.WaitingForExternalPaymentService, B2CStepType.WaitingForSwish, B2CStepType.WaitingForTrustly, B2CStepType.WaitingForBankIdB2BStepType.WaitingForBankId, B2BStepType.WaitingForSwish, B2BStepType.WaitingForExternalPaymentService
RedirectedThe customer has been redirected to an external payment gateway or service.B2CStepType.RedirectedToDirectPaymentBank, B2CStepType.RedirectedToNets, B2CStepType.RedirectedToTrustly, B2CStepType.RedirectedToVipps, B2CStepType.RedirectedToCheckoutComStep, B2CStepType.RedirectedToNetsEidentB2BStepType.RedirectedToTupas, B2BStepType.RedirectedToDirectPaymentBank, B2BStepType.RedirectedToNets,B2BStepType.RedirectedToNetsEident, B2BStepType.RedirectedToVipps, B2BStepType.RedirectedToCheckoutComStep
CompletedThe process was successfully completed.B2CStepType.CompletedB2BStepType.Completed
TimedOutThe process timed out due to inactivity.B2CStepType.TimedOutB2BStepType.TimedOut
HandledByMerchantThe process has been handed over to the merchant for further handling outside the standard flow.B2CStepType.HandledByMerchantB2BStepType.HandledByMerchant
AwaitingCreditApprovalWaiting for credit approval or payment authorization.B2CStepType.AwaitingCreditApprovalB2BStepType.AwaitingCreditApproval
CreditNotApprovedCredit approval was not granted.B2CStepType.CreditNotApprovedB2BStepType.CreditNotApproved
CanceledThe process was canceled by the partner or the system.B2CStepType.CanceledB2BStepType.Canceled

Each individual Purchase changes its state during a Check-Out session. The following diagram shows valid transitions between the states:

Checkout3 purchase states diagram

The enumeration describes the state of a single Purchase. Please refer to the diagram in the Purchase States chapter to see possible transitions between states.

B2C Step Types

NameValueDescription
PreInitialized26The session has been registered, and a Purchase ID has been reserved. The customer must load the checkout within 24 hours.
Initialized0The session has been initialized by a back-end call made by the merchant but the form have not been rendered yet.
EmailZipEntry1The customer is filling-in either the email or ZIP.
SsnEntry2The customer has entered both email and ZIP but it turned out that we also need to know the SSN.
PhoneNumberEntry3Phone number is the 4th thing to ask for (after email, ZIP and SSN) unless it is a known customer.
PhoneNumberEntryForKnownCustomer14Customer was loaded in past steps but without phone. So in this step, we should get only phone value
PersonalInfoWithoutSsn15Step for flow without social security number
PersonalInfo4Step for fill in customer info
WaitingForSwish5Waiting for response from Swish application
RedirectedToDirectPaymentBank6The customer has been redirected to a Finnish bank for a direct payment
RedirectedToNets7The customer has been redirected to a card payment provider.
WaitingForBankId8Waiting for response from BankId application
RedirectedToTupas9The customer has been redirected to a Signicat
Completed10The CheckOut has been successfully completed
TimedOut11The session is timed out
HandledByMerchant12The customer has initiated an external payment method
AwaitingCreditApproval13Waiting for Credit approval from merchant
RedirectedToNetsEident17The customer has been redirected to a Nets E-ident provider
Canceled16The purchase is cancelled
RedirectedToVipps21The customer has been redirected to Vipps
CreditNotApproved22High loan order was not approved
RedirectedToCheckoutComStep23The customer has been redirected to a card provider
WaitingForOtp25Waiting for e-mail or phone verification of customer

B2B Step Types

NameValueDescription
PreInitialized21The session has been registered, and a Purchase ID has been reserved. The customer must load the checkout within 24 hours.
Initialized0The session has been initialized by a back-end call made by the merchant but the form have not been rendered yet.
EnterCompanyInfo1The customer is company information (email, zip, company SSN, customer SSN) step.
CompanyAddressInfo3Step for fill in customer info
WaitingForSwish12Waiting for response from Swish application
RedirectedToDirectPaymentBank10The customer has been redirected to a Finnish bank for a direct payment
RedirectedToNets11The customer has been redirected to a card payment provider.
WaitingForBankId8Waiting for response from BankId application
RedirectedToTupas5The customer has been redirected to a Signicat
Completed9The CheckOut has been successfully completed
HandledByMerchant13The customer has initiated an external payment method
TimedOut14The session is timed out
Canceled15The purchase is cancelled
RedirectedToNetsEident16The customer has been redirected to a Nets E-ident provider
RedirectedToVipps18The customer has been redirected to Vipps
RedirectedToCheckoutComStep19The customer has been redirected to a card provider