Skip to content
Agentmart
Submit a tool

aba-payway-purchase

Create a signed ABA PayWay checkout purchase with aba-payway-ts.

Skill by Ruzaid-aman

IndexedMIT
Write a review

Chalk Labs

Need help deploying aba-payway-purchase?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/ruzaid-aman-aba-payway-purchase

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Create a signed ABA PayWay checkout purchase with aba-payway-ts.

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/aba-payway-purchase

What's inside

Skill name
aba-payway-purchase
Description
Create a signed ABA PayWay checkout purchase with aba-payway-ts.
License
MIT
Metadata
version: 1.4.1
Instructions
123 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • files: referenced but missing: scripts/checkout-link-poll.ts, scripts/checkout-cards-close.ts, scripts/close-transaction-verify.ts

Files (1)

  • SKILL.md

SKILL.md (first lines)

# ABA PayWay Purchase

## Quick Start

For onboarding, start with [first payment](../aba-payway-first-payment/SKILL.md).
Use the shared lifecycle: `created`, `pending`, `approved`, `failed`, `unknown`.
Creation is not approval. Verify order ID, amount, and currency before fulfilling once.
A timeout means unknown; query the existing attempt before replacing it.
Expiry and closure remain local policy, even when the gateway reads PENDING.
See [webhook production](../aba-payway-webhook-production/SKILL.md) for callback trust and recovery.
Run the installed CLI as `npm exec -- payway-sdk`.

```ts
import { PayWay } from 'aba-payway-ts';
const payway = new PayWay();
const payload = payway.checkout.createTransaction({ transactionId: 'order-123', amount: 10, currency: 'USD' });
```

Post the returned signed payload from your server-rendered checkout form. Keep API credentials server-side.

## Default checkout presentation

Follow the installed public guides `integration-ui` and `ui-customization` (`npm exec -- payway-sdk docs <topic>`). Show **Select payment method** with all profile-enabled methods and current official assets; KHQR must read **ABA KHQR** / **Scan to pay with any banking app**. Above Pay, link Terms & Conditions / Refund Policy and require the acceptance checkbox before any frontend submission. For the expected web popup use `checkout2-0.js` and `AbaPayway.checkout()`; `viewType` alone is insufficient. Mobile app WebViews use full-screen hosted checkout, a static merchant header and no browser toolbar; ordinary browsers own their address bars.

Configure `continueSuccessUrl` for the customer web return or `returnDeeplink` for the app. Purchase `returnUrl` is the notification destination. Clear purchased cart contents, update the order and show merchant confirmation only after verified backend acceptance, with fulfillment tracked separately. Obtain Integration Team review of checkout/KHQR screens before production credentials. Request current approved logo files; design examples do not enable methods or authorize redistributing assets.

> **Local vs. network:** `createTransaction()` (and `createCheckoutPayload()`) only **builds a LOCAL signed payload** — it performs no network request. By contrast, `purchase()` (and the agentic `create_checkout_purchase` tool) performs the actual **NETWORK request** to PayWay. Use the local builder when you want to render your own checkout form; use `purchase()` when you want the SDK to submit the payment.

## Two hosted routes — pick the shape you need

There is **no single `checkout_qr_url` default**. The 200 response body depends on the request shape (sandbox-verified 2026-08-25, §10b/W2-1):

| Route | Request | Response |
|---|---|---|
| **A: hosted URL (JSON)** | `paymentOption: 'abapay_khqr_deeplink'` + `viewType: 'hosted_view'` + `paymentGate: 0` | `PurchaseQrResponse` JSON that **includes `checkout_qr_url`** (plus `qr_string`/`abapay_deeplink`) |
| **B: hosted HTML page** | any option + `paymentGate: 0` **without** the deeplink+hosted_view combo (e.g. `cards`) | full hosted "PayWay - Checkout" HTML page as the BODY — no URL field; use `purchaseHosted()` for the typed result |

Route A — hosted URL, typed, no casts (SDK ≥ 1.5.0):

```ts
const res = await payway.checkout.purchase({
  transactionId: 'order-123', amount: 12.12, currency: 'USD',
  paymentOption: 'abapay_khqr_deeplink', viewType: 'hosted_view', paymentGate: 0,
  lifetime: 600, // MINUTES (min 3, max 43200) — 600 = a 10-hour window, NOT 10 minutes!
});
if ('qr_string' in res) {           // narrows to PurchaseQrResponse (Route A)
  const url = res.checkout_qr_url;  // string | undefined — hosted page, open in browser/app
}
```

Route B — hosted HTML, typed:

```ts
const page = await payway.checkout.purchaseHosted({
  transactionId: 'order-123', amount: 15, currency: 'USD', paymentOption: 'cards',
  returnUrl: 'https://merchant.com/api/payway/callback',
  continueSuccessUrl: 'https://merchant.com/orders/result',
}); // PurchaseHostedHtmlResult { hosted_checkout: true, content_type, html }
res.type(page.content_type).send(page.html); // Express — but see the CORS warning below
```

> ⚠️ **`lifetime` on the purchase/checkout path is MINUTES** (minimum 3 — the SDK
> throws below 3; the gateway would answer error 69). Only the **QR domain's**
> `lifetime` is seconds. A copied `lifetime: 600` "seconds" habit silently buys a
> 10-hour checkout window. On the CLI, prefer the explicit-units flag
> `--lifetime-minutes` (`--lifetime` remains a deprecated minutes alias).

> ⚠️ **Serving Route B's captured HTML from your own origin is NOT supported**:
> the page references relative `/_nuxt/*` assets and breaks with CORS/file-origin
> errors outside the gateway origin. For a browser-hosted flow, POST the signed
> form directly to the gateway (Route C below) instead of re-serving gateway HTML.

## CLI flag set (generate-checkout)
`generate-checkout` forwards the full purchase param surface:
`--ctid --token-flag --frequency --type --firstname --lastname --email --phone --items --shipping --lifetime-minutes <minutes> --custom-fields --return-params --skip-success-page --view-type --continue-success-url --payout --additional-params --google-pay-token --return-deeplink --payment-gate <0|1> --payment-option`.

- `--payout` is JSON `[{acc, amt}]` or string (purchase-path keys — NOT the standalone payout domain's `{account, amount}`).
- `--additional-params` is a object or string; `--return-deeplink` is JSON `{ios_scheme, android_scheme}` or string (both base64-encoded before hashing).
- `--google-pay-token` is required by the gateway when `--payment-option google_pay` (the SDK throws without it).
- `--payment-gate 0` returns the hosted HTML page in the response (Route B); the CLI prints/records it as an artifact rather than a URL. For browser navigation use `checkout-form --payment-gate 0`, which renders the local signed form that POSTs directly to the gateway.

### Card-payment response matrix (`paymentOption: 'cards'`, sandbox-verified 2026-08-25)
| Request | Response |
|---|---|
| `cards` (no gate, or gate 1) via `purchase()` | JSON PurchaseQrResponse — but with **KHQR data** (qr_string/abapay_deeplink), no checkout URL |
| `cards` + `paymentGate: 0` via `purchase()`/`purchaseHosted()` | the hosted card-checkout page as **HTML** (`PurchaseHostedHtmlResult`) — transaction IS created, but you cannot re-serve that HTML from your own origin (relative `/_nuxt/*` assets → CORS/file-origin errors) |

**Correct card integration (official):** build the signed payload LOCALLY with `checkout.createTransaction({ paymentOption: 'cards', ... })`, embed all fields as hidden inputs in a `<form method="POST" target="aba_webservice" action="…/v1/payments/purchase">`, load `<script src="https://checkout.payway.com.kh/plugins/checkout2-0.js" defer></script>`, and call `AbaPayway.checkout()` on submit — PayWay's HTML renders in a modal (iframe POST, no CORS). The SDK's `getCheckoutFormHtml()` / CLI `checkout-form` build exactly this form. Docs: https://developer.payway.com.kh/ecommerce-checkout-3158159f0

## Error Handling
```ts
import { PayWayConfigError } from 'aba-payway-ts';
try { payway.checkout.createTransaction({ transactionId: 'order-123', amount: 10 }); }
catch (error) { if (error instanceof PayWayConfigError) console.error(error.message); }
```

## Tools

The purchase flow needs no bundled scripts — the CLI covers the whole lifecycle:

```sh
# Create + auto-poll a checkout (lifetime in MINUTES):
payway-sdk generate-checkout -a 12.12 -c USD --return-url https://example.com/r --lifetime-minutes 5 -y
# Hosted checkout URL (checkout_qr_url) — Route A (deeplink + hosted_view + gate 0):
#   payway.checkout.purchase({ ..., paymentOption: 'abapay_khqr_deeplink', viewType: 'hosted_view', paymentGate: 0 })
# Hosted HTML page — Route B, or local browser form:
#   payway.checkout.purchaseHosted({ ... })  |  payway-sdk checkout-form -a 10 -o form.html
# Card integration — local form (official pattern, no API call):
payway-sdk checkout-form -a 10 -o form.html
# Close an unpaid transaction, then verify:
payway-sdk close-transaction -t <txId> -y && payway-sdk check-transaction -t <txId>
```

> Repo-clone note: `scripts/checkout-link-poll.ts`, `scripts/checkout-cards-close.ts`,
> and `scripts/close-transaction-verify.ts` exist in the SDK repository's `scripts/`
> directory (development probes, not shipped in the npm package) — the CLI commands
> above are the supported equivalents.

## Related Skills

From Ruzaid-aman/ABA-Payway-SDK-unofficial, MIT.

More from Ruzaid-aman/ABA-Payway-SDK-unofficial

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 2, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.4.1
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from Ruzaid-aman

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get aba-payway-purchase running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying aba-payway-purchase?

CallGet help
Cite this page

aba-payway-purchase skill. Agent Mart. https://agentmart.dev/skills/ruzaid-aman-aba-payway-purchase (last updated 2026-10-24)