Python SDK for Siglume Direct Request Payment checkout integrations
Project description
@siglume/direct-request-payment
Merchant SDK for Siglume Direct Request Payment checkout integrations.
Use this package when an external EC site, booking service, membership service, or paid API wants to accept Siglume wallet payments without taking custody of customer funds.
This SDK is intentionally separate from @siglume/api-sdk:
@siglume/api-sdkis for publishing agent-facing APIs to the Siglume API Store.@siglume/direct-request-paymentis for external merchants integrating Siglume Direct Request Payment into their own checkout.
What This SDK Covers
- merchant self-service setup with a Siglume merchant JWT
- challenge secret creation and rotation
- merchant billing mandate preparation
- webhook subscription creation
- merchant-signed payment challenges
- merchant-signed recurring approval challenges for subscriptions and scheduled autopay
- buyer-authenticated payment requirement creation
- prepared wallet transaction execution payloads
- payment requirement verification
- signed webhook verification
It does not custody funds or manage customer wallets. Merchant setup runs through Siglume APIs with the merchant's Siglume JWT; buyer payment creation runs with the buyer's Siglume JWT.
Install
npm install @siglume/direct-request-payment
pip install siglume-direct-request-payment
Node.js 18 or later is required for the TypeScript SDK. Python 3.11 or later is required for the Python SDK.
Current Platform Contract
The public product name is Siglume Direct Request Payment. The current
platform payload still uses the internal mode name external_402; this SDK sets
that value for you when creating a payment requirement.
Payment requirement creation must run in the authenticated buyer's Siglume context. Your merchant server must not use a merchant secret or API key to charge a customer wallet. The merchant server creates the signed challenge; the buyer-facing Siglume payment flow creates and pays the requirement.
DirectRequestPaymentMerchantClient requires the merchant's Siglume bearer
token for setup. DirectRequestPaymentClient requires the buyer's Siglume
bearer token for payment requirements. Do not use a Developer Portal cli_ API
key with this package.
Current HTTP endpoints live under Siglume's market/API Store route namespace for compatibility with the existing platform contract. That does not make this SDK an API Store publishing SDK.
Trial Pricing
Siglume Direct Request Payment is currently offered with trial-phase merchant pricing designed for small EC sites, booking services, membership services, paid APIs, and agent-to-agent payment experiments.
| Plan | Monthly fee | Payment fee |
|---|---|---|
| Launch | JPY 0 | 0% through 100 payments/month, then 1.8% |
| Starter | JPY 980 | 1.0% |
| Growth | JPY 2,980 | 0.7% |
| Pro | JPY 9,800 | 0.5% |
The minimum fee is JPY 3 for each fee-bearing payment, including Launch-plan
payments after the included monthly allowance. A merchant billing mandate is
required before accepting payments, even on the Launch plan. The API and merchant
registry may still expose the internal plan key free for this tier. See
docs/pricing.md for details.
Per-payment fees are deducted at payment settlement time, so the merchant receives the net amount. Monthly base fees are collected through the merchant billing mandate. The listed public pricing is JPY-denominated; USD/USDC merchant billing requires separately agreed terms.
Merchant Setup: One SDK Call
Run this once from the merchant server or an integration agent with the merchant's Siglume JWT. It reserves the merchant key, creates the challenge secret, prepares the billing mandate, and creates the webhook subscription.
import { DirectRequestPaymentMerchantClient } from "@siglume/direct-request-payment";
const merchant = new DirectRequestPaymentMerchantClient({
auth_token: process.env.SIGLUME_MERCHANT_AUTH_TOKEN!,
});
const setup = await merchant.setupCheckout({
merchant: "example_merchant",
display_name: "Example Merchant",
billing_plan: "launch",
billing_currency: "JPY",
webhook_callback_url: "https://merchant.example/siglume/webhook",
max_amount_minor: 100000,
});
console.log(setup.env);
// {
// SIGLUME_DIRECT_PAYMENT_MERCHANT: "example_merchant",
// SIGLUME_DIRECT_PAYMENT_CHALLENGE_SECRET: "edrp_...",
// SIGLUME_WEBHOOK_SECRET: "whsec_..."
// }
import os
from siglume_direct_request_payment import DirectRequestPaymentMerchantClient
merchant = DirectRequestPaymentMerchantClient(
auth_token=os.environ["SIGLUME_MERCHANT_AUTH_TOKEN"],
)
setup = merchant.setup_checkout(
merchant="example_merchant",
display_name="Example Merchant",
billing_plan="launch",
billing_currency="JPY",
webhook_callback_url="https://merchant.example/siglume/webhook",
max_amount_minor=100000,
)
print(setup["env"])
Store returned secrets on the merchant server. challenge_secret and
signing_secret are returned only when they are created or rotated. If a billing
mandate response requires wallet approval, complete that Siglume wallet step
before accepting production payments.
Merchant Server: Create a Challenge
import { createDirectRequestPaymentChallenge } from "@siglume/direct-request-payment";
const challenge = await createDirectRequestPaymentChallenge({
merchant: "example_merchant",
amount_minor: 1200,
currency: "JPY",
secret: process.env.SIGLUME_DIRECT_PAYMENT_CHALLENGE_SECRET!,
nonce: "order_123-attempt_1",
});
// Return only challenge.challenge to the buyer-facing checkout.
// Never return the challenge secret to the browser.
console.log(challenge.challenge);
import os
from siglume_direct_request_payment import create_direct_request_payment_challenge
challenge = create_direct_request_payment_challenge(
merchant="example_merchant",
amount_minor=1200,
currency="JPY",
secret=os.environ["SIGLUME_DIRECT_PAYMENT_CHALLENGE_SECRET"],
nonce="order_123-attempt_1",
)
print(challenge["challenge"])
The signed challenge binds:
- merchant key
- amount in minor units
- currency
- nonce
Changing any of those values invalidates the challenge.
The nonce must not contain : because the current platform challenge format is
scheme:nonce:signature.
Buyer Payment Flow
Use DirectRequestPaymentClient only with the authenticated buyer's Siglume
bearer token. SIGLUME_AUTH_TOKEN may be used in server-side payment-confirmation
helpers; SIGLUME_API_KEY and Developer Portal cli_ keys are not accepted.
import { DirectRequestPaymentClient } from "@siglume/direct-request-payment";
const siglume = new DirectRequestPaymentClient({
auth_token: buyerSiglumeBearerToken,
});
const requirement = await siglume.createPaymentRequirement({
merchant: "example_merchant",
amount_minor: 1200,
currency: "JPY",
challenge: challengeFromMerchantServer,
});
if (requirement.approve_transaction_request) {
await siglume.executeAllowanceTransaction(requirement, { await_finality: true });
}
const payment = await siglume.executePaymentTransaction(requirement, {
await_finality: true,
});
const receiptId = String(payment.receipt?.receipt_id ?? "");
const verified = await siglume.verifyPaymentRequirement(requirement.requirement_id, {
receipt_id: receiptId,
await_finality: false,
});
console.log(verified.status);
from siglume_direct_request_payment import DirectRequestPaymentClient
siglume = DirectRequestPaymentClient(auth_token=buyer_siglume_bearer_token)
requirement = siglume.create_payment_requirement(
merchant="example_merchant",
amount_minor=1200,
currency="JPY",
challenge=challenge_from_merchant_server,
)
if requirement.get("approve_transaction_request"):
siglume.execute_allowance_transaction(requirement, await_finality=True)
payment = siglume.execute_payment_transaction(requirement, await_finality=True)
receipt_id = str((payment.get("receipt") or {}).get("receipt_id") or "")
verified = siglume.verify_payment_requirement(
requirement["requirement_id"],
receipt_id=receipt_id,
await_finality=False,
)
print(verified["status"])
Recurring Payments: Subscription and Scheduled Autopay
Beyond one-time checkout, a buyer can authorize recurring payments. The merchant approves the price and recurring product tag once by signing a recurring challenge with a distinct scheme, so one-time checkout challenges and recurring approval challenges cannot be replayed as each other.
- Subscription (
cadence: "monthly"): Siglume charges the buyer's wallet monthly and pays the merchant wallet automatically. The buyer can cancel from their Siglume wallet. - Scheduled autopay (
cadence: "daily"):dailyis the approval tag for merchant-triggered scheduled autopay. It is not a run-count limiter. Actual occurrences are bounded by the buyer-approved per-run, daily, and monthly auto-pay budget.
import { createDirectRequestPaymentRecurringChallenge } from "@siglume/direct-request-payment";
const recurring = await createDirectRequestPaymentRecurringChallenge({
merchant: "example_merchant",
amount_minor: 980,
currency: "JPY",
cadence: "daily",
secret: process.env.SIGLUME_DIRECT_PAYMENT_CHALLENGE_SECRET!,
nonce: "schedule_setup_4711",
});
console.log(recurring.challenge);
import os
from siglume_direct_request_payment import create_direct_request_payment_recurring_challenge
recurring = create_direct_request_payment_recurring_challenge(
merchant="example_merchant",
amount_minor=980,
currency="JPY",
cadence="daily",
secret=os.environ["SIGLUME_DIRECT_PAYMENT_CHALLENGE_SECRET"],
nonce="schedule_setup_4711",
)
print(recurring["challenge"])
Each recurring challenge is single-use and should be issued per buyer setup.
Scheduled autopay occurrences after setup are challenge-free by design; the
authorization, schedule_token, and buyer budget caps are the per-occurrence
checks.
Webhooks
Your merchant system should treat Siglume webhooks as the durable delivery
signal. Always verify the signature against the raw request body before trusting
the payload. Create a marketplace webhook subscription with
POST /v1/market/webhooks/subscriptions; the response returns the whsec_
signing secret once.
import { verifyDirectRequestPaymentWebhook } from "@siglume/direct-request-payment";
const { event } = await verifyDirectRequestPaymentWebhook(
process.env.SIGLUME_WEBHOOK_SECRET!,
rawRequestBody,
request.headers["siglume-signature"],
);
if (event.type === "direct_payment.confirmed") {
// Mark the order paid if event.data.challenge_hash/order mapping matches.
}
import os
from siglume_direct_request_payment import verify_direct_request_payment_webhook
verified = verify_direct_request_payment_webhook(
os.environ["SIGLUME_WEBHOOK_SECRET"],
raw_request_body,
siglume_signature_header,
)
if verified["event"]["type"] == "direct_payment.confirmed":
# Mark the order paid if event.data.challenge_hash/order mapping matches.
pass
Security Rules
- Keep the challenge secret on the merchant server only.
- Keep merchant order amount and currency server-authored.
- Use one nonce per order payment attempt.
- Store
challenge_hashwith the order and reject mismatches. - Make order fulfillment idempotent by
requirement_idand order id. - Verify webhook signatures against the raw body.
- Do not use a merchant token to charge a customer wallet.
- Do not treat Direct Request Payment as stored value, prepaid points, escrow, or a platform balance.
Read docs/security.md before going live.
Go-Live Checklist
- Run
setupCheckoutwith the merchant Siglume JWT. - Complete the merchant billing mandate wallet approval if required.
- Store
SIGLUME_DIRECT_PAYMENT_CHALLENGE_SECRETonly on the merchant server. - Store the returned
SIGLUME_WEBHOOK_SECRETonly on the merchant server. - Persist
challenge_hash,requirement_id, and fulfillment state per order. - Fulfill orders only from verified webhook data, with idempotency.
- Treat
fee_bpsreturned by Siglume as the runtime fee source of truth.
Documentation
- Merchant quickstart
- API reference
- Pricing
- Security guide
- Merchant setup example
- Express checkout example
- Japanese launch announcement draft
- Changelog
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file siglume_direct_request_payment-0.3.1.tar.gz.
File metadata
- Download URL: siglume_direct_request_payment-0.3.1.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c5712220094b711944ed44bc6da90c9b3e779bac14a1c9e8d071f349913b1e9
|
|
| MD5 |
e7d3a20e076b90b960e07eaef25ae650
|
|
| BLAKE2b-256 |
6195ff8051af346a1eca26351d9839028588bf3ad9b903c2e3258d4da0d60057
|
Provenance
The following attestation bundles were made for siglume_direct_request_payment-0.3.1.tar.gz:
Publisher:
release-pypi.yml on taihei-05/siglume-direct-request-payment
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
siglume_direct_request_payment-0.3.1.tar.gz -
Subject digest:
5c5712220094b711944ed44bc6da90c9b3e779bac14a1c9e8d071f349913b1e9 - Sigstore transparency entry: 1802948959
- Sigstore integration time:
-
Permalink:
taihei-05/siglume-direct-request-payment@6dcee9e03f094eb7ed9373695b7796a5b3d55e3f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/taihei-05
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@6dcee9e03f094eb7ed9373695b7796a5b3d55e3f -
Trigger Event:
push
-
Statement type:
File details
Details for the file siglume_direct_request_payment-0.3.1-py3-none-any.whl.
File metadata
- Download URL: siglume_direct_request_payment-0.3.1-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
990fc69af23ce078f7c4c92ebf0912128ec5a4ec40e279214d51d1979c7a1fab
|
|
| MD5 |
00a2882fcc273b6c435767d0e6fe0574
|
|
| BLAKE2b-256 |
cc154e6d23830eacbd3d54692e57f59f9f48691ff56a54aa1b6229e085725b28
|
Provenance
The following attestation bundles were made for siglume_direct_request_payment-0.3.1-py3-none-any.whl:
Publisher:
release-pypi.yml on taihei-05/siglume-direct-request-payment
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
siglume_direct_request_payment-0.3.1-py3-none-any.whl -
Subject digest:
990fc69af23ce078f7c4c92ebf0912128ec5a4ec40e279214d51d1979c7a1fab - Sigstore transparency entry: 1802949032
- Sigstore integration time:
-
Permalink:
taihei-05/siglume-direct-request-payment@6dcee9e03f094eb7ed9373695b7796a5b3d55e3f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/taihei-05
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@6dcee9e03f094eb7ed9373695b7796a5b3d55e3f -
Trigger Event:
push
-
Statement type: