Reference
Every resource the Go SDK exposes, every method, every signature. Resources are fields on *plugipay.Client; method names are PascalCase. For request and response field details (what Limit does, what successUrl accepts), follow the per-resource link to the API reference — the SDK is a thin typed shell over the same surface.
c, _ := plugipay.NewClient(plugipay.ClientOptions{})
// c.Customers, c.CheckoutSessions, c.Invoices, ... — all populated.
All methods take context.Context as the first argument. All return (value, error) or error. Failures land as *plugipay.Error — see Errors.
Client
func NewClient(opts ClientOptions) (*Client, error)
func (c *Client) ForMerchant(accountID string) *Client
func (c *Client) KeyID() string
func (c *Client) BaseURL() string
func (c *Client) OnBehalfOf() string
// Low-level escape hatches (rare):
func (c *Client) Do(ctx context.Context, opts RequestOptions, out any) error
func DoList[T any](ctx context.Context, c *Client, opts RequestOptions) (Page[T], error)
ForMerchant(accountID) returns a shallow clone scoped to a different on-behalf-of account; the underlying *http.Client is shared. See Authentication.
c.Customers — /docs/api/resources/customers
Create(ctx, CustomerCreateInput) (*Customer, error)
Get(ctx, id string) (*Customer, error)
List(ctx, CustomerListParams) (Page[Customer], error)
Update(ctx, id string, CustomerUpdateInput) (*Customer, error)
Create— create a customer. Auto-keyed for idempotency.Get— fetch by id (cus_…).List— cursor-paginated. Filter byEmail.Update— partial update viaPATCH.
c.Plans — /docs/api/resources/plans
Create(ctx, PlanCreateInput) (*Plan, error)
Get(ctx, id string) (*Plan, error)
List(ctx, PlanListParams) (Page[Plan], error)
Update(ctx, id string, PlanUpdateInput) (*Plan, error)
Archive(ctx, id string) (*Plan, error)
Archive— soft-deactivate. Active subscriptions on this plan keep billing; new subscriptions can't be created.
c.CheckoutSessions — /docs/api/resources/checkout-sessions
Create(ctx, CheckoutSessionCreateInput) (*CheckoutSession, error)
Get(ctx, id string) (*CheckoutSession, error)
List(ctx, CheckoutSessionListParams) (Page[CheckoutSession], error)
Cancel(ctx, id string) (*CheckoutSession, error)
Confirm(ctx, id string) (*CheckoutSession, error)
Create— open a hosted checkout. ReturnsHostedURL— redirect the buyer to it.Cancel— void an open session.Confirm— finalize a session in flows where the buyer pays inline (rare; usually the hosted page does this).
c.Invoices — /docs/api/resources/invoices
Create(ctx, InvoiceCreateInput) (*Invoice, error)
Get(ctx, id string) (*Invoice, error)
List(ctx, InvoiceListParams) (Page[Invoice], error)
Finalize(ctx, id string) (*Invoice, error)
Pay(ctx, id string) (*Invoice, error)
Void(ctx, id string) (*Invoice, error)
SendEmail(ctx, id string, to *string) (*InvoiceSendEmailResult, error)
Finalize— move fromdrafttoopenand assign an immutableNumber.Pay— mark an open invoice paid (manual collection).Void— cancel an unpaid invoice; lines preserved for audit.SendEmail— send the invoice to the customer email, or override withto.
c.Subscriptions — /docs/api/resources/subscriptions
Create(ctx, SubscriptionCreateInput) (*Subscription, error)
Get(ctx, id string) (*Subscription, error)
List(ctx, SubscriptionListParams) (Page[Subscription], error)
Cancel(ctx, id string, at string) (*Subscription, error)
Pause(ctx, id string, resumeAt *string) (*Subscription, error)
Resume(ctx, id string) (*Subscription, error)
Cancel— pass"now"(immediate) or"period_end"(default). Empty string →"period_end".Pause— optionalresumeAtISO timestamp; nil → manualResume.
c.PortalSessions — /docs/api/resources/portal-sessions
Create(ctx, PortalSessionCreateInput) (*PortalSession, error)
Generates a short-lived signed URL for the customer-facing self-service portal.
c.Receipts — /docs/api/resources/receipts
List(ctx, ReceiptListParams) (Page[ReceiptSummary], error)
Get(ctx, id string) (json.RawMessage, error)
Getreturnsjson.RawMessage— the full receipt payload is richer thanReceiptSummaryand intentionally opaque to the SDK. Decode into your own shape if you need fields beyond the summary.
c.Refunds — /docs/api/resources/refunds
Create(ctx, RefundCreateInput) (*Refund, error)
Get(ctx, id string) (*Refund, error)
List(ctx, RefundListParams) (Page[Refund], error)
Create— partial refunds viaAmount *int64; omit for a full refund.
c.Payouts — /docs/api/resources/payouts
Create(ctx, PayoutCreateInput) (*Payout, error)
Get(ctx, id string) (*Payout, error)
List(ctx, PayoutListParams) (Page[Payout], error)
Cancel(ctx, id string) (*Payout, error)
MarkInTransit(ctx, id string, reference *string) (*Payout, error)
MarkPaid(ctx, id string, reference *string) (*Payout, error)
MarkFailed(ctx, id string, failureReason string) (*Payout, error)
Balance(ctx) (*AvailableBalance, error)
GetBankAccount(ctx) (*BankAccount, error)
UpdateBankAccount(ctx, BankAccountInput) (*BankAccount, error)
Balance— total / locked / available across the ledger.MarkInTransit/MarkPaid/MarkFailed— transitions for themanualpayout method.
c.Ledger — /docs/api/resources/ledger
List(ctx, LedgerListParams) (Page[LedgerEntry], error)
Balances(ctx) ([]LedgerBalance, error)
Double-entry accounting feed. Every charge, refund, payout, and platform fee posts here.
c.Reports — /docs/api/resources/reports
PnL(ctx, ReportRangeParams) (*PnLReport, error)
CashFlow(ctx, ReportRangeParams) (*CashFlowReport, error)
ReportRangeParams{From, To, Currency *string}— ISO dates.
c.WebhookEndpoints — /docs/api/resources/webhook-endpoints
List(ctx) ([]WebhookEndpoint, error)
Create(ctx, WebhookEndpointCreateInput) (*WebhookEndpoint, error)
Delete(ctx, id string) error
CreatereturnsWebhookEndpoint.Secret— save it. It's only returned on create.
c.Events — /docs/api/resources/events
List(ctx, EventListParams) (Page[EventRecord], error)
Get(ctx, id string) (*EventRecord, error)
The persisted event log Plugipay delivers from. Useful for backfilling missed webhooks.
c.Adapters — /docs/api/resources/adapters
List(ctx) ([]AdapterConfig, error)
UpdateXendit(ctx, config map[string]any) (*AdapterConfig, error)
UpdatePaypal(ctx, config map[string]any) (*AdapterConfig, error)
UpdateMidtrans(ctx, config map[string]any) (*AdapterConfig, error)
UpdateManual(ctx, config map[string]any) (*AdapterConfig, error)
ManagedOnboardingState(ctx) (*ManagedOnboardingState, error)
StartManagedOnboarding(ctx, ManagedOnboardingStartInput) (*ManagedOnboardingState, error)
SimulateManagedOnboarding(ctx, ManagedOnboardingSimulateInput) (*ManagedOnboardingState, error)
- The
Update*methods take provider-specificmap[string]anybecause the shape varies by adapter. See the API page for each provider's keys. SimulateManagedOnboardingis test-mode only; takesResultof"verified"or"failed".
c.ApiKeys — /docs/api/resources/api-keys
List(ctx) ([]ApiKey, error)
Create(ctx, ApiKeyCreateInput) (*ApiKey, error)
Revoke(ctx, id string) error
CreatereturnsApiKey.Secret— only on create. SubsequentListcalls don't echo it.
c.Billing — /docs/api/resources/billing
Merchant billing for Plugipay itself (your subscription to the platform):
ListTiers(ctx) ([]BillingTier, error)
ListPlans(ctx) ([]Plan, error)
RefreshTiers(ctx) (*BillingRefreshResult, error)
c.Onboarding — /docs/api/resources/onboarding
ProvisionManaged(ctx, OnboardingProvisionManagedInput) (*Workspace, error)
For partners (Storlaunch / Fulkruma / Ripllo) provisioning a merchant workspace.
c.CheckoutSettings — /docs/api/resources/checkout-settings
Get(ctx) (*CheckoutSettings, error)
Update(ctx, CheckoutSettingsUpdateInput) (*CheckoutSettings, error)
Brand color, logo, terms/privacy URLs for the hosted checkout page.
c.Templates — /docs/api/resources/templates
List(ctx, TemplateListParams) ([]Template, error)
Get(ctx, id string) (*Template, error)
Create(ctx, TemplateCreateInput) (*Template, error)
Update(ctx, id string, TemplateUpdateInput) (*Template, error)
MakeDefault(ctx, id string) (*Template, error)
Duplicate(ctx, id string, name *string) (*Template, error)
Preview(ctx, TemplatePreviewInput) (*TemplatePreviewResult, error)
Delete(ctx, id string) error
Kindis one ofplugipay.TemplateKindCheckout,TemplateKindReceipt,TemplateKindInvoice.Previewreturns rendered HTML for the template against sample data — no resource is persisted.
c.Uploads — /docs/api/resources/uploads
Image(ctx, UploadImageInput) (*UploadedFile, error)
Base64-encoded image upload (logos, watermarks). Returns a CDN URL.
c.Workspaces — /docs/api/resources/workspaces
Merchant-facing workspace CRUD:
List(ctx) ([]Workspace, error)
Create(ctx, WorkspaceCreateInput) (*Workspace, error)
Update(ctx, id string, WorkspaceUpdateInput) (*Workspace, error)
Delete(ctx, id string) error
c.Account — /docs/api/resources/account
Self-service for the merchant user behind the key:
Get(ctx) (*AccountProfile, error)
Update(ctx, AccountUpdateInput) (*AccountProfile, error)
ListSessions(ctx) ([]BrowserSession, error)
RevokeSession(ctx, id string) error
RevokeAllSessions(ctx) (*AccountRevokeAllResult, error)
ListLinked(ctx) ([]LinkedAccount, error)
Unlink(ctx, provider string) error
ChangeEmail(ctx, AccountEmailChangeInput) (*AccountEmailChangeResult, error)
ChangePassword(ctx, AccountPasswordChangeInput) error
ListMembers(ctx) ([]WorkspaceMember, error)
c.AdminPortal — /docs/api/resources/admin-portal
Plugipay-internal operator surface. Returns json.RawMessage for partner/billing-account objects because the shape evolves faster than the SDK release cadence — decode into your own struct.
Me(ctx) (*AdminPortalIdentity, error)
ListBillingAccounts(ctx) ([]json.RawMessage, error)
UpdateBillingAccount(ctx, accountID string, patch map[string]any) (json.RawMessage, error)
ListPartners(ctx) ([]json.RawMessage, error)
CreatePartner(ctx, in map[string]any) (json.RawMessage, error)
UpdatePartner(ctx, id string, patch map[string]any) (json.RawMessage, error)
DeletePartner(ctx, id string) error
c.Admin — /docs/api/resources/admin
Platform-admin operations (plugipay:platform:admin scope required):
ProvisionWorkspace(ctx, AdminProvisionWorkspaceInput) (*PartnerWorkspace, error)
GetWorkspace(ctx, accountID string) (*PartnerWorkspace, error)
PartnerUsage(ctx, AdminPartnerUsageParams) (*PartnerUsageSummary, error)
PartnerUsagerolls up transactions per partner brand (storlaunch/fulkruma/ripllo) for a date range.
Webhook helpers
func VerifyWebhook(
rawBody []byte,
signatureHeader string,
secret string,
options *VerifyWebhookOptions,
) (*WebhookEvent, error)
func VerifyWebhookSignature(
rawBody []byte,
signatureHeader string,
secret string,
options *VerifyWebhookOptions,
) bool
type VerifyWebhookOptions struct {
ToleranceSeconds int64 // default 300
Now func() time.Time // default time.Now (override for tests)
}
See Webhooks.
Low-level signing
func Sign(secret string, in SignInput) SignResult
func AuthorizationHeader(keyID, signature string) string
type SignInput struct {
Method, Path, Body, IdempotencyKey string
Timestamp int64 // unix seconds; 0 → time.Now().Unix()
}
type SignResult struct {
Signature, Timestamp string
}
Exposed so callers building proxies or custom retry loops can re-derive a signature byte-for-byte. Documented at API authentication.
Types
The shapes returned by every method are exported under the plugipay package:
Customer Plan CheckoutSession Invoice
Subscription PortalSession ReceiptSummary Refund
Payout AvailableBalance BankAccount LedgerEntry
LedgerBalance PnLReport CashFlowReport EventRecord
WebhookEndpoint WebhookEvent AdapterConfig ApiKey
Template UploadedFile Workspace AccountProfile
BrowserSession LinkedAccount WorkspaceMember BillingTier
CheckoutSettings AdminPortalIdentity PartnerWorkspace
PartnerUsageSummary PartnerUsageLine ManagedOnboardingState
And the typed enums:
CurrencyCode CurrencyIDR, CurrencyUSD
CheckoutMethod CheckoutMethodQRIS, CheckoutMethodVA, CheckoutMethodEwallet,
CheckoutMethodCard, CheckoutMethodRetail, CheckoutMethodPaypal
PayoutStatus PayoutStatusPending, ...InTransit, ...Paid, ...Failed, ...Cancelled
PayoutMethod PayoutMethodManual, PayoutMethodXenditDisbursement
RefundStatus RefundStatusPending, ...Succeeded, ...Failed, ...Canceled
AdapterKind AdapterKindXendit, ...Paypal, ...Midtrans, ...Manual
TemplateKind TemplateKindCheckout, ...Receipt, ...Invoice
SourceType SourceTypeCheckoutSession, SourceTypeInvoice
All field names follow PascalCase Go convention; JSON tags translate to the wire camelCase. You never write camelCase in your Go code.
Next
- Quickstart — round-trip example.
- Errors — failure modes and retry idioms.
- Webhooks — inbound verification.
- API reference — wire-level details for every resource.