Skip to content

API Reference

Sign Up
Login
Charge
POST /api/app/:YOUR_CLIENT_ID/charge

IMPORTANT: Only proceed with your service when you get a 200 response code from the charge endpoint. Otherwise you may not be able to charge the user.

Parameters

type Description Example
path Your application's client ID
123e4567-e89b-12d3-a456-426614174000
body Information used to charge the user
{
"message": "{\"userInput\": \"hi\", \"userOutput\": \"How can I help?\"}",
"userId": "123e4567-e89b-12d3-a456-426614174000",
"chargeCents": 100,
"currency": "USD"
}

Body Fields

field type required example
message string no
"{\"userInput\": \"hi\", \"userOutput\": \"How can I help?\"}"
userId string yes 123e4567-e89b-12d3-a456-426614174000
chargeCents number no 100
currency string no (default to 'USD') USD

* Note: "message" and "chargeCents" cannot both be empty

Responses

Status Code Body Description Example What to do
200 appMessageId: the id tracking the message sent to Pavillion
{"appMessageId": "123e4567-e89b-12d3-a456-426614174000"}
Save the appMessageId in your database for reference later, or disregard it
400 message: Invalid request
{"message":"Invalid request"}
Check the request parameters
402 message: Insufficient funds
appMessageId: the id tracking the message sent to Pavillion
chargeId: the id tracking the charge
{
"message":"Insufficient funds",
"appMessageId": "123e4567-e89b-12d3-a456-426614174000",
"chargeId": "123e4567-e89b-12d3-a456-426614174000"
}
Save the appMessageId and chargeId in your database for reference later. Ask users to recharge their account before resuming service.
404 message: User {id} does not have an account in {currency}
{"message":"User 123e4567-e89b-12d3-a456-426614174000
does not have an account in USD"}
Redirect user to Pavillion to create a new account in the currency required
500 message: Unknown API Error
{"message": "Unknown API Error"}
Try again later. If issue persist, contact Pavillion