Test a Function
curl --request POST \
--url https://api.launchmystore.io/apps/functions/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"wasmBase64": "<string>",
"type": "<string>",
"input": {},
"timeoutMs": 123
}
'import requests
url = "https://api.launchmystore.io/apps/functions/test"
payload = {
"wasmBase64": "<string>",
"type": "<string>",
"input": {},
"timeoutMs": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({wasmBase64: '<string>', type: '<string>', input: {}, timeoutMs: 123})
};
fetch('https://api.launchmystore.io/apps/functions/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/apps/functions/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'wasmBase64' => '<string>',
'type' => '<string>',
'input' => [
],
'timeoutMs' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/apps/functions/test"
payload := strings.NewReader("{\n \"wasmBase64\": \"<string>\",\n \"type\": \"<string>\",\n \"input\": {},\n \"timeoutMs\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.launchmystore.io/apps/functions/test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"wasmBase64\": \"<string>\",\n \"type\": \"<string>\",\n \"input\": {},\n \"timeoutMs\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/apps/functions/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"wasmBase64\": \"<string>\",\n \"type\": \"<string>\",\n \"input\": {},\n \"timeoutMs\": 123\n}"
response = http.request(request)
puts response.read_body{
"data.success": true,
"data.output": {},
"data.executionTimeMs": 123,
"data.wasmSize": 123,
"data.error": "<string>",
"data.validationError": "<string>"
}Apps
Test a Function
Execute a pre-compiled function in an ephemeral sandbox without installing it.
POST
/
apps
/
functions
/
test
Test a Function
curl --request POST \
--url https://api.launchmystore.io/apps/functions/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"wasmBase64": "<string>",
"type": "<string>",
"input": {},
"timeoutMs": 123
}
'import requests
url = "https://api.launchmystore.io/apps/functions/test"
payload = {
"wasmBase64": "<string>",
"type": "<string>",
"input": {},
"timeoutMs": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({wasmBase64: '<string>', type: '<string>', input: {}, timeoutMs: 123})
};
fetch('https://api.launchmystore.io/apps/functions/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.launchmystore.io/apps/functions/test",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'wasmBase64' => '<string>',
'type' => '<string>',
'input' => [
],
'timeoutMs' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.launchmystore.io/apps/functions/test"
payload := strings.NewReader("{\n \"wasmBase64\": \"<string>\",\n \"type\": \"<string>\",\n \"input\": {},\n \"timeoutMs\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.launchmystore.io/apps/functions/test")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"wasmBase64\": \"<string>\",\n \"type\": \"<string>\",\n \"input\": {},\n \"timeoutMs\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.launchmystore.io/apps/functions/test")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"wasmBase64\": \"<string>\",\n \"type\": \"<string>\",\n \"input\": {},\n \"timeoutMs\": 123\n}"
response = http.request(request)
puts response.read_body{
"data.success": true,
"data.output": {},
"data.executionTimeMs": 123,
"data.wasmSize": 123,
"data.error": "<string>",
"data.validationError": "<string>"
}POST /apps/functions/test runs a pre-compiled WASM module in the same
sandboxed worker the production dispatcher uses — same per-type timeout,
same output validator — but nothing is persisted. No function-run
record, no state change on any installation.
The server does not compile JavaScript. You compile your function
locally with lms function build (Javy dynamic mode), then send the
resulting WASM bytes as Base64. Static-mode modules are rejected.
Use it for:
- Quick iteration in the developer dashboard’s “Try it” editor.
- CI smoke-tests that exercise a compiled function against a known fixture.
- Schema-conformance checks against the type-specific output validator.
Request
string
required
Base64-encoded WASM bytes, produced locally via
lms function build
(Javy dynamic mode). Max decoded size is enforced server-side
(~700 KB of Base64). Static-mode modules are rejected.string
required
Function type — determines the input shape that will be passed and the
output validator that will check the return value. One of:
discount, shipping_rate, payment_customization,
delivery_customization, order_validation, cart_transform,
fulfillment_constraints, local_pickup_options, pickup_point_options.object
required
Test input passed to the function. Should match the input contract for
the function type — see Function input fields.
integer
Execution timeout in ms. Clamped only to the global 5000 ms hard
cap — an explicit value may exceed the per-type default. Omit to use
the per-type default below.
Per-type default timeouts
These apply whentimeoutMs is omitted — they are defaults, not
caps:
| Function type | Default timeout |
|---|---|
discount | 500ms |
payment_customization | 500ms |
order_validation | 1000ms |
cart_transform | 1000ms |
delivery_customization | 1000ms |
fulfillment_constraints | 1000ms |
local_pickup_options | 1500ms |
shipping_rate | 2000ms |
pickup_point_options | 2000ms |
Example: discount
curl -X POST "https://api.launchmystore.io/apps/functions/test" \
-H "Authorization: Bearer <MERCHANT_JWT>" \
-H "Content-Type: application/json" \
-d '{
"type": "discount",
"wasmBase64": "<BASE64_ENCODED_WASM_BYTES>",
"input": {
"cart": {
"cost": { "subtotalAmount": { "amount": 75, "currencyCode": "USD" } },
"lines": [
{ "id": "line_1", "quantity": 3, "cost": { "amountPerQuantity": { "amount": 25, "currencyCode": "USD" } } }
]
}
}
}'
Response
A successful or failed execution both return200 OK — the outcome is
encoded in the data body (success: true/false). The envelope is the
standard { status, state, message, data } shape (state: "success" for a
completed execution). Only auth / bad-request errors surface as
non-200, as a { status, state: "error", message, data } envelope.
boolean
true when the function ran AND its output passed validation.object
The function’s return value. On a validation failure this is the raw output that failed;
null on a hard runtime failure.integer
Wall-clock execution time inside the WASM worker.
integer
Decoded WASM module size in bytes.
string
Runtime/timeout error message. Present only when
success: false.string
Output validator error message — present when the function returned but its output shape was wrong.
Example success
{
"status": 200,
"state": "success",
"message": null,
"data": {
"success": true,
"output": {
"discounts": [
{
"title": "10% off $50+",
"value": 10,
"valueType": "percentage",
"target": "order"
}
]
},
"executionTimeMs": 4,
"wasmSize": 3014
},
"count": null,
"pagination": null
}
Example timeout
{
"status": 200,
"state": "success",
"message": null,
"data": {
"success": false,
"error": "WASM execution timed out after 500ms",
"validationError": null,
"output": null,
"executionTimeMs": 500,
"wasmSize": 3014
},
"count": null,
"pagination": null
}
Example validation error
{
"status": 200,
"state": "success",
"message": null,
"data": {
"success": false,
"error": null,
"validationError": "Output does not match discount contract",
"output": {
"discounts": [{ "value": 10 }]
},
"executionTimeMs": 3,
"wasmSize": 3014
},
"count": null,
"pagination": null
}
Error codes (non-200)
Non-200 responses use the same envelope withstate: "error" and a human
message, e.g.:
{
"status": 400,
"state": "error",
"message": "Unknown function type: foo",
"data": null
}
| Code | message | When |
|---|---|---|
400 | Unknown function type: <type> | type is not one of the nine function types. |
400 | Invalid base64 in wasmBase64: ... | wasmBase64 is not valid Base64. |
400 | validation reason from the WASM validator | bytes are not a valid Javy dynamic-mode module. |
401 | — | Missing or invalid merchant JWT. |