tixbit 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/cli.js +34 -9
- package/package.json +1 -1
- package/skills/tixbit/SKILL.md +1 -1
package/README.md
CHANGED
|
@@ -82,7 +82,7 @@ tixbit purchase <listing-id> \
|
|
|
82
82
|
|
|
83
83
|
Sign in to Link once, then start a purchase with a total price limit:
|
|
84
84
|
|
|
85
|
-
TixBit
|
|
85
|
+
TixBit needs Node.js 22 or later. The included Link CLI uses your local Link sign-in; TixBit does not ask for a developer API key.
|
|
86
86
|
|
|
87
87
|
```sh
|
|
88
88
|
npx @stripe/link-cli auth login
|
|
@@ -95,7 +95,7 @@ tixbit link start <listing-id> --quantity 1 --email buyer@example.com --max-pric
|
|
|
95
95
|
tixbit link complete <order-reference>
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
The second command checks approval, sends one Stripe MPP credential, and reports whether the ticket was issued. If approval is still pending, it returns the same URL without sending payment. After payment submission, the CLI will not send that payment again. If the result is `pending`,
|
|
98
|
+
The second command checks approval, sends one Stripe MPP credential, and reports whether the ticket was issued. If approval is still pending, it returns the same URL without sending payment. After payment submission, the CLI will not send that payment again. If the result is `pending`, run `tixbit link complete <order-reference>` again later. This checks the same order without resending the payment credential. Do not start another checkout. The CLI stores the purchase key in a private file under `~/.local/state/tixbit/link` (or `XDG_STATE_HOME`) and never prints or saves the Link payment token. Keep that file until the order is settled. Each command returns JSON; `approval_required` and payment failures use exit code 2. A completed purchase returns an order receipt URL, and TixBit sends the order confirmation and ticket delivery emails to the buyer address.
|
|
99
99
|
|
|
100
100
|
Each spend request includes its TixBit order reference in the approval details. Link can still rate limit a matching amount and merchant for a short time, even after a request is canceled. If Link rejects a request, the CLI reports a safe error code such as `LINK_DUPLICATE_REQUEST` or `LINK_NETWORK_UNAVAILABLE` without printing Link credentials.
|
|
101
101
|
|
package/dist/cli.js
CHANGED
|
@@ -884,7 +884,7 @@ var SPEND_REQUEST_ID = /^lsrq_[A-Za-z0-9]+$/;
|
|
|
884
884
|
var require2 = createRequire(import.meta.url);
|
|
885
885
|
function linkCliEntry() {
|
|
886
886
|
if (Number(process.versions.node.split(".")[0]) < 22) {
|
|
887
|
-
throw new LinkCheckoutError("LINK_NODE_UNSUPPORTED", "TixBit
|
|
887
|
+
throw new LinkCheckoutError("LINK_NODE_UNSUPPORTED", "TixBit needs Node.js 22 or later.");
|
|
888
888
|
}
|
|
889
889
|
try {
|
|
890
890
|
return join(dirname(require2.resolve("@stripe/link-cli/package.json")), "dist", "cli.js");
|
|
@@ -1063,15 +1063,39 @@ async function startLinkPurchase(input) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
async function completeLinkPurchase(orderReference) {
|
|
1065
1065
|
const state = await loadState(orderReference);
|
|
1066
|
+
if (state.result && ["fulfilled", "payment_failed", "rejected"].includes(state.result.status)) return state.result;
|
|
1067
|
+
if (state.paymentAttempted) {
|
|
1068
|
+
const request2 = JSON.parse(state.requestBody);
|
|
1069
|
+
const result2 = await new TixBitClient({ paymentEndpoint: paymentEndpoint(), timeoutMs: 3e4 }).purchaseTickets(request2);
|
|
1070
|
+
if (result2.orderReference && result2.orderReference !== orderReference) {
|
|
1071
|
+
throw new LinkCheckoutError("ORDER_REFERENCE_CHANGED", "TixBit returned a different order reference. Check the order before another payment.");
|
|
1072
|
+
}
|
|
1073
|
+
if (state.result?.status === "manual_review_required" && result2.status !== "fulfilled") {
|
|
1074
|
+
return state.result;
|
|
1075
|
+
}
|
|
1076
|
+
const sameOrder = result2.orderReference === orderReference;
|
|
1077
|
+
const terminalFailure = sameOrder && (result2.status === "payment_failed" || result2.status === "rejected");
|
|
1078
|
+
const manualReview = sameOrder && result2.status === "manual_review_required";
|
|
1079
|
+
const fulfilled = sameOrder && result2.success && result2.status === "fulfilled";
|
|
1080
|
+
const output3 = {
|
|
1081
|
+
success: fulfilled,
|
|
1082
|
+
status: fulfilled || manualReview || terminalFailure ? result2.status : "pending",
|
|
1083
|
+
orderReference,
|
|
1084
|
+
amountCents: state.amountCents,
|
|
1085
|
+
...sameOrder && result2.order ? { order: result2.order } : {},
|
|
1086
|
+
...sameOrder && result2.receiptUrl ? { receiptUrl: result2.receiptUrl } : {},
|
|
1087
|
+
...!fulfilled ? {
|
|
1088
|
+
error: sameOrder && (manualReview || terminalFailure) && result2.error ? result2.error : { code: "PURCHASE_OUTCOME_AMBIGUOUS", message: "The order is still being checked." },
|
|
1089
|
+
action: terminalFailure || manualReview ? result2.action ?? "Contact TixBit support with this order reference. Do not submit another payment." : "Run the same complete command again later. Do not start another payment or purchase."
|
|
1090
|
+
} : {}
|
|
1091
|
+
};
|
|
1092
|
+
if (output3.success || terminalFailure || output3.status === "manual_review_required") {
|
|
1093
|
+
state.result = output3;
|
|
1094
|
+
await saveState(state);
|
|
1095
|
+
}
|
|
1096
|
+
return output3;
|
|
1097
|
+
}
|
|
1066
1098
|
if (state.result) return state.result;
|
|
1067
|
-
if (state.paymentAttempted) return {
|
|
1068
|
-
success: false,
|
|
1069
|
-
status: "pending",
|
|
1070
|
-
orderReference,
|
|
1071
|
-
amountCents: state.amountCents,
|
|
1072
|
-
error: { code: "PURCHASE_OUTCOME_AMBIGUOUS", message: "Payment may have been submitted, but the result is unknown." },
|
|
1073
|
-
action: "Do not retry payment or start another checkout. Contact TixBit support with this order reference."
|
|
1074
|
-
};
|
|
1075
1099
|
const approval = await linkCli(["spend-request", "retrieve", state.spendRequestId, "--include", "shared_payment_token"]);
|
|
1076
1100
|
if (["denied", "declined", "expired", "canceled", "cancelled"].includes(String(approval.status))) {
|
|
1077
1101
|
return {
|
|
@@ -1145,6 +1169,7 @@ async function completeLinkPurchase(orderReference) {
|
|
|
1145
1169
|
orderReference,
|
|
1146
1170
|
amountCents: state.amountCents,
|
|
1147
1171
|
...result.order && !decline ? { order: result.order } : {},
|
|
1172
|
+
...result.receiptUrl && !decline ? { receiptUrl: result.receiptUrl } : {},
|
|
1148
1173
|
...!result.success ? {
|
|
1149
1174
|
error: decline ? { code: "CARD_DECLINED", message: "Stripe declined the card selected in Link." } : result.error,
|
|
1150
1175
|
action: decline ? "Select another card in Link and start a new spend approval. No ticket was issued." : result.status === "pending" ? "Payment may have succeeded. Do not retry or start another checkout. Contact TixBit support with this order reference." : result.action
|
package/package.json
CHANGED
package/skills/tixbit/SKILL.md
CHANGED
|
@@ -64,7 +64,7 @@ npx tixbit purchase <listingId> \
|
|
|
64
64
|
- The older `buy` web route supports 4-12 alphanumeric IDs only. The new Link MPP command accepts the listing IDs supported by the MPP server.
|
|
65
65
|
- Without a signed-in user integration, seller commands return browser sign-in guidance and do not read or submit listings. Browser-to-CLI seller sessions are not supported. Do not extract browser tokens. Optional authorized integrations may supply `TIXBIT_ACCESS_TOKEN`; seller creation still requires `--confirm`, `termsAccepted: true`, and server ownership/access checks.
|
|
66
66
|
- All commands emit JSON, including errors. Preserve full case-sensitive IDs.
|
|
67
|
-
- Never
|
|
67
|
+
- Never resend an uncertain Link payment. Repeat `link complete` with the same order reference to check server recovery without sending a second credential. Read seller listings after uncertain creation.
|
|
68
68
|
- No bids or negotiation are available. Do not claim a price reduction.
|
|
69
69
|
|
|
70
70
|
## Required workflow
|