Pergerakan uang, pada ketinggian sebuah panggilan REST.
Lima panggilan membawa Anda dari ujung ke ujung: buat pengguna, isi dompet, cek saldo, kirim uang, baca riwayat. Sepuluh menit dengan kunci sandbox. Kunci sandbox tidak menggerakkan uang sungguhan.
SDK Go atau HTTP biasa
Gunakan SDK Go yang sudah dirilis, buat klien bertipe dari kontrak OpenAPI, atau panggil API dari pustaka HTTP apa pun. Tanpa runtime khusus.
Idempoten secara bawaan
Setiap panggilan penggerak uang mengambil sebuah kunci idempoten. Percobaan ulang aman; ledger memutar ulang hasil tersimpan byte demi byte.
Peristiwa yang bisa Anda percaya
Webhook bertanda tangan HMAC-SHA256 dengan jendela replay, dikirim paling sedikit sekali dengan id dedupe, pada pool worker yang terisolasi dari jalur uang.
Kredensial bercakupan
Kunci API tenant untuk server-ke-server, token pengguna bertanda tangan berumur pendek untuk panggilan klien, token staf untuk operasi, diverifikasi pada setiap permintaan.
Isi sebuah dompet, lalu kirim uang
Transfer antar pengguna sandbox dengan saldo
Prasyarat: dua pengguna pada tenant yang sama, dana uji terkonfirmasi dan kunci transfers:write. Gunakan kunci dan isi yang sama saat mencoba lagi.
# Existing sandbox users; sender funding must already be confirmed.
# Save this JSON with the business operation. Retry with the same key and body.
curl --fail-with-body -sS -X POST "$WALLETD_API/v1/transfers" \
-H "Authorization: Bearer $WALLETD_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $TRANSFER_KEY" \
-d '{"from_user":"0191c2d5-2b18-7e63-8f4a-05c7b9d1e832","to_user":"0191c2d4-8f3a-7c51-9b2e-4a6f8d310e27","amount":2500}'package main
import (
"context"
"fmt"
"log"
"os"
"github.com/google/uuid"
"github.com/walletd-io/walletd-go"
)
// Prerequisites: two existing sandbox users in the same tenant, a funded sender,
// and a key with transfers:write. Complete processor confirmation before this call.
func main() {
client, err := walletd.New(os.Getenv("WALLETD_API"), walletd.APIKey(os.Getenv("WALLETD_API_KEY")))
if err != nil {
log.Fatal(err)
}
from, err := uuid.Parse(os.Getenv("FROM_USER_ID"))
if err != nil {
log.Fatal(err)
}
to, err := uuid.Parse(os.Getenv("TO_USER_ID"))
if err != nil {
log.Fatal(err)
}
// Persist this operation key with the business operation. Reuse it on retries.
key := walletd.IdempotencyKey(os.Getenv("TRANSFER_KEY"))
if key == "" {
log.Fatal("TRANSFER_KEY is required")
}
transfer, err := client.CreateTransfer(context.Background(), key, walletd.CreateTransferRequest{
FromUser: from, ToUser: &to, Amount: 2500, // integer minor units
})
if err != nil {
log.Fatal(err)
}
fmt.Println(transfer.Id, transfer.Status)
}
# Python standard library; existing funded sandbox users.
import json, os, urllib.request
payload = {"from_user":"0191c2d5-2b18-7e63-8f4a-05c7b9d1e832","to_user":"0191c2d4-8f3a-7c51-9b2e-4a6f8d310e27","amount":2500}
request = urllib.request.Request(os.environ['WALLETD_API'] + '/v1/transfers',
data=json.dumps(payload).encode(), method='POST', headers={
'Authorization': 'Bearer ' + os.environ['WALLETD_API_KEY'],
'Content-Type': 'application/json',
'Idempotency-Key': os.environ['TRANSFER_KEY'],
})
with urllib.request.urlopen(request, timeout=30) as response:
print(json.load(response))// Node.js HTTP; never put a tenant API key in a browser.
const response = await fetch(process.env.WALLETD_API + '/v1/transfers', {
method: 'POST', redirect: 'error', signal: AbortSignal.timeout(30000),
headers: {
Authorization: 'Bearer ' + process.env.WALLETD_API_KEY,
'Content-Type': 'application/json',
'Idempotency-Key': process.env.TRANSFER_KEY,
},
body: JSON.stringify({"from_user":"0191c2d5-2b18-7e63-8f4a-05c7b9d1e832","to_user":"0191c2d4-8f3a-7c51-9b2e-4a6f8d310e27","amount":2500}),
});
if (!response.ok) throw new Error('Transfer HTTP ' + response.status);
console.log(await response.json());<?php
// PHP cURL; existing funded sandbox users.
$ch = curl_init(getenv('WALLETD_API') . '/v1/transfers');
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30, CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('WALLETD_API_KEY'),
'Content-Type: application/json', 'Idempotency-Key: ' . getenv('TRANSFER_KEY')],
CURLOPT_POSTFIELDS => '{"from_user":"0191c2d5-2b18-7e63-8f4a-05c7b9d1e832","to_user":"0191c2d4-8f3a-7c51-9b2e-4a6f8d310e27","amount":2500}',
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($body === false || $status < 200 || $status >= 300) {
throw new RuntimeException('Transfer request failed');
}
echo $body;// Java 17+ HTTP; existing funded sandbox users.
import java.net.URI;
import java.net.http.*;
import java.time.Duration;
class TransferExample {
public static void main(String[] args) throws Exception {
var client = HttpClient.newBuilder().followRedirects(HttpClient.Redirect.NEVER).build();
var request = HttpRequest.newBuilder(URI.create(System.getenv("WALLETD_API") + "/v1/transfers"))
.timeout(Duration.ofSeconds(30))
.header("Authorization", "Bearer " + System.getenv("WALLETD_API_KEY"))
.header("Content-Type", "application/json")
.header("Idempotency-Key", System.getenv("TRANSFER_KEY"))
.POST(HttpRequest.BodyPublishers.ofString("""
{"from_user":"0191c2d5-2b18-7e63-8f4a-05c7b9d1e832","to_user":"0191c2d4-8f3a-7c51-9b2e-4a6f8d310e27","amount":2500}
""")).build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() < 200 || response.statusCode() >= 300) throw new Exception("Transfer failed");
System.out.println(response.body());
}
}Webhook
Verifikasi dalam beberapa baris.
Setiap peristiwa bertanda tangan. Tolak apa pun yang tidak terverifikasi dalam waktu konstan, dan dedupe pada id peristiwa. Menerima peristiwa yang sama dua kali adalah hal yang diharapkan dan aman.
Semua tipe peristiwa// Pseudocode: use the verified webhook receiver in the documentation.
// Verify timestamp freshness and HMAC over timestamp + "." + raw request bytes.
// Use constant-time comparison. Reject before accepting any event identity.
// Deduplicate using the event id inside the VERIFIED body, not an unsigned header.
// Persist to an inbox before returning success; process asynchronously.
// See https://docs.walletd.io/webhooks for executable receivers.Harga tetap, tanpa biaya per transaksi
Dapatkan kunci sandbox.
Setiap evaluasi mendapat tenant sandbox, kontrak OpenAPI, SDK Go, dan jalur langsung ke insinyur yang membangunnya. Produksi berharga bulanan tetap tanpa biaya per transaksi.