Pepvote Support Center

Checkout Public Quadratic Credits

POST
/public/voting-events/{idOrCode}/quadratic-credits/checkout

Two calls. First call sends the purchase and gets 402 with a checkout. Second call sends only paymentAttemptId after the payer returns and gets the fulfilled balance.

Authorization

bearerAuth
AuthorizationBearer <token>

A key in the form pepvote_api_ followed by 32 hexadecimal characters.

In: header

Header Parameters

Idempotency-Keystring

Optional retry key. First successful response is stored for 24 hours.

  • Length: up to 255 characters
User-Agentstringrequired

Name and version of the calling integration. Required on every request.

Path Parameters

idOrCodestringrequired

Voting event ID or code.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

paymentAttemptIdstring

Second call only. The attempt returned in the 402. When present every other field is ignored.

positionIdstring

A quadratic position. Required on the first call.

visitorIdstring

Required on the first call. vi_ followed by 16 to 128 hex characters.

  • Length: up to 200 characters
  • Pattern: ^vi_[0-9a-fA-F]{16,128}$
creditsinteger

Credits to buy under ratio pricing. Send exactly one of credits or tierId.

  • Minimum value: 1
tierIdstring

Tier to buy under tiered pricing, from quadratic-credits/options. Send exactly one of credits or tierId.

emailstring

Payer email. Required by Paystack checkouts.

  • Length: up to 320 characters
voterIdstring

External voter ID for polls that require one.

  • Length: up to 200 characters
namestring

Payer name.

  • Length: up to 200 characters
returnUrlstring

Absolute http(s) URL the payer lands on after a provider-hosted checkout, with paymentAttemptId appended. Required when payments.provider is stripe.

  • Length: up to 2048 characters
  • Format: uri
cancelUrlstring

Absolute http(s) URL the payer lands on after cancelling the checkout, with paymentAttemptId appended.

  • Length: up to 2048 characters
  • Format: uri

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/public/voting-events/string/quadratic-credits/checkout" \  -H "User-Agent: my-app/1.0" \  -H "Content-Type: application/json" \  -d '{}'
{
  "data": {
    "paymentAttemptId": "string",
    "creditAmount": 0,
    "alreadyFulfilled": true,
    "balance": {
      "_id": "string",
      "_creationTime": 0,
      "votingEventId": "string",
      "positionId": "string",
      "voterKey": "string",
      "baseCreditsGranted": 0,
      "purchasedCredits": 0,
      "reservedPurchasedCredits": 0,
      "reservedPurchaseCount": 0,
      "topUpCount": 0,
      "spentCredits": 0,
      "expiredCredits": 0,
      "availableCredits": 0,
      "finalizedAt": 0,
      "updatedAt": 0
    }
  }
}
{
  "data": {
    "paymentRequired": true,
    "paymentAttemptId": "string",
    "amount": 0,
    "currency": "string",
    "provider": "stripe",
    "stripe": {
      "checkoutUrl": "http://example.com",
      "checkoutSessionId": "string"
    },
    "next": "string",
    "credits": 0,
    "pricingModel": "ratio"
  }
}
{
  "error": {
    "code": "bad_request",
    "message": "string",
    "details": {
      "field": "string",
      "parameter": "string",
      "limit": 0,
      "retryAfterSeconds": 0,
      "feature": "string",
      "plan": "string"
    }
  }
}
Was this helpful?

Last updated September 6, 2026