API workflow examples
Sign in, start checkout or a balance top-up, and send a support form with an attachment.
Run the examples in Bash on your application server. Set BASE_URL to your CMS origin and load MINEXON_API_KEY from your server’s secret store. Use the same cookie jar for all requests in one player’s flow. Create an API key and verify access
BASE_URL='https://cms.example.com'
API="$BASE_URL/api/v1/en"
umask 077
COOKIE_JAR="$(mktemp)"
trap 'rm -f "$COOKIE_JAR"' EXIT
cms_api() {
curl --silent --show-error --fail-with-body \
-b "$COOKIE_JAR" -c "$COOKIE_JAR" \
-H "Authorization: Bearer $MINEXON_API_KEY" "$@"
}Sign in and verify the session
Call discovery to check your key’s permissions. If captcha.sign_in is present, use its provider and site_key to display the widget and add the resulting value as minexon_captcha_response to the sign-in body. Replace the example username and password with test account credentials. Sign-in reference
cms_api -H 'Content-Type: application/json' \
--data '{"username":"SamplePlayer","password":"REPLACE_WITH_TEST_PASSWORD"}' \
"$API/account/sign-in"- If
nextleads to two-factor verification, POST{"code":"123456"}to"$API/account/two-factor"with the player’s actual code and the same cookie jar. Two-factor verification - If
nextleads to email verification, POST the emailed code ascodeto"$API/account/verify-email"in the same session. Checknextagain for any further verification. Email verification - Once the account flow is complete, call
cms_api "$API/account/profile"and checkdata.member. Player profile
For a new account, read data.registrationFields and data.registrationSchema from the registration form. For password registration, send username, email, new_password, and confirm_password. Send custom answers in the registration object and pass the schema value as registration_schema. If discovery returns captcha.registration, include a widget response. If the form specifies forcedRegistrationProvider, start registration through that provider. Registration form · Register
Start cart checkout
Use a published product’s data.product.slug in the add request. The add response’s top-level count is the total quantity in the cart. Read the cart in the same session to get the checkout inputs. Product · Add to cart · Read cart
cms_api -H 'Content-Type: application/json' \
--data '{"product":"example-product"}' \
"$API/cart/items"
cms_api "$API/cart"After sign-in, POST to "$API/cart/checkout" using the current cart data. This example assumes the installation offers paytr_5, the method has a pricing token, and the shopper has accepted the sales agreement. Use values from the latest cart response and enter the contact and address details provided by the shopper. Checkout reference
{
"quote": "CURRENT_CART_QUOTE",
"payment": "paytr_5",
"payment_terms": {
"paytr_5": "CURRENT_METHOD_TOKEN"
},
"agreement": "CURRENT_AGREEMENT_TOKEN",
"payment_customer": {
"first_name": "Deniz",
"last_name": "Kaya",
"phone": "+12025550123",
"address": "12 Example Street"
}
}- Copy
data.quotetoquote. Setpaymentto the key of a method available for the amount due. If that method has a nonemptypricing.token, put it inpayment_termsunder the same key. - If an agreement applies, display it and send
data.checkoutAgreement.tokenasagreementafter the shopper accepts. Usepayment_customerfor any details required by the selected method. If the shopper elects to use site credit andallowBalancepermits it, senduse_credit: true. When credit covers the full amount, omit the external payment method. - If checkout returns a cart destination or a pricing error, read the cart again with the same cookies. Inspect
data.checkoutErrorand show the current amount and conditions before retrying.
For a provider URL in next, open it in the shopper’s browser. If data.type is hosted_payment_form, render a form in the browser that submits data.fields to data.action using data.method (POST). Use the receipt’s data.order.status to check whether the payment settled. The checkout handoff can occur while the order is pending. Order receipt
Start a balance top-up
- Read
GET /api/v1/en/wallet/top-upin the signed-in session. Choose a key fromdata.packagesand a method fromdata.paymentMethods. For a custom amount, sendpackage: "custom",amountas a decimal string such as"100.00"in the displayed currency, andamount_termswithdata.amountTermswhen populated. Top-up options - If the player uses a promotion, apply it with
promo_codein the same session, then include that code in the payment request. Apply a promotion - POST to
/api/v1/en/wallet/top-up/paywithpackage, the selectedpaymentkey, and the relevantpayment_terms,payment_customerand acceptedagreementvalues. Handle the provider handoff as in checkout. Verify the credit indata.walletHistoryafter settlement. Start top-up payment · Player profile
Submit a support ticket with an attachment
In the signed-in session, fetch the form and check data.showForm and data.attachmentLimits. Set CATEGORY_ID to a category ID from data.categories and SUBMISSION to data.submission. New ticket form
cms_api "$API/support/form"Set the attachment path to a local file accepted by the form. If discovery returns captcha.support_create, include the widget response as another multipart field named minexon_captcha_response. Create ticket
cms_api --form-string "category=$CATEGORY_ID" \
--form-string "_submission=$SUBMISSION" \
--form-string "subject=Problem joining the server" \
--form-string "message=The game disconnects when I join Survival." \
--form 'attachments[][email protected]' \
"$API/support/tickets"Check data.errors on a validation response. After creation, use the returned next as the ticket’s site location. For a reply, get the ticket’s current data.submission and send it as _submission. Forum topics use the same field name with the value from their own form. Ticket details · New forum topic form