Checkout 2.0
Confirmation

On this page you will find information about how to Process the result and the different Purchase states through out 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 (unless the site is a single-page application) would be to perform a redirect to a page that verifies the result, passing the Purchase ID is a parameter in the URL:

//example of done function passed as part of the options for AvardaCheckOutClient.init function
var options = {
  done: function (purchaseId) {
    window.location.href = '/done.php?purchaseId=' + purchaseId;
  },
};

The done.php page would then make a call to the GetPaymentStatus API function in order to check the actual result. If the payment was successful, the partner site might want e.g. to mark the order in its own database as paid and show a confirmation message to the user. If the payment wasn’t successful, the partners site should display an error message at least.

When the checkout process is completed a call to defined done method will be performed. This function normally redirects the user back to order confirmation page, before showing confirmation merchant should verify purchase details by calling GetPaymentStatus.

GetPaymentStatus

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

POST /CheckOut2Api/GetPaymentStatus

Input parameters

NameData TypeDefault valueDescription
PurchaseIdStringNone. Must be specifiedThe ID obtained during the negotiation phase that identified the purchase.

Example request

{
  "PurchaseId": "19ac0d1ee909c302d212b4324d9194b5"
}

Output parameters

The method returns an object that differs if the purchase was loan, invoice, direct payment or card payment.

NameData TypeDescriptionInvoiceLoanCard paymentDirect payment
AccountNumberStringThe bank account number associated with the payment.Check markCheck mark
InvoicingFirstNameStringThe first name of the customer on the invoicing address.Check markCheck markCheck markCheck mark
InvoicingLastNameStringThe last name of the customer on the invoicing address.Check markCheck markCheck markCheck mark
InvoicingAddressLine1StringThe first line of the invoicing address.Check markCheck markCheck markCheck mark
InvoicingAddressLine2StringThe second line of the invoicing address.Check markCheck markCheck markCheck mark
InvoicingZipStringThe ZIP code on the invoicing address.Check markCheck markCheck markCheck mark
InvoicingCityStringThe city on the invoicing address.Check markCheck markCheck markCheck mark
AccountClassCodeStringCode of account class for this purchase.Check markCheck markCheck markCheck mark
PurchaseIdStringThe same Purchase ID that was passed as an input parameter.Check markCheck markCheck markCheck mark
StateEnumeration CheckOutPurchaseStateThe current state of the purchase.Check markCheck markCheck markCheck mark
DescriptionStringThe description provided by partner’s site.Check markCheck markCheck markCheck mark
PriceDecimalThe total amount to pay.Check markCheck markCheck markCheck mark
CreatedDateTimeThe local date and time at which the purchase has been negotiated.Check markCheck markCheck markCheck mark
BeingProcessedNullable DateTimeThe local date and time at which the form was first rendered. Null if the form hasn’t been shown yet.Check markCheck markCheck markCheck mark
CompletedNullable DateTimeThe local date and time at which the purchase has been completed. Null if the purchase hasn’t been completed yet.Check markCheck markCheck markCheck mark
CancelledNullable DateTimeThe local date and time at which the purchase has been canceled. Null it the purchase hasn’t been cancelled (yet).Check markCheck markCheck markCheck mark
SiteCodeStringThe code of the partner’s site at which the purchase has been made.Check markCheck markCheck markCheck mark
CountryCodeStringA three-letter ISO country code (see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 (opens in a new tab)) associated with the partner’s site at which the purchase has been made.Check markCheck markCheck markCheck mark
CurrencyCodeStringThe three-letter code of the currency in which the purchase has been made. For Example “SEK” or EURCheck markCheck markCheck markCheck mark
PhoneStringThe phone number that the customer typed-in into the form.Check markCheck markCheck markCheck mark
MailStringThe e-mail address that the customer typed-in into the form.Check markCheck markCheck markCheck mark
DeliveryFirstNameStringThe first name of the customer on the delivery address.Check markCheck markCheck markCheck mark
DeliveryLastNameStringThe last name of the customer on the delivery address.Check markCheck markCheck markCheck mark
DeliveryAddressLine1StringThe first line of the delivery address.Check markCheck markCheck markCheck mark
DeliveryAddressLine2StringThe second line of the delivery address.Check markCheck markCheck markCheck mark
DeliveryCityStringThe city of the delivery address.Check markCheck markCheck markCheck mark
DeliveryCountryStringThe country of the delivery address.Check markCheck markCheck markCheck mark
OrderReferenceStringMerchant custom ID reference.Check markCheck markCheck markCheck mark
AuthenticationTypeEnumeration CheckOutAuthenticationTypeType of authentication for this purchase.Check markCheck markCheck markCheck mark
PaymentMethodEnumeration PaymentMethodType of payment.Check markCheck markCheck markCheck mark
IsRecurringPaymentBooleanDiffers if payment is recurring.Check markCheck markCheck markCheck mark
RecPmtTokenStringRecurring payment token.Check markCheck markCheck markCheck mark
CardExpirationDateStringCard expiration date stored in this format “YYMM”.Check mark
MaskedCardNumberStringMasked card number for security purpose.Check mark
CardBrandStringBrand cards.Check mark
CustomerTokenStringBrand cards.Check markCheck markCheck markCheck mark
CustomerTokenStringBrand cards.Check markCheck markCheck markCheck mark
IsOrganizationBooleanDifferantiate B2B and B2C.Check markCheck markCheck markCheck mark
ReferenceNameStringReference name for better handling.Check markCheck markCheck markCheck mark
CompanyNameStringName of the company.Check markCheck markCheck markCheck mark
NewsLetterValueBooleanServes for displaying the newsletter.Check markCheck markCheck markCheck mark
OfferedNewsLetterSettingsBooleanIf the value is true, newsletter is checked.Check markCheck markCheck markCheck mark
OrganizationNumberStringReturns organization number if there is any value.Check markCheck markCheck markCheck mark
CustomerTypeEnumIf CustomerType = null or 0 load both options for Private/Company.
If CustomerType = 1 load only Private alternative.
If CustomerType = 2 load only Company alternative.
Check markCheck markCheck markCheck mark

Purchase States

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

Purchase States diagram

The states shown in green are intermediate, meaning that the purchase cannot stay in neither of them for a long time. States of all other colors are terminal. Once a purchase makes a transition into one of such states, it stays in it forever.

Enumeration States

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

Enumeration States table