Skip to content
Back to Prompts

Integrate Dfns with BlindPay

Fund BlindPay stablecoin payouts from Dfns MPC wallets: sign the registration challenge and the ERC-20 approve through Dfns's User Action Signature flow.

Payouts
Quotes
Compliance

Paste this prompt into your coding agent when funds live in Dfns wallets and need to fund BlindPay payouts.

Prompt

text
You are integrating BlindPay payouts funded from Dfns MPC wallets into my application. Dfns holds the key shares for our wallets; my server calls the Dfns API to sign and broadcast on their behalf.

Before writing code, read these sources and follow them over any prior knowledge:
- https://blindpay.com/docs/llms.txt (read the blockchain wallets page and the EVM payouts guide)
- The OpenAPI spec: curl https://api.blindpay.com/doc
- https://docs.dfns.co/d/api-docs/wallets/generate-signature-from-wallet
- https://docs.dfns.co/d/api-docs/wallets/broadcast-transaction
- https://docs.dfns.co/d/api-docs/authentication

Build the flow:
1. Call GET /v1/instances/{instance_id}/customers/{customer_id}/blockchain-wallets/sign-message to get the registration challenge, hex-encode it, and sign it with the Dfns wallet via POST /wallets/{walletId}/signatures using {"blockchainKind":"Evm","kind":"Eip191","message":"0x<hex>"}, authenticated with the Dfns Service Account Token bearer header plus an X-DFNS-USERACTION header built from the User Action Signature flow (submit the intent, sign the returned challenge with the registered credential, attach the signature). Confirm the exact User Action Signature request/response shape against docs.dfns.co/d/api-docs/authentication rather than assuming a field layout. Take the resulting signature, call POST /v1/instances/{instance_id}/customers/{customer_id}/blockchain-wallets, and persist the returned bw_ ID against the customer record.
2. Request a quote with POST /v1/instances/{instance_id}/quotes for the bank_account_id, network, and token, and hold the contract object (address, abi, functionName "approve", blindpayContractAddress, amount, network) exactly as returned in the response, ready to build the approve calldata in step 3.
3. Build the ERC-20 approve calldata from that contract object and send it through POST /wallets/{walletId}/transactions with {"kind":"Transaction","transaction":{"to":"<token contract address>","data":"<approve calldata>","maxFeePerGas":...,"maxPriorityFeePerGas":...},"externalId":"<idempotency key>"}, again with the bearer token and a fresh X-DFNS-USERACTION header. Poll the returned transaction-request ID until its status reaches Confirmed before moving on, and treat Failed or Rejected as a stop condition that surfaces to the caller.
4. Call POST /v1/instances/{instance_id}/payouts/evm with quote_id and sender_wallet_address before the quote's expires_at (about 5 minutes). If Dfns's Pending to Confirmed cycle (plus any policy-engine approval delay on the transaction) eats into that window and the quote expires first, re-quote and reuse the existing on-chain allowance when it already covers the new amount instead of re-approving from zero.
5. Verify a Svix-signed webhook handler (svix-id, svix-timestamp, svix-signature against the whsec_ secret, HMAC over the raw body) updates payout state on payout.new, payout.update, and payout.complete, and run the full flow end to end on a development instance with USDB on base_sepolia, including one payout at $666.00 (66600 minor units) that lands in failed and one at $777.00 (77700) that lands in refunded.

Constraints:
- Keep the Dfns Service Account Token and the BlindPay API key server-side only; never expose either to a browser or mobile client.
- Carry all amounts as integer minor units through both the BlindPay and Dfns calls; never do floating-point money math.
- If Dfns's docs describe a policy engine or approval workflow on your account, check whether transaction requests require a second approver before Confirmed, since that adds directly to the quote-expiry race in step 4.

Deliverables: the wallet registration flow (challenge signing plus bw_ persistence), the approve-and-poll module built on POST /wallets/{walletId}/transactions, quote-execute orchestration with the expiry race handled, the Svix webhook handler, and a passing end-to-end test against the development instance covering the two sentinel amounts.

How to use

  1. Swap in your Dfns Service Account Token and confirm your account's User Action Signature setup (which credential type signs challenges) before running the agent.
  2. Ask your Dfns account team whether policy-engine approvals are enabled on transaction requests; if so, have the agent widen the re-quote path since Confirmed will take longer.
  3. Run the development-instance test with both sentinel amounts before pointing the integration at a production instance.

One API.
Multiple payment rails.

Blind Pay, Inc. (“BlindPay”) is a United States-based financial technology and payments infrastructure company, incorporated in the State of Delaware on May 2, 2024. BlindPay is duly registered as a Money Services Business (“MSB”) with the Financial Crimes Enforcement Network (“FinCEN”) under registration number 31000277566153. BlindPay is not a state-licensed money transmitter and does not, in its own capacity, engage in regulated money transmission services. All such regulated activities are conducted exclusively through, and under the licenses of, duly authorized financial institution partners. BlindPay's role is limited to providing financial technology, virtual account management, payment processing, and related payments infrastructure services that facilitate payment flows and account functionalities. These services are provided in coordination with its licensed partners and in compliance with applicable federal MSB requirements and relevant state regulatory frameworks.

Blind Pay, LLC (“BlindPay”) is a Delaware limited liability company formed on June 24, 2025. BlindPay is duly registered as a Money Services Business (“MSB”) with the Financial Crimes Enforcement Network (“FinCEN”) under registration number 31000318334247 and is listed in the Nationwide Multistate Licensing System (“NMLS”) under NMLS ID #2745309.

BLIND PAY SOCIEDADE PRESTADORA DE SERVIÇOS DE ATIVOS VIRTUAIS LTDA. (“BlindPay”) is a Virtual Asset Service Provider (“VASP”) operating in Brazil. The company is presently completing the regulatory adaptation process required of Virtual Asset Service Provider Companies (SPSAV) under Central Bank of Brazil Resolution No. 520/2025, and remains subject to the transitional regime set forth in Article 88 of that Resolution. Registered address: Avenida Princesa Isabel, nº 15, Sala 1405, Edifício Martinho de Freitas, Centro, Vitória/ES, 29010-361.

BlindPay is a stablecoin API that enables individuals and businesses to move money worldwide.