Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Commit 96c515e

Browse files
hyochanclaude
andcommitted
fix(ios): preserve duplicate-purchase error code through normalization
The purchaseErrorNativeHandler was normalizing all error codes via normalizeErrorCodeFromNative(), which converted 'duplicate-purchase' to 'unknown' since it's not in the ErrorCode enum. This caused isDuplicatePurchaseError() to always return false. Closes #3180 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 4309980 commit 96c515e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {parseErrorStringToJsonObj} from './utils/error';
5555
import {
5656
normalizeErrorCodeFromNative,
5757
createPurchaseError,
58+
DUPLICATE_PURCHASE_CODE,
5859
} from './utils/errorMapping';
5960
import {RnIapConsole} from './utils/debug';
6061
import {getSuccessFromPurchaseVariant} from './utils/purchase';
@@ -230,7 +231,10 @@ const purchaseErrorJsListeners = new Set<(error: PurchaseError) => void>();
230231
let purchaseErrorNativeAttached = false;
231232
const purchaseErrorNativeHandler: NitroPurchaseErrorListener = (error) => {
232233
const normalized: PurchaseError = {
233-
code: normalizeErrorCodeFromNative(error.code),
234+
code:
235+
error.code === DUPLICATE_PURCHASE_CODE
236+
? (DUPLICATE_PURCHASE_CODE as unknown as ErrorCode)
237+
: normalizeErrorCodeFromNative(error.code),
234238
message: error.message,
235239
productId: undefined,
236240
};

0 commit comments

Comments
 (0)