Skip to content
API documentation
View as MarkdownOpen in Claude

Applications

Pay one application from your wallet

POST
/v1/{organizationId}/application/{applicationId}/wallet-pay

Pays the pending payment of one application of one of your students from your wallet: one credit of this organization, the payment marked paid, and an entry in your wallet history (listWalletEntries). No body.

A free exam takes no credit, and an application this wallet already paid answers 200 with charged: false, so a retry is safe. A payment settled another way is 409 already_paid; a canceled one 409 payment_canceled; a card payment the student still has open 409 payment_in_progress. On coding the price is the bundle price when the student has already paid a bundle exam.

Needs an enabled wallet, which Main Team opens only after an agreement and on your request (otherwise 403 wallet_not_enabled), and the application/pay permission on this organization. To pay several at once use payApplicationsFromWallet.

Parameters

Path parameters

NameTypeDescription
organizationIdrequiredstringpattern ^[0-9a-f]{24}$

The organization’s _id: 24 hexadecimal digits, as listOrganizations (GET /v1/organization) lists it.

Example 64b7f0c2a1d3e4f5a6b7c8d9

applicationIdrequiredstring

The application’s _id, from createApplication or one of the application lists.

Responses

200 OK

Success: message is "Application paid from wallet.".

Or message is "Nothing was taken from the wallet.": The exam is free, or this wallet already paid it.

Body

  • successbooleanrequired

    Always true on a success.

    one oftrue

  • messagestringrequired

    exampleApplication paid from wallet.

  • dataobject · PayApplicationResponserequired

    The answer of payApplicationFromWallet.

    9 fields of data
    • applicationIdstringrequired

      The application that was paid.

      example6650a1b2c3d4e5f6a7b8c9e5

    • paymentIdstringrequired

      Its payment.

      example6650a1b2c3d4e5f6a7b8c9e6

    • chargedbooleanrequired

      true when a credit was taken by this call. false when there was nothing to take: see reason.

      exampletrue

    • reasonstring

      Why nothing was taken, only when charged is false. free: the exam costs nothing, and a free exam never uses a credit. already_paid: this wallet already paid it, in an earlier call; reference and entryId are that payment’s.

      one offreealready_paid

      examplefree

    • amountnumberrequired

      The amount the payment was settled at, in cents: the exam’s price, or the coding bundle price when it is lower. 0 for a free exam.

      example5000

    • currencystringrequired

      The currency of amount: USD for neo, EUR otherwise.

      one ofEURUSD

      exampleEUR

    • referencestring

      The transaction code of the payment (stx-...), the same reference the application reads show on a settled payment.

      examplestx-19a2c3d4e5f6a7b8c9

    • entryIdstring

      The _id of the wallet entry (listWalletEntries).

      example6650a1b2c3d4e5f6a7b8c9f2

    • walletobject · WalletBalanceViewResponserequired

      The organization’s balance after the call.

      4 fields of wallet
      • organizationstringrequired

        The organization’s slug.

        examplestem

      • grantednumberrequired

        Credits granted to you in total.

        example50

      • spentnumberrequired

        Credits spent in total.

        example9

      • remainingnumberrequired

        granted minus spent.

        example41

Headers

X-RateLimit-Limit integer

Requests your account may make to this operation per window (100).

X-RateLimit-Remaining integer

Requests left in the current window.

X-RateLimit-Reset integer

Seconds until the current window ends.

Example

{
  "data": {
    "amount": 5000,
    "applicationId": "6650a1b2c3d4e5f6a7b8c9e5",
    "charged": true,
    "currency": "EUR",
    "entryId": "6650a1b2c3d4e5f6a7b8c9f2",
    "paymentId": "6650a1b2c3d4e5f6a7b8c9e6",
    "reason": "free",
    "reference": "stx-19a2c3d4e5f6a7b8c9",
    "wallet": {
      "granted": 50,
      "organization": "stem",
      "remaining": 41,
      "spent": 9
    }
  },
  "message": "Nothing was taken from the wallet.",
  "success": true
}

Example request

# $TOKEN: a short-lived token you minted with your API key and secret
curl -sS -X POST 'https://api.main-team.org/v1/<organizationId>/application/<applicationId>/wallet-pay' \
  -H "Authorization: Bearer $TOKEN"

Search the API documentation

Guides, endpoints by name, path or permission, and error codes such as not_found.