Skip to content

SDK & Librairies clients

Voici les bibliothèques que vous pouvez utiliser pour intégrer HayBTech. La plupart des équipes backend utilisent le SDK de leur langage — c'est la méthode la plus rapide.


Quel SDK utiliser ?

Mon profilMa recommandation
Je débuteCommencez par le Guide de Démarrage Rapide avant de toucher aux SDK.
J'utilise un CMSRegardez d'abord les plugins dans la section CMS & E-commerce.
Je suis développeur backendChoisissez votre langage dans la section Backend.
Je construis une app mobileRegardez la section Mobile & Frontend.

Backend

Les SDK suivants sont stables et utilisés en production par des marchands actifs.

LangagePackageVersion
PHP / Laravelhaybtech/php-sdk1.0.1
Node.js@haybtech/sdk1.0.0
Python / Djangohaybtech-sdk1.0.0
Java / Spring Bootsn.haybtech:haybtech-sdk1.0.0
Rubyhaybtech-sdk1.0.0
Gogithub.com/haybtech/haybtech-go-sdk1.0.0
.NET / C#HayBTech.Sdk1.0.0

Mobile & Frontend

PlateformePackageVersion
HayBTech.js (Navigateur)@haybtech/browser1.0.0
React Native@haybtech/react-native1.0.0
Flutterhaybtech_flutter_sdk1.0.0

En cours de développement — pas encore recommandés pour la production :

PlateformeNote
iOS (Swift)Distribution via SPM, API stable mais coverage de tests insuffisant
Android (Kotlin)Beta publique, feedback bienvenu
UnityTrès early stage

Plugins CMS & E-commerce

CMS / PlateformePluginVersion
WordPress / WooCommerceWooCommerce Gateway1.1.0
DrupalCommerce HayBTech1.0.0
OdooPayment Provider1.0.0

En développement :

CMS / PlateformeStatut
Magento 2Bêta privée — contactez le support pour accès anticipé
PrestaShopEn cours, pas de date confirmée
WHMCSPlanifié

Exemples par framework

EnvironnementFrameworks couverts
PHPLaravel, Symfony, PHP natif
Node.jsExpress, NestJS, Fastify
PythonFastAPI, Django, Flask
JavaSpring Boot, Jakarta EE
RubyRails, Sinatra
GoGin, Echo, net/http
.NETASP.NET Core, Minimal APIs

Conventions communes

Tous nos SDK exposent une surface similaire, quel que soit le langage :

client.payments.create(...)
client.payments.retrieve(id)
client.payments.list({ status: 'success' })
client.payments.verify(id)
client.payments.splits.create(id, [...])

client.webhooks.constructEvent(rawBody, signatureHeader)

Réutiliser le client HTTP

Instanciez le client une seule fois au démarrage de l'application. Créer un client par requête gaspille les connexions et ralentit les temps de réponse.

ts
// Bon
const client = new HayBTech({ apiKey: process.env.HAYBTECH_API_KEY! })

function pay() {
  return client.payments.create({ ... })
}

Retry avec backoff

ts
async function withRetry<T>(fn: () => Promise<T>, max = 3): Promise<T> {
  let attempt = 0
  while (true) {
    try {
      return await fn()
    } catch (e: any) {
      if (e.status >= 500 && attempt < max) {
        const wait = 2 ** attempt * 1000   // 1s, 2s, 4s
        await new Promise(r => setTimeout(r, wait))
        attempt++
        continue
      }
      throw e
    }
  }
}

Sur les 5xx, retentez toujours avec la même Idempotency-Key. Sur les 4xx, corrigez la requête d'abord.


Génération de client à partir de l'OpenAPI

La spécification OpenAPI est disponible sur demande auprès du support.

bash
# Types TypeScript uniquement
npx openapi-typescript ./openapi.yaml -o src/haybtech.types.ts

# Client TypeScript complet
npx @hey-api/openapi-ts -i ./openapi.yaml -o ./src/haybtech-client

# Python
openapi-generator-cli generate -i ./openapi.yaml -g python -o ./haybtech-py

# Go
oapi-codegen -package haybtech ./openapi.yaml > haybtech.gen.go

Votre langage n'est pas listé ? Écrivez à support@haybtech.com. Les SDK sont priorisés en fonction des demandes reçues.

Documentation de l'API de paiement HayBTech.