---
name: coronium-mpp-checkout
description: Quote one eligible Coronium dedicated rental and use the buyer’s Link wallet approval to pay through Stripe MPP and confirm delivery.
---

# Buy one dedicated rental with Stripe MPP

## Choose the access you need

- For a price estimate, read [Coronium’s public catalog](https://www.coronium.io/api/catalog). A [guest cart](https://www.coronium.io/auth.md) can save an estimate. It has no permission to reserve a line or pay.
- For a purchase, use the buyer's own Coronium dashboard API key and a buyer-authorized payment method. Get the key from **Account → API Access** through the buyer’s secret manager. Never request a Stripe merchant secret key, card number or access token in chat.
- The buyer can connect their own Link wallet using the [official Link CLI](https://github.com/stripe/link-cli) with `npm install -g @stripe/link-cli@1.6.0` and `link-cli auth login`. A hosted application can obtain a buyer Link OAuth access token and use `@stripe/link-sdk@3.2.0` in Node.js 20 or newer. A CLI login is local to the CLI. An SDK application obtains its own authorized token. `stripe agent setup` configures merchant development tools. It does not connect the buyer’s wallet or authorize a purchase.

## Quote the exact request

1. Select one eligible dedicated daily, weekly or monthly tariff and obtain the buyer's maximum USD total. Create a unique, stable order key (a UUID works). Keep the serialization, amount cap, key and buyer account throughout this order.
2. Send `POST https://api.coronium.io/api/v3/payment/mpp` with the buyer’s account key in `Authorization: Bearer`, the order key in `Idempotency-Key`, and JSON `tariff_id`, `currency: "usd"` and `max_total_usd` (dollars). Add `X-Coronium-Proxy-Credentials: separate-protocol-v1` only if the client supports distinct HTTP and SOCKS5 credentials. This first request has no `Payment-Authorization` header and does not charge.
3. Inspect the returned HTTP 402 `WWW-Authenticate` challenge. The Link CLI can decode the complete header locally with `link-cli mpp decode --challenge "$CHALLENGE"`. A hosted client can use `const decoded = await link.mpp.decode(request)` with its original POST URL, headers and exact body string. Verify the HTTPS origin, realm `api.coronium.io`, `stripe` charge intent, USD, expiry and the merchant network ID for [Coronium on Stripe](https://stripe.com/@proxynetwork). The challenge amount is **cents**. Show the plan, duration, merchant and exact amount to the buyer. An in-stock catalog row alone does not establish checkout eligibility.

### Save the quote to a private order directory

Use Bash, `curl`, `jq`, Node.js and Link CLI 1.6.0. Supply `CORONIUM_API_KEY` from your secret manager. Set `TARIFF_ID` from the public catalog, `TERM` to its rental duration and `MAX_TOTAL_USD` to the buyer’s ceiling in dollars. Choose a new path for `ORDER_DIR` under a private directory. Keep this path for retries and run one checkout at a time for each order directory. This example supports distinct HTTP and SOCKS5 credentials.

```bash
(
  set +x
  set -euo pipefail
  umask 077
  : "${CORONIUM_API_KEY:?buyer API key required}" "${ORDER_DIR:?choose one private order path}"
  : "${TARIFF_ID:?catalog tariff ID required}" "${MAX_TOTAL_USD:?buyer price cap in USD required}" "${TERM:?catalog rental duration required}"
  if mkdir -m 700 "$ORDER_DIR" 2>/dev/null; then
    jq -ecn --arg tariff "$TARIFF_ID" --argjson cap "$MAX_TOTAL_USD" \
      'select(($cap|type) == "number" and $cap > 0) | {tariff_id:$tariff,currency:"usd",max_total_usd:$cap}' > "$ORDER_DIR/order.json"
    node -p 'require("node:crypto").randomUUID()' > "$ORDER_DIR/order-key"
    printf '%s\n' "$TERM" > "$ORDER_DIR/term"
  fi
  # An existing directory always reuses its saved request and original order key.
  key=$(cat "$ORDER_DIR/order-key")
  jq -e --arg id "$TARIFF_ID" --argjson cap "$MAX_TOTAL_USD" \
    '.tariff_id == $id and .max_total_usd == $cap' "$ORDER_DIR/order.json" > /dev/null
  [[ "$TERM" == "$(cat "$ORDER_DIR/term")" && -n "$key" ]]
  if [[ ! -s "$ORDER_DIR/challenge" ]]; then
    code=$(printf 'Authorization: Bearer %s\n' "$CORONIUM_API_KEY" |
      curl --silent --show-error --max-time 25 --header @- --header "Idempotency-Key: $key" \
        --header 'Content-Type: application/json' --header 'X-Coronium-Proxy-Credentials: separate-protocol-v1' \
        --data-binary "@$ORDER_DIR/order.json" --dump-header "$ORDER_DIR/headers" \
        --output "$ORDER_DIR/quote-response.json" --write-out '%{http_code}' \
        'https://api.coronium.io/api/v3/payment/mpp')
    [[ "$code" == 402 ]] || { printf 'Quote unavailable (HTTP %s). Inspect the saved response.\n' "$code"; exit 1; }
    challenge=$(awk 'tolower($1) == "www-authenticate:" {sub(/^[^:]*:[ \t]*/, ""); sub(/\r$/, ""); print}' "$ORDER_DIR/headers")
    [[ "$challenge" == "Payment "* ]] || { printf 'Missing Payment challenge.\n'; exit 1; }
    printf '%s\n' "$challenge" > "$ORDER_DIR/challenge"
  fi
  link-cli mpp decode --challenge "$(cat "$ORDER_DIR/challenge")" --format json > "$ORDER_DIR/decoded.json"
  jq -e '(.expires | sub("[.][0-9]+Z$"; "Z") | fromdateiso8601) > now' "$ORDER_DIR/decoded.json" > /dev/null || {
    printf 'The saved quote expired. Read the refresh instructions below.\n'; exit 1
  }
  jq -er --argjson cap "$MAX_TOTAL_USD" 'select(.realm == "api.coronium.io" and .method == "stripe" and .intent == "charge" and .request_json.currency == "usd")
    | (.request_json.amount | tonumber) | select(. > 0 and . == floor and . <= ($cap * 100 | round))' \
    "$ORDER_DIR/decoded.json" > "$ORDER_DIR/quote-cents"
  jq '{merchant_network_id:.network_id, amount_cents:.request_json.amount, currency:.request_json.currency}' "$ORDER_DIR/decoded.json"
  printf 'Tariff %s for %s. Stop here for the buyer to review the offer.\n' "$TARIFF_ID" "$TERM"
)
```

If a quote expires and there is no saved approval or payment attempt, move only the saved `challenge` file to a private archive and rerun the quote step with the same order key and JSON. Once a wallet approval or payment attempt exists, check the original order and approval status first. Never use an earlier approval for changed terms.

## Authorize and pay

Use a wallet only when the buyer asks to purchase that offer. Link creates a one-time spend request for the quoted amount, currency and merchant network ID. Write a specific buyer-readable reason covering their plan, duration and maximum. Send the wallet's approval URL to the buyer and wait for the wallet's status to be `approved`. A successful poll or an existing wallet login alone does not authorize the charge.

- In a private CLI session, `link-cli mpp pay` accepts the original URL, `--method POST`, the original `--data`, repeated `--header` options and a buyer-readable `--context` of at least 100 characters. It requests approval and then attempts a real payment. In structured mode, present only the approval URL and safe order summary to the buyer. Arguments containing a Bearer header and the returned `_next.pay_argv` may expose the Coronium key in process inspection or logs. Use the SDK in a shared or hosted environment.
- With the Link SDK, obtain buyer OAuth authorization and construct `new Link({ accessToken })` using the authorized token. After `link.mpp.decode(request)`, use `link.spendRequests.create` with `credential_type: "shared_payment_token"` and the decoded amount, currency, network ID and verified context. Call `link.spendRequests.requestApproval(id)`. Once approved, `link.mpp.pay(decoded.request, { spendRequestId: id, approvedChallenge: decoded.www_authenticate })` attempts the charge. The SDK retains the buyer’s Coronium Bearer header and returns the payment credential using the challenge’s separate `Payment-Authorization` header. Keep account credentials, grants, continuation arguments and full protocol responses out of logs.
- If the merchant, amount or rental terms change, stop and present the new offer. If the wallet is unavailable or the buyer declines, they can choose [dashboard checkout](https://dashboard.coronium.io). Get new approval before switching payment methods.

### Copyable Link CLI recipe

Use Bash and `jq` on a private workstation. On a shared host, use the SDK to keep the Coronium Bearer out of process arguments. Sign in to your own Link wallet first. This example opts in to separate HTTP and SOCKS5 credentials; use that same preference for the original quote. The buyer must review the exact quoted amount and term before starting.

Set the same `ORDER_DIR` and buyer’s `CORONIUM_API_KEY` used for the quote. The example reads the exact request bytes, original idempotency key and quoted cents from that directory. Each Link CLI 1.6.0 payment or spend-status command returns an array in structured mode. The example requires exactly one result and discards the secret-bearing continuation arguments.

```bash
(
  set +x
  set -euo pipefail
  umask 077
  : "${CORONIUM_API_KEY:?buyer API key required}" "${ORDER_DIR:?original private order directory required}"
  ORDER_KEY=$(cat "$ORDER_DIR/order-key")
  ORDER_BODY_FILE="$ORDER_DIR/order.json"
  CHALLENGE_FILE="$ORDER_DIR/challenge"
  QUOTE_CENTS=$(cat "$ORDER_DIR/quote-cents")
  TERM=$(cat "$ORDER_DIR/term")
  single='if type == "array" and length == 1 and (.[0] | type) == "object" then .[0] else error("Expected one Link result") end'
  url='https://api.coronium.io/api/v3/payment/mpp'
  body=$(cat "$ORDER_BODY_FILE" && printf '.'); body=${body%.}  # retain trailing newlines
  challenge=$(cat "$CHALLENGE_FILE")
  tariff=$(jq -er '.tariff_id | select(type == "string")' "$ORDER_BODY_FILE")
  order=(mpp pay "$url" --method POST --data "$body"
    --header 'Content-Type: application/json'
    --header "Authorization: Bearer $CORONIUM_API_KEY"
    --header "Idempotency-Key: $ORDER_KEY"
    --header 'X-Coronium-Proxy-Credentials: separate-protocol-v1')
  saved="$ORDER_DIR/link-approval.json"

  # Structured mode requests the buyer's approval. Keep only the safe fields.
  if [[ ! -f "$saved" ]]; then
    jq -e '(.expires | sub("[.][0-9]+Z$"; "Z") | fromdateiso8601) > now' "$ORDER_DIR/decoded.json" > /dev/null || {
      printf 'Quote expired before approval. Refresh the quote for this order.\n'; exit 1
    }
    link-cli "${order[@]}" --format json --amount "$QUOTE_CENTS" \
      --context "Please approve one dedicated Coronium mobile proxy rental for tariff $tariff for $TERM. The exact one-time price shown in Link must match the USD quote you reviewed." \
      | jq -ec "$single | "'select(.id) | {id, approval_url}' > "$saved.tmp"
    mv "$saved.tmp" "$saved"
  fi
  id=$(jq -er .id "$saved")
  status=$(link-cli spend-request retrieve "$id" --format json | jq -er "$single | .status")
  if [[ "$status" != approved ]]; then
    printf 'Link status: %s\n' "$status"
    if [[ "$status" == pending_approval ]]; then jq -r '.approval_url // empty' "$saved"; fi
    exit 0
  fi

  # This call can charge the buyer. It runs only after Link confirms approval.
  result="$ORDER_DIR/coronium-result.json"
  if [[ ! -e "$result" ]]; then
    link-cli "${order[@]}" --format json --spend-request-id "$id" \
      --approved-challenge "$challenge" > "$result" || {
      printf 'Payment result uncertain. Check the original order in your Coronium account before retrying.\n' >&2; exit 1
    }
  fi
  if [[ ! -s "$result" ]] || ! jq -e "$single | "'select((.status|type) == "number") |
    {http_status: .status, order: (.body | try fromjson catch null |
      if type == "object" then {payment_id, state, status_url} else null end)}' "$result"; then
    printf 'No usable receipt. Check the original order in your Coronium account before retrying.\n' >&2; exit 1
  fi
)
```

If Link returns `pending_approval`, open the approval URL, review the merchant and amount, and rerun with the same order directory after approval. For a decline, stop. If a payment attempt timed out or returned an uncertain result, check that order in Coronium before retrying. A grant or continuation should never be pasted into support chat.

## Confirm delivery before reporting success

HTTP 200 with `Payment-Receipt` confirms capture. `awaiting_fulfillment` means delivery is still pending. Keep the original `payment_id`, and poll its `status_url` on `https://api.coronium.io` with the same account key and the indicated retry delay. Confirm delivery and the purchased line on the buyer account. On HTTP 202, a timeout or a payment-attempt 402, inspect the existing order before retrying. Preserve the original key and grant. Never place a second purchase to test whether the first one succeeded.

[Coronium quote-only code example](https://www.coronium.io/blog/buy-a-mobile-proxy-with-stripe-mpp) · [Link payment guide](https://docs.link.com/guides/machine-payments) · [Coronium buyer API schema](https://api.coronium.io/openapi.json)
