Skip to content

REST API quickstart

This guide covers server-side REST API integration. For the embedded mobile experience, use the SDK quickstart.

Call Zwipe from your backend. Your website or mobile app calls your backend using its normal customer login. Zwipe credentials identify your business, not an individual customer.

Use https://sandbox.api.zwipe.co with sandbox credentials during integration. Production uses https://api.zwipe.co and your production credentials. See test environments.

Ask your Zwipe contact for credentials, permitted restaurants, and the scopes cards:issue, cards:balance, and cardholders:verify. Multi-restaurant partners need the assigned brand_id / restaurant_id pairs. venues:register is a separate permission.

The commands use a POSIX shell, curl, and jq. All customer and restaurant values are examples. Supply ZWIPE_CLIENT_ID and ZWIPE_CLIENT_SECRET through your server’s environment or secret manager.

Terminal window
# Use your production base URL and credentials when the integration is ready for launch.
export ZWIPE_BASE_URL='https://sandbox.api.zwipe.co'
export CARDHOLDER_EMAIL='jane@example.com'
Terminal window
TOKEN=$(jq -n \
--arg id "$ZWIPE_CLIENT_ID" --arg secret "$ZWIPE_CLIENT_SECRET" \
'{client_id: $id, client_secret: $secret}' |
curl --fail-with-body --silent --show-error \
"$ZWIPE_BASE_URL/v1/auth/token" \
-H 'Content-Type: application/json' --data-binary @- |
jq -er '.access_token')

The response contains access_token, token_type: "Bearer", expires_in: 3600, and a space-separated scope. Cache the token on your server. See authentication for renewal and permissions.

Terminal window
jq -n --arg email "$CARDHOLDER_EMAIL" '{email: $email}' |
curl --fail-with-body --silent --show-error \
"$ZWIPE_BASE_URL/v1/cardholders/email/check" \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' --data-binary @-

If registered is true, the issuer already knows this cardholder. Otherwise check /v1/cardholders/email/verification/status; if verified is false, send and confirm a code. Follow the complete email flow. sent: true does not mean verified.

Persist your order, customer, amount, restaurant, and reference before calling Zwipe. Here 2500 is $25.00 and order-1001 is the reference to reuse after a lost response. Verify payment/funding according to your agreed program before submitting.

Terminal window
curl --fail-with-body --silent --show-error \
"$ZWIPE_BASE_URL/v1/cards" \
-H "Authorization: Bearer $TOKEN" \
-H 'Content-Type: application/json' \
--data '{
"first_name": "Jane",
"last_name": "Doe",
"email": "jane@example.com",
"phone": "+15551234567",
"amount_cents": 2500,
"currency": "USD",
"external_ref": "order-1001",
"venue": {"brand_id": 123, "restaurant_id": 456}
}'

Replace the restaurant IDs with the ones assigned to your integration. Omit venue only when your account has a configured home restaurant.

An initial 202 Accepted response looks like this:

{
"card_id": "0192f7a4-5c2e-7d3b-9a1f-4e8b2c6d0a11",
"status": "pending",
"error_code": null,
"balance_cents": 0,
"currency": "USD",
"external_ref": "order-1001",
"created_at": "2026-10-15T12:00:00Z",
"venue": {"brand_id": 123, "restaurant_id": 456},
"issuer": {"card_id": null, "order_id": null, "wallet_url": null, "collect_url": null}
}

Save the top-level card_id with your order. 202 means processing was accepted; it does not confirm usable funds.

Terminal window
export CARD_ID='0192f7a4-5c2e-7d3b-9a1f-4e8b2c6d0a11'
curl --fail-with-body --silent --show-error \
"$ZWIPE_BASE_URL/v1/cards/$CARD_ID" \
-H "Authorization: Bearer $TOKEN"

Poll about every two seconds while the card is pending, with a bounded foreground wait. Preserve its ID when the screen closes.

Status Next action
pending Show “Preparing your card”; resume checking later if your UI wait ends.
issued Read its balance and display your card screen.
failed Inspect error_code and resolve the cause before explicitly retrying the same order.
in_doubt Show “We’re confirming your card”; follow recovery.
Terminal window
curl --fail-with-body --silent --show-error \
"$ZWIPE_BASE_URL/v1/cards/$CARD_ID/balance" \
-H "Authorization: Bearer $TOKEN"
{
"card_id": "0192f7a4-5c2e-7d3b-9a1f-4e8b2c6d0a11",
"balance_cents": 2500,
"currency": "USD",
"as_of": "2026-10-15T12:00:08Z"
}

Keep integer cents in calculations and format dollars only for display. Show an “Updated …” timestamp from as_of; the result can be cached for 60 seconds.

If the card includes issuer.wallet_url, follow the Apple Wallet handoff. This nullable, time-limited link is not a permanent card-details URL.