Nylon PayNylon Pay

Nylon Pay Integration Skill

Language-agnostic agent skill for Nylon Pay flows, contracts, and boundaries

Nylon Pay integration skill for AI coding agents (Cursor, Claude Code, and similar). It describes which flow to build and which operation to pick, not language syntax. Load this page first, then the SKILL.md shipped with your SDK for install commands, naming, and runnable examples.

Ready-to-paste tasks: Example prompts.

Two layers

LayerWhereWhat it covers
Integration skillThis pageFlows, contracts, operation choice, boundaries, gotchas
SDK skillSKILL.md in each packageIdiomatic setup, imports, and code for that language

Think in feature flows and contracts, not copy-paste from one language into another. The SDK specification is the shared contract every SDK implements.

Security boundary

  • Server-side only. Never expose apiSecret to browsers or mobile clients.
  • Keys from environment variables. API key prefix npk_, secret prefix nps_.
  • Test vs live comes from the key you use, not a config flag. There is no environment option.

Universal contracts

  • Amounts: integers in the currency's smallest tracked unit (for example 10000).
  • Currencies: USD, EUR, GBP, KES, UGX, TZS, RWF.
  • Result: data operations return success or failure. Branch before reading the success payload. Use the SDK's parse-error helper for human messages and retry hints.
  • Reference: supply a UUID v4 you own for idempotency, or omit it for an auto-generated UUID. Non-UUID values fail validation.

Naming across SDKs

ConceptTypeScript / PHPPython
Success checkresult.isOkresult.is_ok
Collect (await)collectPaymentAndResolvecollect_payment_and_resolve
Invoice link field.paymentLink.payment_link
Customer phonephoneNumberphone_number

TypeScript and PHP share camelCase. Python uses snake_case. Field tables: SDK Reference.

Choosing an operation

GoalTypeScript / PHPPythonReturn shape
Take money, react to live updatescollectPaymentcollect_paymentPayment instance (events)
Take money, await final statecollectPaymentAndResolvecollect_payment_and_resolveResult
Send money, react to live updatesmakePayoutmake_payoutPayment instance
Send money, await final statemakePayoutAndResolvemake_payout_and_resolveResult
One-shot statusgetStatusget_statusResult
Full transaction recordgetTransactionget_transactionResult (id or reference)
Pre-validate phone / get nameverifyPhoneverify_phoneResult
Hosted payment link (cards)createInvoicecreate_invoiceResult with payment link
Authenticate webhookverifyWebhookSignatureverify_webhook_signatureboolean

Prefer *AndResolve / *_and_resolve for simple request/response handlers. Use the event-driven payment instance when you need progressive status updates.

Flow: simple collect or payout

  1. Create the SDK client with keys from the environment.
  2. Call the *AndResolve variant for the direction (collect or payout).
  3. Branch on Result before reading .value.
  4. On failure, parse the error for a human message and whether retry is safe.
  5. On success, persist reference and transaction identifiers your app needs.

Flow: event-driven payment

  1. Call collectPayment / makePayout (without AndResolve).
  2. Subscribe to processing, success, failed, cancelled, and error.
  3. Call wait() for the final transaction or null (failure does not throw).
  4. Fulfill or notify from event handlers; do not assume wait() alone is enough if side effects must run as soon as status changes.

Flow: webhooks

  1. Read the raw, unparsed request body (bytes or string).
  2. Verify the signature from the x-nylon-signature header against your webhook secret before trusting the payload.
  3. Return 401 when verification fails.
  4. Process the event only after verification succeeds.

Re-serializing JSON breaks verification.

Flow: card payments

Card checkout is hosted invoice only. Call createInvoice, then redirect the customer to the payment link on the result (.paymentLink or .payment_link). Do not collect card numbers in your app.

Flow: status and reconciliation

  • Quick status: getStatus with reference.
  • Full record: getTransaction with id or reference.
  • Phone check before pay: verifyPhone to validate format and read the registered name when available.

Gotchas

  • Webhook verification requires the raw body, not parsed-then-stringified JSON.
  • Card payments only through hosted invoice.
  • Supplied reference values must be UUIDs (or omit for auto UUID v4).
  • Multiple official SDKs exist. Do not assume TypeScript-only APIs when the user's stack is Python or PHP.

SDK skills (implementation)

Load the integration skill (this page) and the SDK skill for your language.

Each SDK skill also links the other languages so agents do not treat one stack as the only option.

How to use in Cursor

  1. Load this integration skill (this page).
  2. Load SKILL.md from your SDK package or its GitHub repo (table above).
  3. Paste a concrete task from Example prompts, or describe your flow in plain language.

What skills are not

  • Skills do not replace the SDK Reference. Use the reference for full field tables and API detail.
  • Skills do not change runtime behavior. They only guide the agent.
  • Never paste live keys into prompts. Keep secrets in environment variables.

Request another language

Go and C# are in pipeline. For other languages, early access, or docs help:

On this page