Quickstart
Integrating your own store?
Skip the "Create the app" and "Install and authorize" steps: generate the merchant credentials on the panel's API screen and start at "Authenticate with the API". The app steps are for those building an app installed by many merchants.
Before you start
Before following this guide, make sure you have:
- Access to the Appmax App Store if you are building an app; for your own store, access to the Appmax panel
- An endpoint to receive webhooks: the Appstore ones, for an app, or the panel ones, for your own store
Flow overview
The complete integration flow with the Appmax API follows these steps:
Create your app (public or private) in the Appmax App Store. You will receive an app_id, client_id, and client_secret for the application.
See more at Create app.
Obtain the app token, generate the authorization hash, and redirect the merchant to authorize the installation. After authorization, generate the merchant credentials.
See more at App installation.
With the merchant credentials, obtain a Bearer token to make API calls.
curl --location 'https://auth.appmax.com.br/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=MERCHANT_CLIENT_ID' \
--data-urlencode 'client_secret=MERCHANT_CLIENT_SECRET'Expected response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...",
"token_type": "Bearer",
"expires_in": 3600
}Register the buyer's details to obtain the customer_id. The ip field must be collected via Appmax JS.
curl --request POST \
--url https://api.appmax.com.br/v1/customers \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"first_name": "Junior",
"last_name": "Almeida",
"email": "[email protected]",
"phone": "51983655100",
"ip": "127.0.0.1"
}'Expected response — save the returned id (this will be the customer_id in subsequent calls):
{
"data": {
"customer": {
"id": 1
}
}
}See more at Create or update customer.
With the customer_id, create the order to obtain the order_id.
curl --request POST \
--url https://api.appmax.com.br/v1/orders \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'Content-Type: application/json' \
--data '{
"customer_id": 1,
"products": [
{
"sku": "9000010",
"name": "Recipe book",
"quantity": 1,
"unit_value": 12300,
"type": "digital"
}
]
}'Expected response — save the returned id (this will be the order_id for the payment):
{
"data": {
"order": {
"id": 1,
"status": "pendente"
}
}
}See more at Create an order.
Process the payment using one of the available methods: credit card, Pix, boleto, Apple Pay, or Google Pay.
See more at Credit card payment, Pix, Boleto, Apple Pay, or Google Pay.