PIEPA — Payment Instruction Envelope Protocol Agent
AI-assisted. Human-authorised. Independently verified.
Inspiration
Cross-border payments involve more than transferring money. A remittance system must establish who authorised a transaction, whether funding was genuinely received, whether the intended recipient and amount remain unchanged, and whether a payout has already been executed.
Artificial intelligence could make payment initiation and orchestration more accessible, but allowing an AI agent to independently control financial execution introduces significant risks.
PIEPA explores an alternative approach: AI assists with payment instructions, while independent verification and deterministic controls govern financial execution.
The project addresses a central question:
Can a genuine PayPal-hosted checkout be securely connected to an independently authorised, cryptographically signed payment instruction that permits exactly one simulated Philippine payout following verified funding?
What it does
PIEPA is an evidence-gated payment instruction and orchestration prototype.
It connects AI-assisted instruction creation, human authorisation, PayPal Sandbox checkout, independent payment verification and simulated Philippine payout execution into a single auditable transaction lifecycle.
The prototype demonstrates seven stages:
1. AI-assisted payment initiation
An operator enters the transaction amount, currency, purpose and intended Philippine recipient.
A locally running AI model drafts a structured payment instruction. Deterministic validation ensures that operator-authoritative information cannot be silently altered by the model.
2. Human authorisation
The proposed instruction is presented for operator review.
The transaction cannot proceed without explicit human approval.
3. Cryptographic signing
The approved payment instruction is cryptographically signed using Ed25519.
This establishes a verifiable relationship between the authorised instruction and subsequent transaction evidence.
4. PayPal-hosted checkout
PIEPA creates a PayPal Sandbox Order using the PayPal Orders v2 API.
The payer completes the payment through a genuine PayPal-hosted checkout experience.
5. Independent payment verification
PIEPA retrieves payment evidence directly from PayPal.
The system checks that the payment corresponds to the approved instruction and that the required payment capture has completed.
A browser redirect or a claimed successful payment is not sufficient to authorise the next stage.
6. Evidence-gated payout execution
Only after successful verification and satisfaction of the required authorisation controls can PIEPA execute a simulated Philippine payout.
Single-use authorisation and duplicate-execution protections prevent the same approved transaction from triggering repeated simulated payouts.
7. Transaction reconciliation
The instruction, human approval, cryptographic signature, PayPal transaction evidence and simulated payout result are linked in an auditable transaction record.
The transaction reaches a reconciled state only when the required evidence is consistent.
How we built it
PIEPA is implemented using JavaScript, Node.js, SQLite, HTML and CSS.
The core application incorporates:
- PayPal Sandbox and Orders v2 REST API integration.
- Ollama running the Qwen2.5-Coder 7B language model locally.
- AI-assisted structured instruction generation.
- Deterministic instruction validation and payment policy controls.
- Ed25519 cryptographic signatures.
- Persistent transaction and audit records.
- Independent payment verification.
- Single-use simulated payout authorisation.
- Transaction reconciliation and duplicate-execution safeguards.
OpenAI Codex assisted software development, implementation, debugging and automated testing.
The system deliberately separates AI-generated proposals from the authoritative transaction information supplied by the operator.
Challenges we ran into
One of the principal challenges was connecting a payment instruction to independently verified PayPal funding evidence without allowing an unverified checkout response to trigger execution.
Another challenge was ensuring that AI-generated instructions remained consistent with operator-supplied transaction details.
PIEPA also required safeguards against missing or mismatched PayPal Orders, incomplete captures, duplicate execution attempts and inconsistent transaction states.
Accomplishments that we're proud of
The prototype successfully demonstrated an end-to-end PayPal Sandbox transaction using a genuine GBP 1.00 test payment - as shown on the demo video. Previously, we have also tested a successful GBP 100.00 Sandbox transaction involving genuine Ollama drafting, explicit approval, Ed25519 signing, verified capture, one simulated payout and reconciliation
The verified workflow included:
AI-generated instruction → Human approval → Ed25519 signature → PayPal-hosted checkout → Independently verified completed payment capture → Deterministic payout authorisation → Exactly one simulated Philippine payout → Reconciliation.
The completed demonstration establishes the technical feasibility of connecting a PayPal-hosted checkout to an independently controlled payment instruction and simulated payout workflow.
No real Philippine payout or cross-border remittance was performed.
What we learned
The challenges reinforced an important design principle:
AI can help determine what a payment instruction should say, but it should not independently determine whether money is authorised to move.
What's next for PIEPA — Payment Instruction Envelope Protocol Agent
PIEPA is a proof of concept for a potentially broader payment orchestration protocol.
Future development could explore integration with regulated payout providers, additional payment collection methods, improved transaction recovery, institutional payment workflows and business-to-business APIs.
An important area for further investigation is whether PayPal-hosted payment collection could support a commercially authorised cross-border remittance service when combined with appropriate regulatory permissions and licensed payout partners.
The hackathon prototype does not establish commercial or regulatory authorisation for such a service.
Our Core Principle
AI proposes. Humans authorise. Independent evidence verifies. Deterministic controls execute.