Appearance
Install & initialise the backend SDK
Install the SDK for your server's language, then initialise one client when your application starts. The rest of the integration uses this client to call Maytes.
Keep client_id and client_secret on your server. Get them from the merchant portal after completing Onboarding.
1. Install the SDK
One language, whole site
Pick your language in any code block below and every example on every page switches to it, including next time you visit.
bash
npm install @maytes/api-client-js
# or: pnpm add @maytes/api-client-js · yarn add @maytes/api-client-jsbash
pip install maytes-api-client-pybash
composer require maytes/api-client-phpbash
go get github.com/kttipay/maytes-api-client-gobash
# Not on Maven Central yet. Build from source:
git clone https://github.com/kttipay/maytes-api-client-java
cd maytes-api-client-java && mvn installbash
gem install maytes-api-client-rb
# or in a Gemfile: gem 'maytes-api-client-rb'bash
dotnet add package maytes-api-client-net2. Initialise the SDK
Construct the client once at startup, not once per request. Recreating it discards the cached access token and mints a new token for every call.
ts
import { createMaytesApiClient } from '@maytes/api-client-js';
export const maytes = createMaytesApiClient({
endpoint: 'https://api.maytes.co',
clientId: process.env.MAYTES_CLIENT_ID!,
clientSecret: process.env.MAYTES_CLIENT_SECRET!,
});python
from maytes_api_client import create_maytes_api_client
maytes = create_maytes_api_client(
"https://api.maytes.co",
client_id=os.environ["MAYTES_CLIENT_ID"],
client_secret=os.environ["MAYTES_CLIENT_SECRET"],
)php
use MaytesApiClient\ClientFactory;
$maytes = ClientFactory::create(
'https://api.maytes.co',
getenv('MAYTES_CLIENT_ID'),
getenv('MAYTES_CLIENT_SECRET'),
);go
import maytes "github.com/maytes/api-client-go"
api := maytes.CreateMaytesAPIClient(
"https://api.maytes.co",
os.Getenv("MAYTES_CLIENT_ID"),
os.Getenv("MAYTES_CLIENT_SECRET"),
)java
import co.maytes.api.DefaultApi;
import co.maytes.api.auth.ClientFactory;
DefaultApi maytes = ClientFactory.create(
"https://api.maytes.co",
System.getenv("MAYTES_CLIENT_ID"),
System.getenv("MAYTES_CLIENT_SECRET"));ruby
require 'maytes_api_client'
MAYTES = MaytesApiClient.create_maytes_api_client(
endpoint: 'https://api.maytes.co',
client_id: ENV['MAYTES_CLIENT_ID'],
client_secret: ENV['MAYTES_CLIENT_SECRET'],
)csharp
using MaytesApiClient.Auth;
var maytes = ClientFactory.Create(
"https://api.maytes.co",
Environment.GetEnvironmentVariable("MAYTES_CLIENT_ID"),
Environment.GetEnvironmentVariable("MAYTES_CLIENT_SECRET"));In production, use https://api.maytes.co. During development, use the sandbox endpoint and sandbox credentials.
The client handles OAuth token creation, caching, and refresh. Later guides assume it is available as maytes, as shown above.
Two things that are true everywhere
Amounts use integer minor units. 4500 means AUD 45.00. Never send decimals in any monetary field.
Capture moves money; authorization does not. Payment places a hold on the customer's funds. Your capture call takes the funds. Until capture, nothing is settled, and the authorization is auto-voided after 2 minutes.
Prefer raw HTTP?
Every operation is a JSON endpoint documented in the API reference, including schemas, examples, and error codes. With raw HTTP:
- You must mint and refresh tokens yourself. See Authentication.
- You should still verify webhooks with the SDK. Verification needs no credentials and makes no network call, so it can run alongside your HTTP client.
Next
Use the client to create a checkout.

