Repository navigation
Conversation
New task-first capability guide at voice/take-payments covering SWML pay, Relay call.pay, AI agents via FunctionResult.pay, the payment connector protocol, results, and PCI. Cross-link it from the voice overview, llms.txt, and the SWML, cXML, Relay, FunctionResult, content redaction, and record calls pages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-Call-Guide # Conflicts: # fern/llms.txt
hey-august
left a comment
There was a problem hiding this comment.
Summary
Requesting changes. The guide is in good shape, but four statements contradict the platform, three code samples fail on first run, and two smaller items need a touch. Platform behavior below is verified against source.
Blocking
- Custom prompts do not replace SignalWire's retry prompts (
take-payments.mdx:1192). The sentence "Each entry inpromptsreplaces SignalWire's prompt for one step" holds only for the first attempt. Prompt selection weights any error-matched prompt above a plain one, so the built-in timeout and invalid-* prompts outrank a custom prompt with noerror_type. The page's own example, a plainpayment-card-numberprompt withmax_attempts: 3, plays the stock timeout prompt on retry. State that a prompt needs the matchingerror_typeto replace a retry prompt. - The HMAC is computed over the URL with credentials removed (
take-payments.mdx:115and:244). The page says the signature covers the URL "exactly as you passed it". The platform strips anyuser:password@before signing and sends those as Basic auth. A reader who protects the connector with basic auth and sets theCONNECTOR_URLvariable to the credentialed string gets a 403 on every request. One sentence fixes it. - The result table omits
validation-error(take-payments.mdx:1665). The table is introduced as the full set but leaves out thevalidation-errorvalue. The SWML reference this page links does list it. Add the row. - The reference defines
payment-connector-errordifferently from the guide (swml/.../pay/index.mdx:753). The reference says the connector returned an error. In practice a reachable connector that answers non-200 ends asinternal-error, andpayment-connector-errorsurvives only when the connector is unreachable, which is what the guide says at lines 643 and 1669. Align the reference with the guide. - The TypeScript connector corrupts multi-byte request bodies (
take-payments.mdx:320). The statementrawBody += chunkstringifies each Buffer on its own. A UTF-8 character split across two chunks becomes U+FFFD, and the HMAC check fails intermittently on non-ASCII descriptions. Callreq.setEncoding("utf8")before the loop, or collect Buffers and useBuffer.concat. - The stop timer leaves a promise rejection unhandled (
take-payments.mdx:1931). The callsetTimeout(() => void action.stop(), 120_000)discards the promise fromstop(). If the platform refuses the stop, Node 15 and later terminates the handler mid-call. Add.catch(() => {}). - The
call.paymethod raises rather than returning an error (take-payments.mdx:652). The troubleshooting text sayscall.payreturns an error. The Python SDK raises and the TypeScript SDK rejects, and neither Relay sample catches it. Anhttp://connector URL produces a traceback and a hung call. Reword the sentence, and consider wrappingcall.payin a try block in both samples.
Non-blocking
- The connector-body table should mark
parametersas optional (take-payments.mdx:205). The platform omits theparameterskey when none are set, the same asdescription. The sample body labeled as the Bayview fare body includesparameters, which the first run never sends. - The Python sample disables schema validation for the whole document (
take-payments.mdx:1576). The sample passesschema_validation=FalsetoSWMLService. Themdx-capability-guidesrule says to bypass validation for the one verb only. The TypeScript twin already does that withaddVerb.
- Explain prompt precedence: error_type outranks card_type outranks a plain prompt, and SignalWire's retry and Amex prompts count, so a plain prompt replaces only the first try. The options example now covers timeout retries of the card number. - The signature covers the connector URL without user:password@, which SignalWire sends as Basic auth instead. - Add validation-error to the result table; align the SWML reference's payment-connector-error, validation-error, and internal-error definitions with platform behavior, and document prompt precedence. - TypeScript connector decodes the body across chunks (setEncoding), so split multi-byte characters no longer break the HMAC check. - Catch a rejected stop() in the stop-collection samples. - call.pay fails rather than returning an error: reword troubleshooting. - Mark the connector body's parameters as optional, and say the sample body includes a ride ID. - Python skip-security-code sample bypasses the builder check for the pay verb only instead of disabling validation for the document.
|
@hey-august thanks for the careful review. All of it is addressed in 794c1bb.
|
Drop the signalwire-sdk==3.4.1 and @signalwire/sdk@2.0.5 pins. Move the TypeScript REST dial to the positional dial(from, to, options) form, and build the skip-security-code TypeScript sample with validation on, then set security_code on the built pay verb, matching the Python sample.
Devon-White
left a comment
There was a problem hiding this comment.
Reviewed the current head (c61ab0a) against the deployed mod_infrastructure (4733e1ce99d8, in calling13-20261028; relay_pay.c is identical on master), switchblade stable, prime-rails, and the latest Server SDKs (signalwire-sdk 3.7.6, @signalwire/sdk 3.7.1).
All nine items from the earlier review are addressed. The one change Devon declined (try blocks around call.pay) is now covered in the troubleshooting text.
Verified correct: connector request body and the parameters/description omission (pay_post_payment_request). Signing over the credential-stripped URL plus body, both headers, hex. The success rule (200 + charge_id, or token_id only for a plain-zero amount, no error). Result values and card-declined/700. pay_payment_results and final-event shapes, and the progress-event fields. Defaults, the max_attempts ≤ 3 and timeout ≥ 3 limits, and card type names. The prompt ranking (+1 card_type, +2 error_type, ties go to the later prompt). Masking and sensitive_dtmf. https enforcement in both the SWML and Relay schemas. Every SWML builder sample outputs exactly the YAML and JSON beside it, and both FunctionResult.pay samples produce the JSON at line 2057. Python samples pass pyflakes, and every SDK method and parameter used exists with the shown signature. Links and anchors resolve.
Inline: two behavior mismatches (Relay stop semantics; first-run troubleshooting behind ngrok), two convention items, and one PCI question.
Minor, no inline comment: the TypeScript — REST client first-run sample fails tsc --strict on swml, (TS2741: the SDK types SwmlBuilder.build() as Record<string, unknown>, but calling.dial expects SWMLObject). It runs fine as .mjs, as its header says, so this is an SDK typing gap and not a doc bug. It may be worth noting for readers who save it as .ts.
- Describe Relay stop semantics accurately: no closing prompt after a stop, and a stop during the last card detail still sends the card to the connector. Update the matching sample comments. - Lead the first-run troubleshooting with internal-error, which a stopped tunnel or connector produces, and narrow payment-connector-error to no response at all. - Switch the TypeScript connector to validateWebhookSignature from @signalwire/sdk and move its highlight range. - Keep prose and tables generic to the Server SDKs: drop the per-language status webhook row and per-language option names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SignalWire pauses recordings on the paying call while it collects card details. Taps, streams, live transcription, and live translation keep receiving audio, so the PCI section now tells readers to stop them before pay and to pause recordings on any other call themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@Devon-White I've made the changes you requested. Could you take another look and re-review or approve when you have a moment? Thanks! |
Devon-White
left a comment
There was a problem hiding this comment.
Thanks, Manny. All five threads from my last review are addressed, and I checked the new PCI paragraph against platform behavior: recordings on the paying call are paused during collection, and taps, streams, live transcription, and live translation keep running, as the page now says. Two small follow-ups from the fixes below, then this is good to go.
Co-authored-by: Devon <86693904+Devon-White@users.noreply.github.com>
Co-authored-by: Devon <86693904+Devon-White@users.noreply.github.com>
Devon-White
left a comment
There was a problem hiding this comment.
Thanks, Manny. Both follow-ups are in: the TypeScript highlight now covers the signature check ({18-22}), and the recording card matches the PCI section. Approving. August's earlier change request still needs August to re-review before this can merge.
hey-august
left a comment
There was a problem hiding this comment.
Eight of my nine points are fixed, one is half fixed, and three new problems need one more round. Re-reviewed at 966bd17, with every sample run again on the current releases (Python 3.12.0, TypeScript 3.9.0) and every platform claim re-read against today's source. The guide is close: the prompt ranking, the result values, the signing scheme, the PCI claims, the stop semantics and both connector stubs all check out, and the split-character and forged-signature cases behave as the page says. The three blockers below are all small to fix, but two of them break the guide's own first run.
B = must fix, N = your call. Evidence is collapsed at the end.
B1. The signed URL is the normalised URL, not the string you passed — take-payments.mdx:115, :245-253, :270, :319, :378-381. The page says the signature covers the URL "exactly as you pass it" and tells readers to use the ngrok Forwarding URL "character for character". Before signing, the platform normalises the URL: a URL with no path gets a trailing /, the scheme is lowercased, and ./.. segments are resolved. The SWML pay reference on this same branch already says so (pay/index.mdx:530). ngrok prints a URL with no path, so a reader who follows the first run gets a 403 from the sample connector and internal-error on the call. Reproduced with both SDK helpers: they reject https://abc-123.ngrok-free.app against a signature over the same URL with a trailing /, and accept it with the slash. Fix: tell readers to give the connector a path (…/connector) or add the trailing /, and say the platform normalises the URL, pointing at the reference paragraph. The credential-stripping part of my earlier point is fixed everywhere.
B2. The page's agent result tells the agent a blank status — take-payments.mdx:2053-2085. The JSON has set before pay, and the sentence above it says the result "sets ai_response … then runs pay". set resolves ${pay_result} when it runs, and an unset variable resolves to nothing, so in that order ai_response becomes "The payment status is , do not mention…" before any card is collected; on a second payment in the same call it carries the previous result. The Python SDK emits pay then set, which works, so the Python tab doesn't produce the JSON shown. The TypeScript SDK emits set then pay, which the JSON matches, so the TypeScript tab produces a result that never reports the status. Fix: show the pay-then-set JSON and reword the sentence; for TypeScript, until the SDK is fixed, build the two-verb document yourself and pass it to executeSwml, or say the order is wrong on the current release. SDK issue: signalwire/signalwire-typescript#248. Verified from source; no live call.
B3. The TypeScript REST sample fails tsc --strict on 3.9.0 — take-payments.mdx:459 (swml, in the dial call; TS2741, the builder's build() type isn't the type dial expects). The PR body says all 12 TypeScript samples pass; it's 11. It runs as .mjs and sends the same body as Python and cURL, so JSON.parse(builder.render()), the form the other guides use since #908, is the one-line fix.
N1. validation-error can't happen on SWML or Relay — take-payments.mdx:1689. The row is accurate for the engine, but both surfaces reject an unsupported payment_method or bank_account_type before collection starts, so a reader of this guide never sees the value. Either say so or leave it.
N2. The sample connector body includes postal_code — :172-189, introduced as the fare from Payment options, where postal_code is "false" (:1223-1250). With it off, the key is omitted. Drop it from the body or say the postal code was collected.
N3. A declined card still hears "Payment completed" when the connector declines with an HTTP 200, which is what the page tells readers to do. Only the PR body mentions it. One sentence (override the payment-completed prompt, or expect the stock prompt before your own) would save readers a surprise. Filed for the platform as signalwire/cloud-product#22548.
N4. record-calls.mdx:692: the backlink is two sentences and names take_payment and takePayment outside code. Everything else in the guide is clean on per-language names.
N5. Out-of-range max_attempts and timeout fall back to the defaults silently — :1187-1188 give the limits without saying what happens outside them. Optional.
N6. PR body is stale: "Merge after #833" (merged Oct 28), the 3.4.1 / 2.0.5 pins, "the TypeScript connector checks with node:crypto" (it uses the SDK helper now), "add_verb/addVerb" for the security-code sample (it edits the built verb), and the two SWML-reference errors listed as unfixed (security_code is a string and prompts[].attempt is singular on this branch).
Outside this PR: the Relay call.pay reference pages still show await action.wait(), which never returns on current SDKs (#957). The Content redaction guide's pay example has the same set-before-pay order and boolean security_code / postal_code (#956).
What was checked
- Head
966bd17, 12 files, 46 fenced blocks on the guide (the other 11 files add none): 12 Python (py_compile, pyflakes, executed on 3.12.0), 12 TypeScript (tsc --stricton 3.9.0,node --checkas.mjsfor the 11 that claim it, executed), 15 JSON and 4 YAML parsed, 2 bashbash -n; the four builder families render identical documents. Both connector stubs ran as servers against signed requests: a charge, a zero-amount token, a forged signature (403), a non-ASCII body, and a body split mid-character on the socket (200 withsetEncoding, 403 without it). Relay samples ran against a fake Relay server emitting the progress and final events; REST samples against a stubbed HTTP layer. The Python connector ran against a stand-in for Flask, which isn't installed here. - Platform claims re-read at today's checkout: connector body and omitted keys, signing (headers, digests, credential stripping, normalisation), the success rule, every result value and its trigger, the progress and final event fields, defaults and limits, prompt ranking and ties, masking and keypad handling,
httpsenforcement, the PCI claims (recordings on the paying call pause; taps, streams, live transcription and translation keep running), Relay stop semantics (no canceled prompt; a stop during the last entry doesn't cancel). One backend change since the earlier review (connector credentials kept out of logs, variables expanded in the URL) changes nothing on the page. - Nine items from my earlier review: 1, 3, 4, 5, 6, 7, 8, 9 fixed; 2 partly (B1). For 7, neither SDK rejects an
http://URL before the call, so the troubleshooting path stays. - Links and anchors on the 12 files resolve; the page is in the folder-driven voice nav; the
llms.txtbullet points at the slug.yarn fern-md-checkpasses. #833 is merged and the two reference-page hunks apply cleanly. - Not verified: the mermaid and SVG renders (no renderer here), Dashboard labels and trial-mode limits, whether a call stays up after the Relay client disconnects, live behaviour of anything.
Devon-White
left a comment
There was a problem hiding this comment.
Re-reviewed at 4a85a79. The guide is unchanged since August's review on Nov 18; the only new commit merges main. I checked August's round-2 findings against the platform and the latest Server SDKs (signalwire-sdk 3.12.0, @signalwire/sdk 3.9.0). All three blockers hold, so this needs one more round before merge. Details and suggested text are inline.
Blocking
- B1, signed URL normalization (
:115,:249,:378-381). A bare ngrok URL fails the signature check on the guide's own first run. Append/instead of adding a path: the Flask connector only serves/. - B2,
setbeforepay(:2053-2085). The agent is told a blank status. Python 3.12.0 already emits the right order; TypeScript 3.9.0 doesn't (signalwire/signalwire-typescript#248). The inline comment has a TypeScript workaround that compiles. - B3, TypeScript REST sample (
:455-460). The only one of the 12 TypeScript blocks that failstsc --strict. One-line fix.
Should fix
validation-errorrow (:1689). It's stronger than August's N1: the case it describes ends asfailedin SWML and a rejected request in Relay. Move it to thefailedrow.- Sample body includes
postal_code(:182), though the options example turns it off. - A
200decline still plays "payment completed" (:211).
Agree with August, no inline comment
- N4: the
record-calls.mdx:692backlink namestake_payment/takePaymentoutside code; shorten it to one language-neutral sentence. - N6: the PR body is stale. It still has "Merge after #833", the 3.4.1/2.0.5 pins, "
node:crypto" for the TypeScript connector,add_verb/addVerb, and two reference errors already fixed on this branch. - Outside this PR: #956 (the redaction guide's
payexample) and #957 (Relaycall.payreferenceaction.wait()).
Checked and fine: the pay reference's normalization paragraph (pay/index.mdx:530) matches the platform. The other 11 TypeScript blocks pass tsc --strict. The pay_result usage in every SWML and Relay sample comes after pay. Not verified: live calls, and the deployed platform commit. I read the current source, not production.
| ngrok prints an `https://` **Forwarding** URL. That URL is your `<YOUR_PAYMENT_CONNECTOR_URL>`. | ||
| Use the same string, character for character, in the connector and in the call, because the | ||
| signature covers it. Keep the tunnel running while you test; a new tunnel usually means a new | ||
| hostname. |
There was a problem hiding this comment.
Blocking (August's B1, confirmed against the platform): a bare ngrok URL fails the signature check on the first run. Before signing, SignalWire normalizes the connector URL. A URL with no path is signed with a trailing /, the scheme is lowercased, and ./.. segments are resolved. User credentials are removed, the host's case is kept, and so is an explicit port. ngrok prints https://<id>.ngrok-free.app with no path, so a reader who copies it "character for character" signs .../ on SignalWire's side and checks against no slash on theirs. The connector returns 403 and the call ends in internal-error.
Adding a path such as /connector won't work here, because the Flask sample only serves @app.post("/") (line 277), so that would 404. Appending / works with both samples:
| ngrok prints an `https://` **Forwarding** URL. That URL is your `<YOUR_PAYMENT_CONNECTOR_URL>`. | |
| Use the same string, character for character, in the connector and in the call, because the | |
| signature covers it. Keep the tunnel running while you test; a new tunnel usually means a new | |
| hostname. | |
| ngrok prints an `https://` **Forwarding** URL. Add a trailing `/` to it, as in | |
| `https://<id>.ngrok-free.app/`, and use that as your `<YOUR_PAYMENT_CONNECTOR_URL>` in the connector | |
| and in the call. The signature covers the URL, and SignalWire signs a URL with no path as if it ended | |
| in `/`. Keep the tunnel running while you test; a new tunnel usually means a new hostname. |
| `X-SignalWire-Signature` header holds the lowercase hex HMAC-SHA1 of the connector URL you passed in | ||
| `payment_connector_url`, followed by the raw request body. If that URL carries credentials, as | ||
| `https://user:password@pay.example.com/` does, SignalWire removes them before signing and sends them | ||
| as HTTP Basic authentication instead, so the signed URL is `https://pay.example.com/`. An |
There was a problem hiding this comment.
Same normalization, stated once where the signature is defined. The pay reference on this branch already says this (pay/index.mdx:530), so the guide shouldn't say "exactly as you pass it". Suggest adding one sentence after the credentials sentence:
| as HTTP Basic authentication instead, so the signed URL is `https://pay.example.com/`. An | |
| as HTTP Basic authentication instead, so the signed URL is `https://pay.example.com/`. SignalWire | |
| also normalizes the URL before signing: a URL without a path gets a trailing `/`, the scheme is | |
| lowercased, and `.` and `..` path segments are resolved. An |
| | `<YOUR_API_TOKEN>` | Your API token with the Voice permission, used only in server code | | ||
| | `<YOUR_CALLER_ID>` | Your SignalWire phone number, or a [verified caller ID][caller-id], in E.164 format | | ||
| | `<YOUR_DESTINATION>` | The phone you'll answer, in E.164 format | | ||
| | `<YOUR_PAYMENT_CONNECTOR_URL>` | The public `https://` URL of your payment connector, exactly as you pass it in `payment_connector_url`. SignalWire signs requests against this string, minus any `user:password@` credentials in it. | |
There was a problem hiding this comment.
Same point for the placeholder row. "Exactly as you pass it" is what breaks the ngrok first run. Suggest:
| | `<YOUR_PAYMENT_CONNECTOR_URL>` | The public `https://` URL of your payment connector, exactly as you pass it in `payment_connector_url`. SignalWire signs requests against this string, minus any `user:password@` credentials in it. | | |
| | `<YOUR_PAYMENT_CONNECTOR_URL>` | The public `https://` URL of your payment connector, ending in `/` if it has no path. Use the same URL in `payment_connector_url` and in your connector, because SignalWire signs requests against it, minus any `user:password@` credentials. | |
| .say("The payment result is ${pay_result}.") | ||
| .build(); | ||
|
|
||
| const call = await client.calling.dial("<YOUR_CALLER_ID>", "<YOUR_DESTINATION>", { | ||
| swml, | ||
| }); |
There was a problem hiding this comment.
Blocking (August's B3, confirmed): this is the only TypeScript block of the 12 that fails tsc --strict on @signalwire/sdk 3.9.0: TS2741: Property 'sections' is missing in type 'Record<string, unknown>' but required in type 'SWMLObject'. build() is typed as a plain record, but dial's swml expects a document type. The parse form is what make-and-receive-calls and the other guides use since #908, and it compiles cleanly:
| .say("The payment result is ${pay_result}.") | |
| .build(); | |
| const call = await client.calling.dial("<YOUR_CALLER_ID>", "<YOUR_DESTINATION>", { | |
| swml, | |
| }); | |
| .say("The payment result is ${pay_result}.") | |
| .render(); // JSON text; parse it to pass the document object to dial() | |
| const call = await client.calling.dial("<YOUR_CALLER_ID>", "<YOUR_DESTINATION>", { | |
| swml: JSON.parse(swml), | |
| }); |
Please also update the PR body, which says all 12 pass.
| The tool returns this result. Its SWML sets `ai_response`, which tells the agent the payment's | ||
| `pay_result` once collection ends, then runs `pay` with your options and the SDK's defaults filled | ||
| in. To change what the agent is told, pass your own AI response to `pay`. |
There was a problem hiding this comment.
Blocking (August's B2, confirmed): set runs before pay, so the agent hears a blank status. SWML resolves ${pay_result} when set runs, not later. Here ai_response becomes "The payment status is , ..." before any card is collected, or carries the previous result on a second payment in the same call.
- Python (
signalwire-sdk3.12.0) now emitspaythenset, which works. So the JSON below doesn't match the Python tab. - TypeScript (
@signalwire/sdk3.9.0, still the case onmain) emitssetthenpay. That matches this JSON, and it's the broken order (FunctionResult.pay() emits set before pay, so ai_response reports a blank status signalwire-typescript#248).
Fixes:
- Put
payfirst andsetsecond in the JSON, and reword this sentence:
| The tool returns this result. Its SWML sets `ai_response`, which tells the agent the payment's | |
| `pay_result` once collection ends, then runs `pay` with your options and the SDK's defaults filled | |
| in. To change what the agent is told, pass your own AI response to `pay`. | |
| The tool returns this result. Its SWML runs `pay` with your options and the SDK's defaults filled | |
| in, then sets `ai_response`, which tells the agent the payment's `pay_result`. To change what the | |
| agent is told, pass your own AI response to `pay`. |
- For the TypeScript tab, until clean up #248 ships, build the two steps yourself. I checked that this passes
tsc --strictand emits["pay","set"]on 3.9.0:
handler: () =>
new FunctionResult("Collecting the payment now.").executeSwml({
version: "1.0.0",
sections: {
main: [
{ pay: { payment_connector_url: "<YOUR_PAYMENT_CONNECTOR_URL>", charge_amount: "24.50", description: "Bayview Taxi fare" } },
{ set: { ai_response: "The payment status is ${pay_result}." } },
],
},
}),That drops the SDK-filled defaults from the TypeScript output, so the JSON can show only the Python render. The other option is to keep .pay() and wait for the SDK fix before merging.
| | `too-many-failed-attempts` | An entry failed SignalWire's check, or timed out, on every one of the caller's `max_attempts` tries | | ||
| | `payment-connector-error` | SignalWire couldn't reach your payment connector, or got no response from it | | ||
| | `internal-error` | The payment didn't complete. When your connector declines the card or replies without a valid ID, `payment_error` is `card-declined`. | | ||
| | `validation-error` | The payment stopped before collection because `payment_method` or `bank_account_type` held a value SignalWire doesn't support | |
There was a problem hiding this comment.
More than "can't happen": this row sends readers to the wrong value. An unsupported payment_method or bank_account_type never reaches collection on either surface:
- SWML: a literal value fails document validation. A
${...}value is re-checked whenpayruns and ends asfailed, the row below. - Relay:
call.payis rejected with a 400, which the SDKs raise as an error.
So a reader branching on validation-error for this case never matches. The value exists only as a temporary state between retries, and every exit replaces it. Suggest dropping the row and adding the case to failed, for example "the pay method couldn't start the payment, for example because payment_method holds an unsupported value." Then the Relay troubleshooting text can mention the rejected request.
| "method": "credit-card", | ||
| "cardnumber": "4111111111111111", | ||
| "cvv": "123", | ||
| "postal_code": "94107", |
There was a problem hiding this comment.
Minor (August's N2, confirmed): this body is introduced as the fare from Payment options, and there postal_code is "false" (line 1238). With postal code collection off, SignalWire leaves the postal_code key out of the connector body. Drop this line, or introduce the body as one where the caller entered a postal code. If you drop it, the "Only included when collected" wording in the field table at line 201 is worth adding too.
|
|
||
| Reply with HTTP `200` and a JSON body. For a charge, return the processor's charge ID in | ||
| `charge_id`. For a zero amount, return the saved card's token in `token_id`. To decline, return | ||
| `error_code` and `error_message` with no ID. |
There was a problem hiding this comment.
Worth one sentence (August's N3, confirmed): the prompt the caller hears depends only on the HTTP status. Any 200, including a decline sent the way this paragraph says to, plays the stock "payment completed" prompt. Only after that is the result set to internal-error with card-declined. A reader testing a decline will hear "completed" and assume something is wrong. Suggest:
| `error_code` and `error_message` with no ID. | |
| `error_code` and `error_message` with no ID. The caller still hears SignalWire's payment-completed | |
| prompt for any `200` reply, so override the `payment-completed` prompt or follow it with your own | |
| message when the result isn't `success`. |
| | `max_attempts` | `1` | How many tries the caller gets at each entry, up to `3`. An entry that fails the check or times out uses a try. | | ||
| | `timeout` | `5` | How many seconds SignalWire waits for the caller's next key press before it checks the entry. The minimum is `3`. | |
There was a problem hiding this comment.
Optional (August's N5, partly confirmed): values outside these limits aren't rejected. Within validation, max_attempts of 0 or more than 3 becomes 1, and a timeout under 3 becomes 5. Negative values are rejected. One clause per row ("Values above 3 fall back to 1." / "Lower values fall back to 5.") saves readers a surprise when max_attempts: 5 quietly gives one try.
Sign the connector URL with a trailing slash, show pay before set in the agent result, fix the TypeScript REST sample under tsc --strict, move the unsupported payment_method case to the failed result, drop postal_code from the sample connector body, note the payment-completed prompt on a 200 decline, state the max_attempts and timeout fallbacks, and make the Record calls backlink language-neutral. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
@Devon-White the round-3 changes are in 03ad263.
Two things are unchanged. The PR description still needs its update. The SWML
|
Devon-White
left a comment
There was a problem hiding this comment.
Re-reviewed at 03ad263. All nine of my round-3 points are in, and I checked each against current platform and SDK source:
- Signed URL: the normalization sentence, the trailing-
/guidance (placeholder table, ngrok step, troubleshooting) and the Basic-auth note all match how SignalWire signs the connector URL. paythenset:@signalwire/sdk3.10.3FunctionResult.pay()now emitspaythenset, the same assignalwire-sdk, so the JSON on the page matches both SDKs and theexecuteSwmlworkaround isn't needed. Agreed.- TypeScript REST sample:
.render()returns the JSON string andJSON.parse(swml)is whatdial()needs. Good. validation-error→failed: right. An unsupportedpayment_methodorbank_account_typeis rejected beforepaystarts. In SWML a literal value fails document validation, and a value from a variable makespayfail, sopay_resultisfailed. On Relay,call.payreturns an error with nocalling.call.payevent. Nothing in practice reachesvalidation-error.- Connector body, 200 decline, limits: all correct. One small precision note is inline on the
max_attemptsrow.
Your question about the SWML pay reference: yes, change it in this PR. Otherwise the reference and the guide contradict each other on the same result value. Suggestion inline.
Still open before merge:
- The
payreference line (inline). - The PR description update.
- August's re-review, since the changes-requested review is his.
Not blocking: the strings "5", "1" and "0" for timeout, max_attempts and min_postal_code_length in the AI tool JSON are what both SDKs emit, and the platform reads them as strings. The SWML schema in the reference still types them as integer. That's tracked separately in #921, so leave it out of this PR.
Co-authored-by: Devon <86693904+Devon-White@users.noreply.github.com>
Closes #770. Part of #765.
Merge after #833. Both PRs edit the SWML
payand cXML<Pay>reference pages. This PR only adds a one-sentence backlink to each, so I'll rebase once #833 merges.Summary
voice/take-payments). It covers:FunctionResult.pay<Pay>is left out of the guide to keep the platform page SWML-native, and the<Pay>reference links to the guide instead.llms.txt"Secure payments" bullet now points to the guidepayreference, the cXML<Pay>reference, Relaycall.pay(Python and TypeScript),FunctionResult.pay(Python and TypeScript), the content redaction guide and Record callsNotes for reviewers
Relay
PayAction.wait()andon_completednever resolve forpayinsignalwire-sdk==3.4.1or@signalwire/sdk@2.0.5. The SDK waits for astatefield thatcalling.call.payevents don't carry. The guide's Relay samples wait for the finalcalling.call.payevent, the one carryingresult. The existing RelaypayandPayActionreference examples callaction.wait(), so they wait forever. That needs an upstream SDK fix and a reference update.A declined card still plays the "payment completed" prompt. The closing prompt plays on any HTTP 200 from the connector, so a decline returned as a 200 sounds like a success to the caller, while
pay_resultisinternal-errorwithpayment_error: card-declined. Worth raising with the platform team. The guide branches onpay_resultand doesn't rely on the prompt.REST:
calling.payandcalling.pay.stopwork throughPOST /api/calling/calls, but they aren't in the API spec, so the guide marks REST as unavailable. Adding them to the spec would be a follow-up.Connector signing and
token_id: the guide documents current platform behavior. Connector requests are signed withX-SignalWire-Signature, and the connector'stoken_idcomes back aspayment_token. Pay fixes (SWML + cXML) #833 currently says connector requests aren't signed; my review there suggests corrected wording. Both platform changes need changelog entries dated to when they shipped, which I'll add separately once the dates are confirmed.SWML
payreference errors that Pay fixes (SWML + cXML) #833 doesn't cover (not changed in this PR):security_codeis typed as a boolean, but the platform requires the strings"true"or"false".prompts[].attemptsshould beattempt.validation-erroris described as "Card details failed validation", but failed card checks end intoo-many-failed-attempts.Pay fixes (SWML + cXML) #833 already fixes the rest: the missing
parameters, the masked card in the connector request example, andpayment-completedbeing sent for declines.Other docs and SDK inconsistencies:
security_codeas a boolean, and the Python builder rejects"false"at runtime. The guide's "Skip the security code" example therefore usesadd_verb/addVerbfor that one field.security_codeandpostal_codeas booleans.validateWebhookSignaturereference page documents a function that@signalwire/sdk@2.0.5doesn't export. The TypeScript connector checks the signature withnode:crypto.Recording during collection: the guide doesn't claim that recordings pause automatically while card details are entered. It tells readers to pause recording and transcription themselves.
Rule drift:
.claude/rules/mdx-capability-guides.mdsaysplatform.ymllistspages/calling/pages explicitly. The voice folder is folder-driven now.Verification
yarn fern-md-check: all 2831 MDX files are valid. I didn't runyarn fern-check, since no yml or redirects changed.py_compileandpyflakesclean on all 12 files.tsc --strictclean on all 12 files, and each also passesnode --checkas.mjs.bash -n.slug:and every#anchorby hand. That includes the three guide anchors other pages link to:#build-a-payment-connector,#take-a-payment-from-an-ai-agentand#payments-and-pci-compliance.Preview URLs
/docs/platform/voice/take-payments/docs/platform/voice/docs/platform/voice/record-calls/docs/platform/ai/content-redaction/docs/swml/reference/calling/pay/docs/compatibility-api/cxml/reference/voice/pay/docs/server-sdks/reference/python/relay/call/pay/docs/server-sdks/reference/typescript/relay/call/pay/docs/server-sdks/reference/python/agents/function-result/pay/docs/server-sdks/reference/typescript/agents/function-result/pay🤖 Generated with Claude Code