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. SDK:
@yuno-payments/yuno-sdk-react-native (docs).
The integration used here is the Lite SDK (startPaymentLite), not Full Checkout, Seamless or Headless.
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 onPaymentStatus never
reports a payment result in this flow. 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
onOneTimeToken (or onOneTimeTokenInfo) callback, with a non-empty token, never before
startPaymentLite and never on a timer.
- Find the
YunoSdk.onOneTimeToken/onOneTimeTokenInfosubscription (or theYunoSdk.startPaymentLitecaller) and follow where the token goes. - FAIL if the preflight-payments call is reachable without a token, sends
token: ''/null/undefined, or runs right afterawait YunoSdk.startPaymentLite(...). That promise resolves when the wallet starts, not when it finishes; it never carries the token. - 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. - FAIL if the hand-off can run twice for one attempt. The SDK wires two native callbacks to the same
YunoOneTimeTokenevent, so the event can arrive more than once with the same token, and subscribing to bothonOneTimeTokenandonOneTimeTokenInfodoubles it again. Guard it (a ref holding the token already handed off) so the order is placed once. - 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
YunoSdk.initialize({ apiKey, countryCode })must receive thepublicApiKeyfrom that same preflight response.- Search every initialization point, JavaScript and native:
grep -rnE "YunoSdk\.initialize|YunoSdkModule\.initialize|Yuno\.initialize|markAsInitialized" --include='*.ts' --include='*.tsx' --include='*.js' --include='*.kt' --include='*.java' --include='*.swift' --exclude-dir=node_modules --exclude-dir=Pods --exclude-dir=.git --exclude-dir=build . - The first initialization of the process is the one that counts. On Android this is certain: once the
SDK is initialized,
YunoSdk.initializefrom JavaScript returns without touching the native SDK, so a later call with the preflight key changes nothing. Treat iOS the same way. - FAIL on: a key hardcoded in
App.tsx, a key from.env/ remote config / build flavor, orYunoSdkModule.initialize(this, "<key>")inMainApplication.onCreate(), unless that value is proven to be the same key preflight returns for this store and environment. The SDK’s setup guide asks for that native call, so most Android apps have it: report the key’s environment prefix (sandbox_,prod_, never the full value) next to the prefix of the key preflight returns. - FAIL if the store uses more than one Yuno affiliation (preflight called with
affiliationName) and the app expects to switch keys between orders: the second key is ignored until the app restarts. - A stale key makes the session’s first calls fail 401 and the wallet closes with no message.
4. Payment method type matches what VTEX authorizes
methodSelected.paymentMethodType and the hand-off’s payment_method.type (APPLE_PAY / GOOGLE_PAY /
CLICK_TO_PAY) must be the same value, and 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.
- The
countryCodegiven toYunoSdk.initializeand tostartPaymentLiteis that same country. FAIL if it is a constant while the store sells in more than one country.
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 rerun from preflight and start the wallet with the new checkoutSession. 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 }). It defaults to true when omitted, so FAIL if the field
is missing. The outcome lives in the VTEX order, not in the SDK’s screen (check 16).
9. The listeners are subscribed before the wallet starts, and stay subscribed
The token arrives as a native event. A subscription that does not exist at that instant misses it: on iOS nothing stores the token, so it is lost.- FAIL if
onOneTimeTokenis subscribed afterstartPaymentLite, inside the same handler that starts the wallet, or in a component that can unmount while the wallet sheet is open (a modal or bottom sheet, a screen that navigates away). - FAIL if a subscription is never removed (
subscription.remove()in the effect cleanup): a screen mounted twice then hands off twice. - Android only:
YunoSdk.getLastOneTimeToken()returns the token of the current attempt when the event was emitted while JavaScript was paused (it is cleared whenstartPaymentLitestarts). Reading it when the app returns to the foreground without a token is a valid recovery. On iOS it always returnsnull.
state.status as a string and handle both spellings: the platforms do not
emit the same values (iOS CANCELLED_BY_USER / PROCESSING / INTERNAL_ERROR, Android CANCELLED /
PENDING / ERROR), and the YunoStatus enum only lists the iOS ones. FAIL if closing the wallet sheet is
detected with YunoStatus.CANCELLED_BY_USER alone.
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
- The app is not running in Expo Go: the SDK is a native module and needs a development build or a bare
project. Report how the native projects are produced (bare,
expo prebuild, EAS). - Android:
- the Yuno Maven repo (
https://yunopayments.jfrog.io/artifactory/snapshots-libs-release) is in the project-level repositories; minSdkVersion21+,compileSdkVersion35+, Java 17, Kotlin 1.9.24+. Report the Kotlin version: the SDK module uses Jetpack Compose with the compiler extension for Kotlin 1.9, so on Kotlin 2.x report whether the module builds;YunoSdkModule.initialize(...)inMainApplication.onCreate()(its key is judged in check 3);YunoSdkModule.registerYunoCallbacks(this)inMainActivity.onCreate()beforesuper.onCreate(). It is what delivers payment status events on Android; without it a wallet sheet the shopper closed is invisible to the app. Report whether it is present.
- the Yuno Maven repo (
- iOS:
platform :ios, '14.0'or higher in thePodfile, the app’s.entitlementsfile hascom.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. With Expo, the entitlement comes fromios.entitlementsin the app config.
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-payments/yuno-sdk-react-native in package.json. Report the version the lockfile resolves and the
native versions it pins, since wallet behavior is decided by the native SDK, not the JavaScript layer:
- Android:
com.yuno.payments:android-sdkinnode_modules/@yuno-payments/yuno-sdk-react-native/android/build.gradle - iOS:
YunoSDKinnode_modules/@yuno-payments/yuno-sdk-react-native/YunoSdkReactNative.podspec(YunoSdk.podspecup to 1.3.0), and the version actually installed inios/Podfile.lock
FAIL if
Podfile.lock holds a different YunoSDK than the podspec pins (pod install not rerun after the
upgrade).
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 JavaScript. 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 → the event was emitted with nobody subscribed (check 9). On
Android, read
YunoSdk.getLastOneTimeToken()to confirm the token existed. - All three and the listener logged the token → the SDK side is fine; the problem is in the hand-off (check 1).
adb logcat | grep -i yuno, the Xcode console on iOS), and
enable_logs_ios / enable_logs_android on the Yuno account print these calls from the native 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 foronPaymentStatus: no payment result arrives 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
onPaymentStatus, oncontinuePayment, or onstartPaymentSeamlessLite’s return value, or if a 2xx is treated as approved without reading the order. - FAIL if the app shows nothing between the token and the outcome. The SDK closes its UI once the token is
issued (
keepLoaderhas no effect in SDK 1.4.0, andhideLoader()does nothing on Android), so the progress state is the app’s own, and the pay button must stay disabled until the outcome is known.
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, in order, plus the native console lines that mention Yuno. The React Native events carry the status only; the sub-status and message exist only in the native logs.
- The device model and OS version, the app build (release/debug), the React Native version and architecture (old / new), and the SDK versions from check 14.
- 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.