snap-aspi-go
Go SDK for Indonesia's SNAP payment APIs (ASPI), covering virtual accounts, QR MPM, transfers, and direct debit, with a dedicated BCA client.
- Year
- 2025
- Built with
- Go, SNAP, Payments
- Links
SNAP (Standar Nasional Open API Pembayaran) is Bank Indonesia’s standard for open payment APIs, administered by ASPI. Banks implement the same families of endpoints, often with bank-specific extensions on top. snap-aspi-go wraps them in a clean, type-safe Go interface.
Coverage
The core client covers virtual accounts, QR MPM, registration, balance inquiry, transaction history, transfer credit, and transfer debit.
The BCA client goes further:
- Authentication: B2B and B2B2C access tokens.
- Virtual accounts: create, update, delete, inquiry, payment, status, and reports.
- QR MPM: generate, decode, pay, query, cancel, refund, and notify.
- Transfers: intrabank, interbank, RTGS, and SKNBI, plus transfer status.
- Direct debit: payment, status, cancel, refund, and CPM QR.
- Auth payment: authorize, capture, and void.
- Account & history: balance and account inquiry, transaction history, and bank statements.
- BCA-specific: account binding, card registration, OTP, and bulk transfer.
Usage
client, err := snap.NewClient(snap.Config{
BaseURL: "https://sandbox.aspi-indonesia.or.id",
ClientID: "your-client-id",
ClientSecret: "your-client-secret",
PrivateKeyPath: "path/to/private_key.pem",
PublicKeyPath: "path/to/public_key.pem",
Environment: "sandbox",
})
if err != nil {
log.Fatal(err)
}
va, err := client.VirtualAccount().CreateVA(ctx, &types.CreateVAPayload{
PartnerServiceId: "12345",
CustomerNo: "CUST001",
VirtualAccountNo: "8808001234567890",
VirtualAccountName: "John Doe",
TotalAmount: types.NewAmount(100000, "IDR"),
})