Premip

Top up your wallet from code

Check your balance, create a crypto top-up, wait for the network to confirm it and read the transaction history.

8 min readGET /billing/walletPOST /billing/wallet/creditGET /billing/payment-intents/{id}GET /billing/wallet/transactions
On this page

Before you start

  • An API key. See the quickstart.
  • A crypto wallet or exchange account to send the payment from. Payments are crypto only.

1. Read the current balance

The balance is in US dollars and updates when a top-up is confirmed or an order is paid.

curl https://api.premip.com/billing/wallet \
  -H "X-Api-Key: $PREMIP_API_KEY"

2. Create the top-up

Send the amount in USD, from 10 to 10000. The response is a payment intent. Open checkoutUrl in a browser, or give it to whoever pays. It lists the coin, network and exact amount to send.

curl -X POST https://api.premip.com/billing/wallet/credit \
  -H "X-Api-Key: $PREMIP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 50}'

Example output

{ "id": "clx9pay0b0007", "status": "pending", "amountDisplay": "$50.00", "checkoutUrl": "https://nowpayments.io/payment/?iid=…", "expiresAt": "2026-11-04T10:42:11.000Z" }

3. Wait for confirmation

Poll the intent with ?sync=1 every 30 to 60 seconds. Status runs pending, detected, confirming, confirmed. Stop on confirmed, expired or failed. underpaid and overpaid need a review by support, so stop polling and contact us with the intent id.

curl "https://api.premip.com/billing/payment-intents/INTENT_ID?sync=1" \
  -H "X-Api-Key: $PREMIP_API_KEY"

4. Confirm in the transaction history

After confirmation the deposit appears in the wallet transactions and the balance goes up by the amount.

curl https://api.premip.com/billing/wallet/transactions \
  -H "X-Api-Key: $PREMIP_API_KEY"

Example output

2026-11-04T09:51:03.000Z deposit 50 Wallet top-up

Complete script

Creates a top-up for the amount you pass (default 50 USD), prints the payment link, polls for up to 90 minutes and prints the balance before and after.

#!/usr/bin/env bash
# Needs curl, jq and awk. Run: PREMIP_API_KEY=premip_... bash script.sh
set -euo pipefail
API=https://api.premip.com
H="X-Api-Key: $PREMIP_API_KEY"

amount=${1:-50}
before=$(curl -fsS $API/billing/wallet -H "$H" | jq .balance)

intent=$(curl -fsS -X POST $API/billing/wallet/credit -H "$H" -H "Content-Type: application/json" -d "{\"amount\": $amount}")
id=$(echo "$intent" | jq -r .id)
echo "Pay $(echo "$intent" | jq -r .amountDisplay) in crypto at: $(echo "$intent" | jq -r '.checkoutUrl // .address')"

for i in $(seq 1 180); do
  sleep 30
  intent=$(curl -fsS "$API/billing/payment-intents/$id?sync=1" -H "$H")
  status=$(echo "$intent" | jq -r .status)
  echo "status: $status"
  case "$status" in
    confirmed) break ;;
    expired|failed) echo "Payment $status. Create a new top-up."; exit 1 ;;
  esac
done

after=$(curl -fsS $API/billing/wallet -H "$H" | jq .balance)
echo "Balance: $before -> $after USD"

Troubleshooting

ProblemWhat to do
400 BAD_REQUESTThe amount must be a number between 10 and 10000 USD. The message names the field.
429 RATE_LIMITED when creating a top-upYou created more than 10 top-ups in 10 minutes. Reuse the open payment link, or wait a few minutes.
Status stays pending after you paidThe network needs the required confirmations first. Poll with ?sync=1 or call POST /billing/payment-intents/{id}/refresh (together limited to 30 per 10 minutes). Check the payment events for the transaction hash.
Status is underpaid or overpaidThe amount received differs from the amount requested. Contact support with the intent id and the transaction hash.
Status is expiredPayment links expire (see expiresAt). Create a new top-up. A payment sent after expiry is reviewed by support.

Keep going

All guides

Wallet top-up guide — Premip