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.
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.
DirectRequestPaymentClient requires the buyer's Siglume bearer token. Do not
use a Developer Portal cli_ API key with this package.
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 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"])
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.
Documentation
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.1.0.tar.gz.
File metadata
- Download URL: siglume_direct_request_payment-0.1.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f80cc9056b801b97ed1cd052a992bd89355347e880f588c1c84be8102569b776
|
|
| MD5 |
bd62f37d742a11843d3e503006507e2a
|
|
| BLAKE2b-256 |
9bbd0d1738cc9610b92d3ed14d67373dbfd410a69e5ef7f2a508023ed99a1c7c
|
Provenance
The following attestation bundles were made for siglume_direct_request_payment-0.1.0.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.1.0.tar.gz -
Subject digest:
f80cc9056b801b97ed1cd052a992bd89355347e880f588c1c84be8102569b776 - Sigstore transparency entry: 1790438091
- Sigstore integration time:
-
Permalink:
taihei-05/siglume-direct-request-payment@eae86934552bd978cb7d56f68d30694f238bc0c7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/taihei-05
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@eae86934552bd978cb7d56f68d30694f238bc0c7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file siglume_direct_request_payment-0.1.0-py3-none-any.whl.
File metadata
- Download URL: siglume_direct_request_payment-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.5 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 |
1e3dec68087d338dcb5a9d98644b1e882ba765362caa9bcfd2b748be5a1b35ad
|
|
| MD5 |
4a2c672e7259b7f3821521e78c901246
|
|
| BLAKE2b-256 |
8c8db7557764fd65ef4de68aacd8ba2734d5d25069ab4045ba6fc2e3168cf01b
|
Provenance
The following attestation bundles were made for siglume_direct_request_payment-0.1.0-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.1.0-py3-none-any.whl -
Subject digest:
1e3dec68087d338dcb5a9d98644b1e882ba765362caa9bcfd2b748be5a1b35ad - Sigstore transparency entry: 1790438119
- Sigstore integration time:
-
Permalink:
taihei-05/siglume-direct-request-payment@eae86934552bd978cb7d56f68d30694f238bc0c7 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/taihei-05
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@eae86934552bd978cb7d56f68d30694f238bc0c7 -
Trigger Event:
push
-
Statement type: