Walley Checkout Adapter

Overview

Walley Checkout adapter is a payment adapter for Walley Checkout. Read more on Walley Checkout docs

Environments

There are two environments that you can use.

Environment Address
Test https://checkout-walley-adapter.test.norce.tech
Production https://checkout-walley-adapter.norce.tech

Configuration

You start by adding a configuration for the Walley Checkout adapter in Norce Checkout Admin.

Create payment

To get a Walley Checkout HTML snippet, you start by initializing a Walley Checkout payment session for an existing Norce order. A Walley Checkout payment session will be created and the JSON response will include an HTML snippet containing a script tag that should be rendered on your checkout page. The script tag will load an iframe which will guide the customer through the Walley Checkout UI.

restjson
Copy
Copied
POST /api/checkout/v1/{order_id}/payments
Copy
Copied
{
    "paymentId": "pOtgkuNSudeVupaHfcFbmxOdska",
    "publicToken": "public-SE-28648fd39ddbcda40d6ace233d836241b3574358b009867b",
    "htmlSnippet": "<script src=\"https://checkout.uat.walleydev.com/walley-checkout-loader.js\" data-token=\"public-SE-28648fd39ddbcda40d6ace233d836241b3574358b009867b\" data-version=\"v2\"></script>"
}

The Walley Checkout adapter will also update your Norce order with the Walley payment details. The payments[].id property represents the paymentId from the JSON response received when initializing the Walley Checkout payment session and the payments[].orderId represents the Norce order identifier.

Copy
Copied
{
    ...
    "payments": [
        {
            "type": "checkout",
            "id": "pOtgkuNSudeVupaHfcFbmxOdska",
            "reference": "301ec5ce-8407-453f-8f3a-618b587ca02a",
            "amount": 5200.0,
            "adapterId": "walley-checkout",
            "name": "walley_checkout_adapter",
            "orderId": "oGRczeZk",
        }
    ]
    ...
}

Update payment

When a Norce order changes a Cart Changed callback will be triggered in the Walley Checkout adapter, during which the Walley Checkout UI will be suspended to avoid any concurrent operations. The Walley Checkout order will then be updated with the latest information from the Norce order, after which the Walley Checkout UI will be resumed.

Update customer and shipping option

When the customer updates their customer and/or shipping information in the Walley Checkout UI this will trigger separate 'Client-side events' callbacks in the Walley Checkout Adapter to ensure that the Norce order is always up to date with the latest Walley order information. Update Customer callback will update the Norce order with latest customer information from Walley and Update Shipping Option callback will update the Norce order with the latest shipping information from Walley.

Validate payment

When the user clicks on "Completed Purchase" in Walley Checkout UI a validation callback is triggered in the Walley Checkout adapter. If the validation is successful Walley will continue with confirming the payment. At this point the Norce order will go to processing state and the order will be locked to any changes except status update.

If the validation failed a non 200 response will be return with a message that will be displayed in the Walley Checkout UI.

Confirm payment

When the payment has been confirmed Walley will call the configured notificationUri to complete the order, update the payment and then redirects the user to the redirectPageUri of the Walley checkout adapter.

It is required that you also include the Walley Checkout iframe in your purchase confirmation page, since this Walley Checkout iframe will show important purchase details to the customer. To display a "thank you" page on another page, for example when redirecting the user to a custom confirmation page, put an identical <script> tag on this page as well. When the Walley Checkout order is in the state of PurchaseCompleted it will show a "thank you" page instead of the default purchase flow.

You do this by getting the Walley Checkout order from Walley Checkout adapter and render the snippet.

restjson
Copy
Copied
GET /api/checkout/v1/{order_id}/payments/{payment_id}
Copy
Copied
{
    "paymentId": "pOtgkuNSudeVupaHfcFbmxOdska",
    "publicToken": "public-SE-28648fd39ddbcda40d6ace233d836241b3574358b009867b",
    "htmlSnippet": "<script src=\"https://checkout.uat.walleydev.com/walley-checkout-loader.js\" data-token=\"public-SE-28648fd39ddbcda40d6ace233d836241b3574358b009867b\" data-version=\"v2\"></script>"
}

Idempotency and retries

Please read the Walley Checkout documentation on Idempotency and retries.

Copyright © Norce 2024. All right reserved.