Appearance
Create a checkout
A checkout represents your order in Maytes. Your server calls createCheckout with the order details, and Maytes returns:
- A
checkout_uuid— the order's identifier in Maytes. - A
checkout_url— where the customer pays.
Call createCheckout only from your server because it uses your OAuth credentials. Never expose those credentials in browser code.
If your browser calls this backend route, require an authenticated customer session and verify that the customer can access the cart. Price the cart from your own catalogue; do not trust totals sent by the browser.
Call createCheckout
After the customer clicks the Maytes button, your server calls createCheckout with the order details. Maytes returns the checkout ID and URL.
See the API reference for complete request and response schemas, errors, and line-item categories.
Why create a checkout?
Create sends Maytes the order details needed to:
- Show the customer what they're paying for. Line items, fees, discounts, tax, and the total populate the split-bill UI that the customer and their friends see.
- Validate the order math. Maytes reconciles the items + fees + discounts + tax against
total_amount; if it doesn't add up we reject with422 invalid_amount_arithmetic. See Amount rules below. - Redirect the customer.
return_urlandcancel_urltell the Maytes-hosted window where to send the customer after completion or cancellation. - Tie our checkout to your order. Pass
merchant_order_idso you can reconcile against your store later, and so we can reject duplicate create attempts for the same order with409 order_already_authorized.
A minimal create request
Assumes a maytes client initialised at startup.
ts
import type {
CheckoutDiscount,
CreateCheckoutRequest,
LineItem,
} from '@maytes/api-client-js';
// `LineItem` is a union discriminated on `category`. Set `category` and the
// right shape is required. Field names are camelCase; the wire format is snake_case.
const items: LineItem[] = [
{
itemRef: 'GA-1',
name: 'General Admission',
quantity: 1,
unitPrice: 5000,
currency: 'AUD',
category: 'other',
},
];
const discounts: CheckoutDiscount[] = [
{
name: 'Early bird',
scope: 'cart',
amount: 500,
currency: 'AUD',
},
];
const createCheckoutRequest: CreateCheckoutRequest = {
merchantOrderId: 'order_1001',
totalAmount: 4500, // 5000 item − 500 discount
currency: 'AUD',
returnUrl: 'https://shop.example.com/thanks?order=order_1001',
cancelUrl: 'https://shop.example.com/cart',
items,
discounts,
};
const created = await maytes.createCheckout({ createCheckoutRequest });
// Persist this against your order — everything later keys off it.
const checkoutUuid = created.data.checkoutUuid;
const checkoutUrl = created.data.checkoutUrl;python
from maytes_api_client.models.create_checkout_request import CreateCheckoutRequest
from maytes_api_client.models.line_item import LineItem
from maytes_api_client.models.other_line_item import OtherLineItem
created = maytes.create_checkout(CreateCheckoutRequest(
merchant_order_id="order_1001",
total_amount=4500, # minor units — 4500 = AUD 45.00
currency="AUD",
return_url="https://shop.example.com/thanks?order=order_1001",
cancel_url="https://shop.example.com/cart",
# Wrap the CATEGORY VARIANT in LineItem. Passing the fields straight to
# LineItem(...) is accepted silently and then serialises to `null`.
items=[LineItem(OtherLineItem(
item_ref="GA-1",
name="General Admission",
quantity=1,
unit_price=4500,
currency="AUD",
category="other",
))],
))
# Persist this against your order — everything later keys off it.
checkout_uuid = created.data.checkout_uuid
checkout_url = created.data.checkout_urlphp
use MaytesApiClient\Model\CreateCheckoutRequest;
use MaytesApiClient\Model\OtherLineItem;
$created = $maytes->createCheckout(new CreateCheckoutRequest([
'merchant_order_id' => 'order_1001',
'total_amount' => 4500, // minor units — 4500 = AUD 45.00
'currency' => 'AUD',
'return_url' => 'https://shop.example.com/thanks?order=order_1001',
'cancel_url' => 'https://shop.example.com/cart',
// Use the category VARIANT, not the base LineItem: the generated parent
// serialises `category` as its own class name, which the API rejects.
'items' => [new OtherLineItem([
'item_ref' => 'GA-1',
'name' => 'General Admission',
'quantity' => 1,
'unit_price' => 4500,
'currency' => 'AUD',
'category' => 'other',
])],
]));
// Persist this against your order — everything later keys off it.
$checkoutUuid = $created->getData()->getCheckoutUuid();
$checkoutUrl = $created->getData()->getCheckoutUrl();go
// Build the category variant, then lift it into the LineItem union.
item := maytes.OtherLineItemAsLineItem(
maytes.NewOtherLineItem("GA-1", "General Admission", 1, 4500, "AUD", "other"),
)
createReq := *maytes.NewCreateCheckoutRequest(
4500, "AUD", // minor units — 4500 = AUD 45.00
"https://shop.example.com/thanks?order=order_1001",
"https://shop.example.com/cart",
[]maytes.LineItem{item},
)
createReq.SetMerchantOrderId("order_1001")
created, _, err := api.DefaultAPI.CreateCheckout(ctx).
CreateCheckoutRequest(createReq).Execute()
if err != nil { /* handle */ }
// Persist this against your order — everything later keys off it.
checkoutUuid := created.Data.GetCheckoutUuid()
checkoutURL := created.Data.GetCheckoutUrl()java
import co.maytes.api.model.*;
import java.net.URI;
import java.util.List;
CreateCheckoutResponse created = maytes.createCheckout(
new CreateCheckoutRequest()
.merchantOrderId("order_1001")
.totalAmount(4500) // minor units — 4500 = AUD 45.00
.currency("AUD")
.returnUrl(URI.create("https://shop.example.com/thanks?order=order_1001"))
.cancelUrl(URI.create("https://shop.example.com/cart"))
// Wrap the category variant — the base LineItem has no field builders.
.items(List.of(new LineItem(new OtherLineItem()
.itemRef("GA-1")
.name("General Admission")
.quantity(1)
.unitPrice(4500)
.currency("AUD")
.category(OtherLineItem.CategoryEnum.OTHER)))));
// Persist this against your order — everything later keys off it.
String checkoutUuid = created.getData().getCheckoutUuid();
String checkoutUrl = created.getData().getCheckoutUrl();ruby
created = MAYTES.create_checkout(
MaytesApiClient::CreateCheckoutRequest.new(
merchant_order_id: 'order_1001',
total_amount: 4500, # minor units — 4500 = AUD 45.00
currency: 'AUD',
return_url: 'https://shop.example.com/thanks?order=order_1001',
cancel_url: 'https://shop.example.com/cart',
# Pass the category variant directly; LineItem is a oneOf wrapper.
items: [MaytesApiClient::OtherLineItem.new(
item_ref: 'GA-1',
name: 'General Admission',
quantity: 1,
unit_price: 4500,
currency: 'AUD',
category: 'other',
)],
),
)
# Persist this against your order — everything later keys off it.
checkout_uuid = created.data.checkout_uuid
checkout_url = created.data.checkout_urlcsharp
using MaytesApiClient.Model;
var created = await maytes.CreateCheckoutAsync(new CreateCheckoutRequest(
totalAmount: 4500, // minor units — 4500 = AUD 45.00
currency: "AUD",
returnUrl: "https://shop.example.com/thanks?order=order_1001",
cancelUrl: "https://shop.example.com/cart",
// Wrap the category variant — LineItem's constructors take variants only.
items: new List<LineItem>
{
new LineItem(new OtherLineItem(
itemRef: "GA-1", name: "General Admission", quantity: 1,
unitPrice: 4500, currency: "AUD",
category: OtherLineItem.CategoryEnum.Other)),
})
{
MerchantOrderId = "order_1001",
});
// Persist this against your order — everything later keys off it.
var checkoutUuid = created.Data.CheckoutUuid;
var checkoutUrl = created.Data.CheckoutUrl;Response:
json
{
"data": {
"checkout_uuid": "019fbb9e-ecd1-7059-99f3-f8bf47b63931",
"status": "created",
"checkout_url": "https://checkout.maytes.co/?id=019fbb9e-ecd1-7059-99f3-f8bf47b63931",
"expires_at": null
}
}The required fields are total_amount, currency, return_url, cancel_url, and at least one item. Optional fields include merchant_order_id, merchant_expires_at, fees, discounts, tax, shipping_amount, customer_data, friends, and metadata. See the API reference for schemas and examples.
Amounts are minor units
All monetary fields are integers in the currency's minor unit. 4500 = AUD 45.00. Never send decimals.
Price the checkout
Amount rules: discounts, shipping, fees and tax
discounts, shipping_amount, fees, and tax are top-level checkout adjustments. They are not special LineItem categories:
itemsare the goods or services the customer is buying. Each has anitem_ref, quantity, unit price, currency, and category.- Adjustments sit alongside
itemsonCreateCheckoutRequest. They explain how the item subtotal becomestotal_amount. - Do not also add an adjustment as a line item, or it will be counted twice.
Maytes recomputes the order and compares it with total_amount. A mismatch returns 422 invalid_amount_arithmetic:
text
total_amount = Σ(item.unit_price × item.quantity)
− Σ(discount.amount)
+ shipping_amount
+ Σ(fee.amount)
+ tax.amount (when tax is not inclusive)Send every amount as an integer in minor units. 500 means AUD 5.00. Adjustment amounts are non-negative. The checkout, every item, every discount, and every fee must use the same currency.
Discounts
discounts is an array of CheckoutDiscount objects. A discount's positive amount is subtracted from the item subtotal.
- Use
scope: 'cart'for an order-wide discount and omitapplies_to. - Use
scope: 'item'to associate the discount with one or more line items, and list theiritem_refvalues inapplies_to. - The amount is applied once. It is not multiplied by item quantity or by the number of references in
applies_to.
Shipping
shipping_amount is one amount for the whole checkout. It uses the checkout currency, is added once, and has no scope or applies_to. Omit it or send 0 when there is no shipping charge.
Use shipping_amount for the order's shipping cost. Do not also represent the same cost as a line item or delivery fee.
Fees
fees is an array of CheckoutFee objects. Fees are named, fixed additions such as a booking fee, surcharge, or carbon offset. They are your cart adjustments, not Maytes' platform fee.
- Cart- and item-scoped fees follow the same
scopeandapplies_torules as discounts. - The fee amount is added once, even when an item-scoped fee references several items.
fee_typedescribes the fee:refund_protection,surcharge,transaction_fee,service_fee,delivery_fee,carbon_offset, orother.
Use delivery_fee only for a separate named fee. If it is the order's shipping cost, use shipping_amount instead.
Tax
tax is one object for the checkout, not a line item:
amountis the tax amount in minor units.inclusive: truemeans the tax is already included in item prices, so it does not increasetotal_amount.inclusive: falsemeanstax.amountis added to the total.percentageis optional. It records the rate, butamountis the value used in the arithmetic.
For example, items worth 5000, a 500 cart discount, 800 shipping, a 200 service fee, and inclusive tax produce total_amount: 5500.
The API wire format uses names such as shipping_amount, fee_type, and applies_to. SDKs use their language's normal casing, such as shippingAmount, feeType, and appliesTo in TypeScript.
Optional checkout fields
Most checkouts can omit these fields.
Set a checkout expiry (optional)
expires_at(response) — yourmerchant_expires_at, echoed in UTC, ornullif you did not send one. The hosted page shows it to the buyer as the deadline.- Independently of that, an unpaid checkout is kept for one hour after creation. After whichever comes first, the checkout cannot be completed; create a new checkout for another attempt.
merchant_expires_at(optional request field, RFC 3339 datetime) — your order deadline. Use it for time-boxed sales such as ticket holds or reservation windows. Any offset is accepted (2026-09-14T13:30:00+10:00or2026-09-14T03:30:00Z); the offset is required. We always return it in UTC, e.g.2026-09-14T03:30:00.000Z.
An uncaptured authorization is automatically voided after 2 minutes. See the capture window.
Pre-fill the split with friends (optional)
If you already know who the customer is splitting with — a table of five, or the names on a group booking — send it as friends and the customer's share and invite screens come pre-filled. The customer can still change any of it. Maytes creates nothing from friends on its own: no accounts, no payment requests, no messages to the people named.
Send just a headcount (friends, not counting the customer):
json
"friends": { "count": 4 }Or the people, with an optional share each. Give amount (minor units) for every person or for none; with no amounts the split is even. Under item_assignment you can give items instead of amount, again for every person or none: { "item_ref": "ticket-7f3a" } means that whole cart line, { "item_ref": "tickets", "quantity": 1 } one unit of a line with several.
json
"friends": {
"people": [
{ "name": "Sam Lee", "mobile": "+61412345678", "amount": 2500 },
{ "name": "Ali Khan", "mobile": "+61400000001", "amount": 3000 }
]
}Leave friends out (or send null) when you have nothing to pre-fill; an empty object is rejected. mobile is E.164. A split that could not be carried out — a share under the minimum charge, more units than ordered, a mobile listed twice, nothing left for the customer — is refused at create with 422 invalid_friends, so fix it on your side rather than letting the customer discover it.
Names and mobiles are personal data: send them only when you hold them, as with customer_data (see Security).
The two redirect URLs
Maytes stores return_url (success) and cancel_url (abandonment) verbatim and passes them to the Maytes window. We do not insert the checkout_uuid.
return_url is a confirmation page, not a fulfillment trigger
In the webhook flow, fulfill on capture success and use return_url only for the customer experience. Capture occurs before the customer leaves Maytes; they may remain in the split step or close the window without reaching return_url, but the payment still stands. See when to capture.
Correlating the return
Include your merchant_order_id in the return_url query string so the success page can identify the order:
return_url: https://shop.example.com/thanks?order=order_1001When the customer lands on /thanks?order=order_1001, use order_1001 to find the saved checkout_uuid. Then GET the checkout and branch on status; in the webhook flow, it will already be captured.
How the customer reaches Maytes
Option A — Maytes Checkout Button (recommended)
Add the Maytes Checkout Button to your page. On click, it calls your backend to create a checkout and opens the hosted checkout: in a centered popup with a full-screen overlay on wide screens (the default), or in the current tab on phones, when the browser blocks the popup, or with mode: 'redirect'. Return checkout_uuid and checkout_url from your backend; the button opens the URL you return.
Option B — Redirect to checkout_url directly
To avoid page-level JavaScript, redirect the customer's browser to the returned checkout_url:
js
res.redirect(created.data.checkout_url);The customer pays in the Maytes-hosted window, then returns to your return_url or cancel_url. This option does not provide the popup and overlay experience.
Option C — from your Stripe Payment Element
If your checkout already runs on Stripe, offer Split with Maytes as a Stripe custom payment method. Selecting it hands control back to your page, which calls your backend to create the checkout and redirects to checkout_url. See Maytes in your Stripe Payment Element, or the simpler express row placement.
Line-item categories at a glance
Every item has a category. Some categories require custom_data; for example, ticket requires event_id, event_start_at, and timezone:
category | Requires custom_data | Notes |
|---|---|---|
ticket | ✅ event_id, event_start_at, timezone (+ optional fields) | Events, gigs, sports |
physical_goods | ✅ product_id | Anything shipped |
digital_goods | optional | Downloads, in-game items |
service | optional | Bookings, time-based services |
food_beverage | — | F&B orders |
donation | — | Charitable contributions |
other | — | Anything that doesn't fit |
See the API reference for each category's request variant, required fields, and optional fields.
custom_data isn't in the SDK yet
The SDK's LineItem does not yet include custom_data, so send ticket and physical_goods carts to POST /api/merchant/v1/checkouts as raw JSON. See the API reference. You can still use the SDK for capture, cancel, status, and webhook verification. The SDK supports categories that do not require custom_data: other, food_beverage, donation, and digital_goods or service when no custom data is needed.
Common pitfalls
Don't recreate on conflict
Retrying create for an order already in progress returns 409 order_already_authorized. Do not create another checkout for the same merchant_order_id; retrieve the existing checkout_uuid from your store and continue with it.
| Pitfall | Fix |
|---|---|
| Amounts as floats / strings | Always integers, minor units. |
| Cart currency doesn't match each item's currency | Every item must use the same currency as the cart total. |
Reusing item_ref across two items in the same cart | item_ref is unique within a cart. |
Forgetting event_id / event_start_at on category: "ticket" | These are required for ticket items; the API returns 422. |
Fulfillment wired to the return_url landing | In the webhook flow that landing may never happen. Fulfill on capture. |
Treating return_url as templated | It isn't. Carry your own correlation key (see above). |
What's next
- Wire up Webhooks — the
checkout.authorizedevent that tells you to capture. - Open the Maytes window with the Maytes Checkout Button.
- Finalize the order with Capture & checkout status.
- Browse every field and error in the API reference.

