Validate my Yuno VTEX headless wallet integration following CLAUDE.md.It audits the app against the deferred preflight contract for wallets on VTEX headless (Google Pay, Apple Pay, Click to Pay), described in the flow below, and reports what is wrong, with file and line. It only reads code — it changes nothing unless you ask.
The flow being validated
/session/preflight/payments has
stored the body with the token. The payment does not exist in Yuno until Step 8, so the SDK listener never
reports a payment status in this flow (status=null after the token is expected). The outcome comes from
VTEX (check 16).
Endpoints live on the VTEX store host: https://<store-host>/_v/<connector-app>/v4.
Checks
Report each one as PASS / FAIL / N/A with the evidence (file:line). Do not assume a check passes because the code “looks right” — quote the line that proves it.1. The hand-off happens only after the OTT
The single most common defect./session/preflight/payments must be called from inside the listener
callback, with a non-empty token, never before startPaymentLite and never on a timer.
- Find the
YunoPaymentListener(orYuno.startPaymentLitecaller) and follow wherestate.tokengoes. - FAIL if the preflight-payments call is reachable without a token, sends
token: ''/null, or runs in the same function that callsstartPaymentLite, before any event. - FAIL if the VTEX order (Steps 6–8) can be placed before the hand-off returns
{ deferred: true }, or if the token is sent to/payments/yuno(the Payment App route) instead of/session/preflight/payments. - Why: the connector accepts a token-less body and answers
{ deferred: true }; the failure only surfaces at authorization, as a denied order withDeferred preflight payment creation failed. An app that places the order first, sends a token-less hand-off and then posts the token to/payments/yunocan complete a payment, but only while the authorization happens to arrive before the hand-off; the day it arrives after, the connector uses the token-less body and the order is denied.
2. createPaymentInAuth: true
Must be in the /session/preflight/payments body. Without it the payment is created immediately, before a VTEX
order exists.
3. The SDK is initialized with exactly the key preflight returned
Yuno.init(apiKey: …)must receive thepublicApiKeyfrom that same preflight response.- FAIL on: a hardcoded key, a key from
.env/remote config/build flavor, orYunoSdkAndroidPlugin.initSdk(...)in anApplicationclass with a different key. - Search every initialization point:
grep -rn "Yuno.init\|initSdk\|YunoSDK.initialize" lib android ios. When the SDK is initialized more than once, the first one usually wins on iOS — a stale key there makes the session’s first calls fail 401 and the wallet closes with no message.
4. Payment method type matches what VTEX authorizes
payment_method.type (APPLE_PAY / GOOGLE_PAY / CLICK_TO_PAY) must correspond to the VTEX payment method
the order is placed with (Apple Pay / Google Pay / C2P). Check the paymentSystem used in Step 5 /
Step 7 against the type sent in the hand-off. A mismatch makes the connector ignore the stored payment.
5. Amount, currency and country are identical in preflight and hand-off
- The amount is a JSON number in decimal units (
845.90), not cents (84590) and not a string. - The same triple
amount:currency:countrygoes to both calls; it is fingerprinted. A mismatch is409. - FAIL if the amount is read from a different source in the two calls (e.g. cart total vs order total), or if either call happens before the cart total is final.
6. The total is locked before preflight, and the flow restarts if it changes
Shipping, coupons and installments must all be resolved before/session/preflight. If the total changes after
it, the app must tear the SDK down and rerun from preflight with the new session. FAIL if the code can change
the cart while a session is live without recreating it.
7. One store host per order
Preflight, preflight/payments and the order placement must use the same VTEX account host. FAIL if the connector base URL and the checkout base URL point at different accounts.8. showPaymentStatus is off
startPaymentLite(..., showPaymentStatus: false). The outcome lives in the VTEX order, not in the SDK’s screen
(check 16).
9. The listener is mounted before the wallet starts, and stays mounted
YunoPaymentListener must wrap a widget that is alive for the whole flow. FAIL if it is created inside a
dialog/bottom sheet that the wallet sheet can dispose, or if startPaymentLite can run before the widget is
built. Log every event, not just the token:
state.substatus and state.message need yuno >= 1.0.19 and are what a support ticket should carry.
10. Split orders are not offered with wallets
A cart fulfilled by more than one seller becomes several VTEX orders, and one wallet token cannot cover them. FAIL if wallets are offered without checking the cart can produce a single order.11. Installments (only if offered, Apple Pay / Google Pay)
/installments/apmis called after preflight, with that session’scheckoutSession+publicApiKey, once per wallet, withcountryand a fulllocale(pt-BR).- The chosen count travels as
payment_method.detail.card.installmentsin the hand-off body — never withCLICK_TO_PAY, and the amount stays the order total. - Empty list, error or timeout must all render no selector and let the wallet proceed. FAIL if the checkout is blocked by this call.
12. Native setup
- Android:
MainActivityextendsFlutterFragmentActivity; the Yuno Maven repo is inallprojects; on Kotlin 2.x the Compose compiler plugin is applied (extra["kotlin_version"]set for the plugin to detect it) and the:yunomodule’scompileSdkis 35+. - iOS: deployment target 14+,
ios/Runner/Runner.entitlementshascom.apple.developer.in-app-paymentslisting the merchant ID registered with Yuno for this affiliation, and the App ID has the Apple Pay capability. Report the merchant ID found so it can be compared with the Yuno side.
13. Testing on real builds
Wallets cannot be validated on a simulator/emulator or a debug build: Google Pay needs the release keystore registered in the Google Pay & Wallet Console, Apple Pay a signed build with the entitlement above. FAIL if the test instructions in the repo say otherwise.14. SDK version
yuno in pubspec.yaml. Report the resolved version and the native versions it pins
(~/.pub-cache/hosted/pub.dev/yuno-<v>/android/build.gradle and ios/yuno.podspec), since wallet behavior is
decided by the native SDK, not the Dart layer.
15. The native SDK reaches the token service (runtime, signed build)
Nothing in the app code can prove this: the one-time token is requested by the native SDK, not by Dart. Run one attempt on a signed build with the device traffic captured (Proxyman / Charles with the iPhone or Android device proxied, SSL proxying enabled for*.y.uno), complete the wallet sheet, and report which of
these calls to the Yuno API appear after startPaymentLite, in order:
- the wallet setup call — Apple Pay:
.../payments/transactions/APPLE_PAY(merchant session); Google Pay: the config/sdkcalls before the sheet opens .../wallet/decrypt— the wallet payload came back from the sheet and was handed to Yuno- the token creation call (
.../tokenor.../one-time-token) — the OTT exists
- Only 1 → the sheet never returned a payment: entitlement / merchant ID mismatch (check 12) or the user cancelled. Not an SDK defect.
- 1 and 2, no 3 → the native SDK stopped between decrypt and token. Report the version pair (check 14).
- 1, 2 and 3, but the listener logged no token (check 9) → the plugin’s MethodChannel dropped it.
- All three and the listener logged the token → the SDK side is fine; the problem is in the hand-off (check 1).
enable_logs_ios / enable_logs_android on the Yuno account also print these calls from the SDK, but they
are off by default, so the proxy capture is the reliable option. Never paste the capture in a public channel:
the decrypt and token bodies carry card data.
16. The outcome is read from VTEX, not from the listener
After the hand-off, the app must not wait forstate.paymentStatus: it stays null in this flow. The result
comes from Step 8 and the order:
After a 2xx,
GET /api/checkout/pub/orders/order-group/{orderGroup} and decide from each order’s status:
payment-approved (or any later state) is success, payment-pending means the payment is still being
processed.
- FAIL if the success/failure screen depends on a listener status, or if a 2xx is treated as approved without reading the order.
- FAIL if the app can leave the shopper on a loader after the result is known: with
keepLoader: truein the SDK config,Yuno.hideLoader()must be called once the outcome is decided.
Report format
Diagnostics to capture from a failing device run
When the checks pass and the wallet still does not complete, capture and send:- The
checkoutSessionfrom the preflight response, and the UTC timestamp of the attempt. - Every listener line from check 9 —
paymentStatus,substatusand the fullmessagemap. - The device model and OS version, the app build (release/debug) and the
yunoversion. - Whether the native wallet sheet appeared, and what it showed when it closed.
- The VTEX
orderGroup, thegatewayCallbackHTTP status and body, and the order status read afterwards.