Skip to main content

Quickstart

Go from credentials to your first response in about five minutes. You will create an API key, exchange it for an access token, and read an order from the test environment.

Before you start​

You need:

Every example below points at the test environment. Production has its own Merchant Hub, hostnames, and scope, and keys from one environment do not work in the other. See Merchant Hub environments and Endpoints for test and production.

1. Create an API key​

In the test Merchant Hub, open the menu under your name in the top right and select Manage access. Select Create +, then API key. Fill out the form and select Create.

Copy the client id and secret into a password manager before you close the dialog.

The secret is shown once

Walley cannot recover a lost secret. If you lose it, create a new key.

2. Get an access token​

Exchange the client id and secret for a token. Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your own values.

curl -X POST https://api.uat.walleydev.com/oauth2/v2.0/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "scope=705798e0-8cef-427c-ae00-6023deba29af/.default"

You get back a token and its lifetime in seconds:

{
"token_type": "Bearer",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "bXlVc2VybmFtZTpmN2E1ODA4MGQzZTk0M2VmNWYyMTZlMDE..."
}

Cache the token and reuse it until expires_in runs out. To get a new one, repeat the same request. For the full flow, see Authentication.

3. Read an order​

Call the Get order endpoint with the token in an Authorization header.

curl https://api.uat.walleydev.com/manage/orders/YOUR_ORDER_ID \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"

A 200 OK response carries the order under data:

{
"data": {
"id": "853f3f82-ab12-47c3-9d97-af17009852cd",
"reference": "MX_220921_111434",
"paymentMethod": "Invoice",
"totalAmount": 2459.49,
"currency": "SEK",
"status": "Activated",
"salesSegment": "B2C",
"countryCode": "SE",
"customer": {},
"items": [],
"invoices": []
},
"links": {},
"metaData": {}
}

The status field decides what you can do next. See Order lifecycle.

Where to go next​

You want toRead
Know which actions an order allowsOrder lifecycle
Understand why a change is not visible yetAsynchronous operations
Confirm a shipment and trigger payoutCapture order
Give money backRefund order
Change an order before shippingReauthorize order
Handle a failed requestErrors