Create your first payment link
Take a $100 order from checkout to fulfilment. Keep the order ID in your system and send the customer one link.
You’ll need a server access token. Running the create command makes a real checkout.
1. Give the order an ID
Use order-42 as your own order number. Generate a separate requestId once and store it with the order. If the request times out, retry with that same ID and body.
export REQUEST_ID=$(node -p "require('node:crypto').randomUUID()")2. Create the link and share it
Send the price as "100.00". For a donation or another open-amount payment, omit amountUsd and the customer chooses the amount.
curl --fail-with-body 'https://api.cadmospay.com/machine/v1/gateway/links' \
-H "Authorization: Bearer ${CADMOS_ACCESS_TOKEN:?Set CADMOS_ACCESS_TOKEN}" \
-H "Content-Type: application/json" \
--data-binary @- <<JSON
{
"description": "Order #42",
"externalReference": "order-42",
"amountUsd": "100.00",
"requestId": "${REQUEST_ID:?Set REQUEST_ID}"
}
JSONOn 201, save uuid with the order and send checkoutUrl to the customer. This example accepts crypto. To offer Whish, see payment methods and fees.
3. Check whether to fulfil the order
curl --fail-with-body 'https://api.cadmospay.com/machine/v1/gateway/links' \
-H "Authorization: Bearer ${CADMOS_ACCESS_TOKEN:?Set CADMOS_ACCESS_TOKEN}" \
--get \
--data-urlencode "uuid=${REQUEST_ID:?Set REQUEST_ID}"For this $100 order, check paid. If it is false, leftUsd tells you what is still due. If it is true, fulfil the order once. A link can be active before anyone pays it.
Open-amount links have no target and always return paid: false. Record each settlement as it arrives. To automate this, receive payment notifications.