On this page:
verify-alipay-return-query
reconcile-alipay-signed-return!

20 Alipay lost-notification reconciliation🔗ℹ

 (require commerce/alipay/reconcile) package: commerce

This explicit server-side candidate moves no money. ADR-0025 requires two independent provider signatures; a redirect alone never authorizes use.

procedure

(verify-alipay-return-query raw-return    
  raw-query    
  public-key-pem    
  binding) → payment-event?
  raw-return : bytes?
  raw-query : bytes?
  public-key-pem : string?
  binding : alipay-binding?
Authenticates the original page-return form and signed trade query, checks merchant, order, trade and exact amount, and requires TRADE_SUCCESS. Derives the payment time only from the query’s signed send_pay_date. Each input is bounded to 65536 bytes. GBK returns are limited to ASCII fields; ambiguous non-ASCII GBK inputs fail closed. Does not write storage or sign rights.

procedure

(reconcile-alipay-signed-return! storage 
  raw-return 
  public-key-pem 
  binding 
  #:fetch-query fetch-query 
  [#:received-at received-at]) 
 → journal-acceptance?
  storage : commerce-storage?
  raw-return : bytes?
  public-key-pem : string?
  binding : alipay-binding?
  fetch-query : procedure?
  received-at : exact-nonnegative-integer? = (current-seconds)
Requires an existing immutable checkout binding and authenticates the original return before calling fetch-query with the binding. That procedure must independently read the official order, for example through the configured Alipay query client. Journal acceptance preserves exact return and query bytes. Retries re-authenticate original evidence and reuse the original record only when all canonical facts agree. Projection and issuance remain asynchronous; the issuer must configure its own trusted merchant identifiers and re-verify both signatures. The product owns authenticated invocation and capture of the original signed return; no public endpoint or query-only grant is supplied.