Buy and send a prepared certified letter
authorize_certified_letterBuys and sends a letter that prepare_certified_letter prepared IN THIS CONVERSATION, after the person approved the exact total here. Call it only when (1) you have told the person the exact total, the recipient and the service, and they said yes to that total in this conversation, and (2) your platform has given you a Stripe shared payment token (spt_...) granted to Piloxa for that amount. Piloxa holds the payment, hands the letter to the printer, and charges only once the printer accepts it; if the printer refuses, the hold is released and nothing is charged. ALWAYS pass one idempotency_key per purchase and reuse it on every retry: the same key never charges twice and returns what already happened. If the total, the document or the address changed since the person approved, nothing is charged and you must ask again. Without a token, or if paying here is unavailable, nothing is charged and approval_url is returned: give it to the person, who pays there. The result carries transaction_state: AWAITING_APPROVAL, AUTHORIZED, VENDOR_ACCEPTED, MAILED, DELIVERED, RETURNED, FAILED or CANCELLED. Say a letter was sent only at VENDOR_ACCEPTED or later. At AUTHORIZED with failure OUTCOME_UNCERTAIN, do NOT retry: call get_certified_letter_status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailing_id | Yes | The mailing_id prepare_certified_letter returned in this conversation. | |
| payer_email | Yes | Where the receipt, the tracking and the mailing record go. | |
| user_approved | Yes | True only when the person explicitly approved this exact total, recipient and service in this conversation. | |
| document_sha256 | No | Optional: the document_sha256 prepare_certified_letter returned. If the document changed since, nothing is charged. | |
| idempotency_key | Yes | One key per purchase, 16 to 100 letters, digits or _ . : -. Reuse the same key on every retry of this purchase; a new key is a new purchase attempt. | |
| approval_statement | No | The words the person was shown and said yes to, for the record, e.g. "Send this letter to Acme Property Management by USPS Certified Mail with return receipt for" followed by the exact total. | |
| expected_total_cents | Yes | The exact total the person approved, in cents: the total_cents or estimated_total_cents Piloxa returned. If the current total differs, nothing is charged. | |
| shared_payment_token | No | A Stripe shared payment token (spt_...) your platform issued to Piloxa for this purchase, limited to the approved amount. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mailed | Yes | ||
| charged | Yes | ||
| failure | No | ||
| receipt | No | ||
| service | No | ||
| currency | No | ||
| replayed | No | True when this answers an earlier call with the same idempotency key, or a purchase already under way. | |
| recipient | No | ||
| reference | No | The Piloxa mailing reference, once the letter exists as a mailing. | |
| mailing_id | No | ||
| amount_cents | No | ||
| approval_url | No | Where the person can review and pay instead. | |
| practice_run | No | ||
| state_meaning | No | ||
| document_sha256 | No | ||
| amount_held_cents | No | ||
| printer_reference | No | ||
| transaction_state | Yes | ||
| amount_charged_cents | No | ||
| usps_tracking_number | No |