Skip to content
Coritan Docs

Take payments through a MAEF parent site

Make your store a child site of a MAEF parent, hand it each cart, pass its signed return on from your storefront and refund what it took.

View as Markdown

MAEF is a WordPress payment plugin in two halves. A parent site takes payments on its own payment account, and each child site hands it a cart and sends the shopper to the parent's payment page. A payment page on Coritan makes your store such a child site, speaking exactly what the plugin's WordPress child speaks, so a parent that serves WordPress children serves your store the same way. Checkout offers it as the payment provider external.

You sell the orders paid through a parent yourself. Coritan is not their merchant of record: we take none of their money, issue no invoice or credit note for them and book nothing on your balance for them, as What the order looks like describes.

The API calls a payment page a payment connector. Its routes are under https://api.coritan.com/api/v1/orgs/{org_slug}/commerce/payment-connectors, and the API reference lists them under Commerce. The dashboard does the same in Payments, as Take payments through your MAEF parent site describes.

  • Our staff turn payment pages on for a store, so ask support. Until then, adding a page answers 409 with external_payments_not_enabled, and the list of pages has external_payments_enabled: false.
  • Adding, changing, testing and deleting pages takes an organization API key with the commerce.payments:write scope, or a member's token with the Admin role or above. Reading them takes commerce.payments:read, or the Billing role or above.
  • Have the parent site's address and its secret key, which is at the bottom of the parent's MAEF Parent settings.
  • Set the store's storefront_url. We hand the parent <storefront_url>/thank-you as the address to send each shopper back to. A live parent has sent shoppers to the address it holds for your site instead, the one your WordPress child used, so keep the page off until your storefront is served at that address. A real payment started anywhere else comes back there, and the site there can make orders of its own from it.
  • List external in the payment_providers of each region that should offer the page, as Add regions describes.
  • A store can also use its payment pages for hosted checkout pages. With hosted checkout pages turned on, you can add and manage payment pages without turning on payment pages at checkout. The list then answers external_payments_enabled: true, but checkout offers external only when our staff turned payment pages on.
  1. Your storefront lists the cart's payment providers, as Take payment describes. external is among them when a page can take the cart's payment, with the display_name, description and brands to show in its config.
  2. The storefront starts a payment session with external. We hand the cart to the parent, signed with its secret, and answer the session with redirect_url, the parent's own payment page.
  3. The storefront sends the shopper to redirect_url, and the shopper pays there.
  4. The parent sends the shopper to /thank-you on the address it holds for your site, which must be your storefront's, with maef_complete, sig and maef_parent in the query.
  5. Your storefront passes that query on. We check the parent's signature, and a payment that succeeded becomes the order at once.

We trust only what the parent signs. A shopper arriving at /thank-you proves nothing until its signed query has been passed on.

Shell
curl -X POST "https://api.coritan.com/api/v1/orgs/acme/commerce/payment-connectors" \
  -H "X-API-Key: $ORG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "livemode": true,
    "display_name": "Credit / Debit Card",
    "description": "Pay with your card, Apple Pay or Google Pay.",
    "brands": ["visa", "mastercard", "amex", "apple_pay", "google_pay"],
    "parent_url": "https://parent.example.com",
    "parent_secret": "'"$MAEF_PARENT_SECRET"'",
    "currencies": ["USD"]
  }'
Field Takes
display_name The name the storefront shows for the page, up to 80 characters. Required.
parent_url The parent site's address: https on a public host, up to 1,000 characters, without a ? or # part. A trailing / is dropped. It can also be your organization's own app or service on Coritan, on the default https port (Use your own app as the parent). Required.
parent_secret The parent's secret key, up to 500 characters. Spaces and line breaks are dropped, as the plugin drops them. It is stored sealed and never shown again. Required.
livemode true for live carts, or false for test carts, which is the default. It never changes, so add a second page for the other mode. The parent charges real cards in both.
description Text the storefront shows under the name, up to 300 characters.
brands The marks the storefront shows beside the name, from visa, mastercard, amex, discover, apple_pay and google_pay. What the parent takes is up to the parent.
currencies The currencies the parent takes, up to 50, such as ["USD", "EUR"]. null, the default, takes any.
match_minutes How long a payment the parent takes late still pays for its cart, from 60 to 10,080 minutes. Defaults to 4320, three days, as the plugin looks back three days.
enabled false adds the page turned off. Defaults to true.
kind maef_child, the only kind, which is the default.

The answer is 201 with the payment_connector, which never holds the secret:

JSON
{
  "payment_connector": {
    "id": 4,
    "kind": "maef_child",
    "livemode": true,
    "enabled": true,
    "display_name": "Credit / Debit Card",
    "description": "Pay with your card, Apple Pay or Google Pay.",
    "brands": ["visa", "mastercard", "amex", "apple_pay", "google_pay"],
    "parent_url": "https://parent.example.com",
    "currencies": ["USD"],
    "match_minutes": 4320,
    "has_secret": true,
    "created_at": "2026-10-04T11:40:00Z",
    "updated_at": "2026-10-04T11:40:00Z"
  }
}

A store has up to 10 payment pages. Beyond that, adding one answers 409 with limit_reached. With more than one turned on in a mode that takes the cart's currency, payments take turns between them, as the plugin's list of parents does.

Use your own app as the parent

Section titled Use your own app as the parent

The parent can be an app your organization runs on App Deployment, such as a store backend that answers the plugin's create-order-session request. Use one of these as parent_url, on the default https port, with no user name or password in it:

  • a custom domain of the app, once the app's Domains tab shows it as verified;
  • the app's platform address, such as https://web-shop.apps.example.net, shown in the app's header;
  • the domain of a web proxy in front of a container or server your organization runs on Coritan, once the proxy is linked to that service. Ask Coritan support to link it.

The app or service must belong to this organization and be active. We call it through Coritan's public edge, as a visitor's request would arrive: the name must lead to the edge, and never to a private address. This holds for each place we call the parent: a payment, the connection test and the hand-off test. The rule is the one your organization's webhooks follow. An app of another organization is refused like any other Coritan address, with resolves to an address of the platform itself.

We check again before each call. When the app has moved to another organization, stopped, or its domain is no longer verified, nothing is sent, and the test says the parent was refused.

POST /commerce/payment-connectors/{connector_id}/test sends the parent the plugin's own connection test: a signed empty cart, which moves no money.

JSON
{"connected": true, "http_status": 400, "message": "The parent site answered and accepted the secret."}

connected is true when the parent answered 400 or 200, the answers of a parent that checked the signature. A 401 or 403 means it refused the signature, so the secret is wrong.

POST /commerce/payment-connectors/{connector_id}/test-hand-off hands the parent a sample cart, as a payment would: one unit of the first variant that has a maef_product_id, at its price in the page's currency. Nobody is charged, but the parent keeps an unpaid payment for it.

JSON
{
  "started": true,
  "redirect_url": "https://parent.example.com/?maef_start_checkout=8f3c1e",
  "message": "The parent site took the sample cart and answered with its payment page.",
  "sample": {"product_id": 90, "name": "Sample Mug - 350 ml", "quantity": 1, "amount": 8999, "currency_code": "USD"},
  "unmapped_variants": [{"variant_id": 212, "sku": "MUG-500", "title": "Sample Mug - 500 ml"}]
}

unmapped_variants lists up to 50 variants with no maef_product_id. It answers 409 with no_mapped_variant, and the same list, when no variant has one with a price in the page's currency, and 409 with connector_incomplete for a page with no parent or secret.

Name your products for the parent

Section titled Name your products for the parent

A parent knows each child's products by the product IDs and names the child sends it. For it to see yours as it saw them on a WordPress child, give each variant two keys in its metadata:

Key Holds
maef_product_id The product's ID on the WordPress child, a whole number. Without it we send 0.
maef_name The line's name on the WordPress child, such as Sample Mug - 350 ml. Without it we send the product's title and the variant's title, joined as <title> - <variant>, as WooCommerce names a variation.

Set them in the variant's metadata, with PATCH /commerce/products/{product_id}/variants/{variant_id} or in the variants of a product, as Add products describes. A variant's metadata is replaced whole, so send its other keys too.

Starting a payment with external posts the cart to <parent_url>/wp-json/maef/v1/create-order-session, with the plugin's own body, in the plugin's key order:

JSON
{"cart":[{"product_id":90,"quantity":2,"name":"Sample Mug - 350 ml","price":89.99,"line_total":179.98},{"product_id":250,"quantity":1,"name":"Sample Sticker","price":0,"line_total":0}],"subtotal":179.98,"shipping_cost":12,"shipping_label":"Shipping","discount_total":89.99,"tax_total":0,"total":106.98,"return_url":"https:\/\/shop.example.com\/thank-you","coupon_codes":["welcome15"],"affiliate_id":"","utm_params":{"utm_source":"google","gclid":"Cj0KCQjw"},"child_domain":"https:\/\/shop.example.com","timestamp":1791115200,"wc_order_id":1000001042,"customer_billing":{"first_name":"Ada","last_name":"Lovelace","email":"ada@example.com","phone":"+15555550100","address_1":"7901 4th St N","address_2":"","city":"St. Petersburg","state":"FL","postcode":"33702","country":"US","company":""},"customer_shipping":{"first_name":"Ada","last_name":"Lovelace","address_1":"7901 4th St N","address_2":"","city":"St. Petersburg","state":"FL","postcode":"33702","country":"US","company":""}}
  • Money is in the currency's main unit, as PHP writes it: 12 rather than 12.00, and 89.99. price is each line's subtotal divided by its quantity, and line_total its subtotal before discounts. A free gift is a line at 0.
  • discount_total is the discounts on the items, coupon_codes the promotion codes the cart used, shipping_cost the shipping after its discounts and before tax, and tax_total all the tax. total is what the shopper pays, store fees included, which appear nowhere else, as on a WordPress child's orders.
  • return_url is <storefront_url>/thank-you and child_domain the storefront_url.
  • affiliate_id and utm_params are the cart's maef_affiliate_id and maef_utm_params metadata, which your storefront sets as Keep the attribution describes.
  • wc_order_id is the payment session's id plus 1,000,000,000, so it is never the ID of an order on a WordPress child of the same parent.
  • The body is written byte for byte as PHP's json_encode writes it, with \/ for / and \u escapes for anything beyond ASCII, and signed in the x-maef-signature header with the lowercase hex HMAC-SHA256 of those bytes, keyed with the parent's secret.

The parent answers with success and its redirect_url, which becomes the session's redirect_url. Starting the payment again for the same cart answers the same redirect_url without asking the parent again, and a changed cart makes a new session. A parent that refuses the cart, or does not answer within 20 seconds, fails the session with 502 and payment_provider_error, and the shopper may start again. A store with no storefront_url answers 422 with field set to storefront_url.

After the shopper pays, the parent sends them to /thank-you on the address it holds for your site (we hand it <storefront_url>/thank-you) with three query parameters:

Parameter Holds
maef_complete The result, as base64 JSON.
sig The lowercase hex HMAC-SHA256 of that JSON, keyed with the parent's secret.
maef_parent The parent's address.

Your storefront passes the query string on, untouched, with its publishable key. It needs no secret: we check the signature.

Shell
curl -X POST "https://api.coritan.com/api/v1/orgs/acme/store/payment-returns/maef" \
  -H "x-publishable-api-key: $PUBLISHABLE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "maef_complete=eyJvcmlnaW5hbF9wYXlsb2FkIjp7...&sig=5b1f...&maef_parent=https%3A%2F%2Fparent.example.com"}'
JSON
{"outcome": "placed", "cart_id": "cart_01j8z4a7b2c9d3e6f5g8h1k0m4", "order_id": "order_01j8z3k4m5n6p7q8r9s0t1v2w3"}
outcome What it means, and what to show
placed The cart is an order. Complete cart_id as Complete the order describes, which answers the order, and show it.
processing The parent holds the payment for review, or we are still placing the order. Show that the payment is being confirmed, and complete the cart again in a moment.
failed The parent says the payment failed. Send the shopper back to checkout to pay again.
review The parent took a payment that could not pay for an order. Show that the payment was received and that you will be in touch. You refund it, as Refund what could not become an order describes.

cart_id is null when the return named none of the store's payments. Passing the same return again answers what the first one came to, however long ago, so passing it on every time the page loads is safe.

Answer Why
401 with invalid_signature sig does not match the secret of any of the store's payment pages.
410 with return_expired The parent signed the return more than 15 minutes ago, and we have not had it before.
422 with invalid_return The query has no maef_complete, its sig is not 64 hex characters, or payment_status is not one the plugin sends.
429 with rate_limited The store passed on more than 60 returns with a wrong signature in 10 minutes, or more than 600 returns with a good one. A wrong signature counts only against the 60, so a flood of bad returns cannot use up the 600 that real returns need.

A return names its payment with wc_order_id. Some parents leave it out of what they send back, so a return without it pays for the newest of the store's payments with the same buyer email and total, inside its page's match_minutes, as the plugin itself falls back to. A return that names an order of a WordPress child of the same parent pays for none of yours.

The parent's payment_status decides what the return does: processing and completed are a payment that succeeded, on-hold one held for review, and failed one that failed. When a success becomes the order, the order also takes the buyer's billing address from the parent, and its shipping address when the cart still costs what was paid with it.

A WordPress child keeps four cookies for 30 days and sends them to the parent. To send the parent the same, keep them in your storefront and write two cart metadata keys before you start the payment:

Cart metadata key Holds
maef_affiliate_id The am_id or affiliate_id query parameter the shopper first arrived with, as text.
maef_utm_params An object of the utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_id, gclid, fbclid, ttclid and msclkid parameters seen, the first external referrer, and the first visit's session_entry, session_source, session_medium and session_type.

An order paid through a parent is yours to sell:

  • Its seller_of_record is merchant and its seller_entity_key is null, where the store's other orders name a Coritan company.
  • We issue no invoice or credit note for it, so its documents stay empty, and the Store API's sold_by is null.
  • We book nothing on the store's balance or ledger for it: no sale, no commission and no processing fee. Its tax is worked out as on any cart, and the tax report leaves it out, so account for it yourself.
  • Its payment has the provider external, and maef-parent-<parent order ID> as its page_reference. Its metadata holds maef_parent_order_id, and maef_coupon_codes when the parent sent the codes back.
  • With payment routing on, its payment_route says which route paid for it.
  • We send commerce.order.placed and commerce.payment.captured as for any order, and email the shopper the order confirmation.

Until the parent's return arrives, completing the cart answers 409 with payment_processing for 15 minutes after the shopper was last sent to the parent. After that it answers 409 with payment_requires_action, and the shopper can pay again. A success the parent sends back later still places the order, inside the page's match_minutes, unless the cart was paid another way or changed in the meantime.

Refund an order paid through a parent

Section titled Refund an order paid through a parent

Return the money to the shopper at the parent, then record the refund with POST /commerce/orders/{order_id}/refunds, as Refund or cancel an order describes. We move no money: the refund is succeeded at once, with a gateway_refund_id that starts with external_refund_, and no credit note. What is left to refund goes down, the order's timeline says to return the money at the payment page's provider, and we email the shopper the refund notice and send commerce.payment.refunded. Cancelling the order records the refund of what is left in the same way.

Refund what could not become an order

Section titled Refund what could not become an order

We never refund a payment the parent took that could not pay for an order, so refund it at the parent. The page's events, in Read what a parent sent back, say why in detail.reason:

reason What happened
second_payment The parent already sent back a success for this payment, and this one is another payment for it.
amount_mismatch The total is not the payment's.
cart_missing The cart no longer exists.
already_ordered The cart already became an order.
session_replaced Checkout started another payment for the cart, at the parent or another way to pay.
cart_not_open The cart was closed without an order.
paid_otherwise Another payment for the cart already succeeded.
cart_changed The cart's total or currency changed after the payment started.
no_session The return named no payment of the store, and its email and total matched none.
other_child The return is for an order of a WordPress child of the same parent.
Another code, such as insufficient_inventory We could not place the order, for the reason the code names. order_not_placed gives no reason.

When the cart already has an order, the payment joins it: the order's payments hold it with unmatched: true, and once you have refunded it, you record that with its payment_id. Otherwise there is no order to record it on.

For each one, we send the commerce.payment.refund_required webhook:

JSON
{
  "id": "evt_48230",
  "type": "commerce.payment.refund_required",
  "livemode": true,
  "created_at": "2026-10-04T12:41:07Z",
  "resource": {"type": "cart", "id": "cart_01j8z4a7b2c9d3e6f5g8h1k0m4"},
  "data": {"cart": "cart_01j8z4a7b2c9d3e6f5g8h1k0m4", "session_id": 1042, "order_id": null, "amount": 10698, "currency_code": "USD", "reference": "maef-parent-98765", "reason": "cart_changed", "livemode": true}
}

resource is the order when the payment joined one, and order_id is then its numeric id. For a return that named no payment of the store, cart and session_id are null and email holds the buyer's address.

GET /commerce/payment-connectors/{connector_id}/events lists the returns the page's parent sent, newest first, 50 at a time and up to 200 with limit. Filter it by status (processed, ignored or unmatched) and by type (payment.succeeded, payment.failed or payment.pending), and page back by sending next_before_id as before_id.

Shell
curl "https://api.coritan.com/api/v1/orgs/acme/commerce/payment-connectors/4/events?status=unmatched" \
  -H "X-API-Key: $ORG_API_KEY"

Each event has an event_id of maef-<parent order ID>-<succeeded|pending|failed>, with its type, session_id, status and created_at. Its detail holds the reference, parent_order_id, payment_status, the buyer's email, the amount and currency_code, the wc_order_id and, once known, the reason, the order_id, the cart and the addresses the order took from the parent.

Change, turn off or delete a page

Section titled Change, turn off or delete a page
  • GET /commerce/payment-connectors lists the pages, oldest first, with external_payments_enabled. GET /commerce/payment-connectors/{connector_id} answers one.
  • PATCH /commerce/payment-connectors/{connector_id} changes the fields you send, with the same rules, and "description": null removes the description. parent_secret replaces the saved secret, for when the parent changed its own. livemode and kind cannot change, which answers 422.
  • "enabled": false turns the page off. No new cart is offered it, and the payments already started on it still complete when the parent sends them back.
  • DELETE /commerce/payment-connectors/{connector_id} answers {"deleted": true}. While a shopper may still pay on its parent, it answers 409 with connector_in_use, and open_sessions counts those payments: a payment that is still open counts for the page's match_minutes. Turn the page off instead, and delete it once they are done.

Caution

Deleting a page cannot be undone. A return for a payment started on a deleted page pays for no cart.

Checkout offers your page as external to carts of its mode and currency in the regions that list it. The parent takes each payment on its own page, and a shopper who pays comes back to your storefront, which passes the parent's return on and shows an order whose seller_of_record is merchant. The page's events show each return.

409 with external_payments_not_enabled
Our staff have not turned payment pages on for the store. Ask support. When they turn them off, your pages stay, but no cart is offered them and no page can be added.
422 with field set to parent_url
The message says why: the address is not https, its host is not public, it has a ? or # part, or it points at a Coritan address that is not your organization's own app or service (Use your own app as the parent). An own app is also refused with a port other than the default https port, or with a user name or password in the address.
502 with payment_provider_error, or message starting Refused to call the parent site in a test, naming resolves to an address of the platform itself
The parent's name leads to Coritan's own network and is not an app or service your organization runs. For your own app, check on its Domains tab that the custom domain is verified and the app is active.
422 with field set to storefront_url when starting a payment
The store has no storefront_url, so the parent has nowhere to send the shopper back. Set it.
502 with payment_provider_error when starting a payment
The parent refused the cart or did not answer. Test the page, as Test the parent describes.
401 with invalid_signature for a return
The return was signed with a secret none of the store's pages has. Check each page's parent_secret against the parent's MAEF Parent settings with the test route.
410 with return_expired
The shopper came back more than 15 minutes after the parent signed the return, and nothing passed it on before. Its payment is still on the parent: look it up there, and pass on a fresh return or place the order by hand.
The storefront is not offered external
Check that our staff turned payment pages on, that the cart's region lists external, that a page that is turned on is in the cart's mode and takes its currency, and that the cart neither buys nor spends a gift card. With payment routing on, the cart's route must also list external.
Completing the cart answers payment_processing after the shopper paid
We have not had the parent's return. Check that your storefront's /thank-you passes its query string to POST /store/payment-returns/maef.

API operations on this page

MethodPathWhat it does
GET/api/v1/orgs/{org_slug}/commerce/payment-connectorsList the store's payment pages, oldest first
POST/api/v1/orgs/{org_slug}/commerce/payment-connectorsAdd a MAEF parent site that takes the store's payments
GET/api/v1/orgs/{org_slug}/commerce/payment-connectors/{connector_id}Read one payment page
PATCH/api/v1/orgs/{org_slug}/commerce/payment-connectors/{connector_id}Change what a page shows, its parent site or secret, or turn it off
DELETE/api/v1/orgs/{org_slug}/commerce/payment-connectors/{connector_id}Delete a payment page
GET/api/v1/orgs/{org_slug}/commerce/payment-connectors/{connector_id}/eventsList the returns the page's parent sent, newest first
POST/api/v1/orgs/{org_slug}/commerce/payment-connectors/{connector_id}/testCheck that the parent site answers and takes the page's secret
POST/api/v1/orgs/{org_slug}/commerce/payment-connectors/{connector_id}/test-hand-offHand the parent a sample cart, as a payment would, and see whether it takes it
POST/api/v1/orgs/{org_slug}/store/payment-returns/maefReceive maef return