# paymentMethod.tokenize(verificationDetails) returns unknown error

**URL:** <https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687>\
**Category:** Questions\
**Tags:** sandbox, web-payments-sdk\
**Created:** [March 30, 2025, 6:44am UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687 "2025-03-30T06:44:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![shugyoku-style](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shugyoku-style](https://developer.squareup.com/forums/u/shugyoku-style)\
**Post date:** [March 30, 2025, 6:44am UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/1 "2025-03-30T06:44:13Z")

</div>

I’m trying to implement web payment API with EMV 3D secure to my web store.  
I’m not sure the reason, but paymentMethod.tokenize(verificationDetails) returns unknown error on sandbox environment.

The code is almost identical with sample code, like this,

```auto
	const verificationDetails = {
	amount: '10.00',
	billingContact: {
		givenName: 'John',
		familyName: 'Doe',
		email: 'john.doe@square.example',
		phone: '3214563987',
	},
	currencyCode: 'JPY',
	intent: 'CHARGE',
	customerInitiated: true,
	sellerKeyedIn: false
	};
	const tokenResult = await paymentMethod.tokenize(verificationDetails);
	if (tokenResult.status === 'OK') {
		return tokenResult.token;
	} else {
		let errorMessage = `Tokenization failed with status: ${tokenResult.status}`;
		if (tokenResult.errors) {
			errorMessage += ` and errors: ${JSON.stringify(
				tokenResult.errors
			)}`;
		}
		throw new Error(errorMessage);
	}

```

It works without 3D secure, means tokenize() works without argument.

Javascript console said,

```auto
Tokenization has faild.
An unknown error has occurred.
(Anonymous Funcion) - square.js:5826
...

```

Any ideas?

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [March 31, 2025, 3:46pm UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/2 "2025-03-31T15:46:02Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[Sandbox Payments](https://developer.squareup.com/docs/devtools/sandbox/payments)**
>
> A quick reference of test credit card numbers and payment tokens you can use to make test payments with the Square Sandbox.

> **[Square Sandbox](https://developer.squareup.com/docs/devtools/sandbox/overview)**
>
> An overview of the Square Sandbox, which can be used to simulate orders, invoices, payments, and transactions in a test environment.

> **Additional Documentation**
>
> [Test in the Sandbox](https://developer.squareup.com/docs/devtools/sandbox/testing)  
> [Square Developer](https://developer.squareup.com/docs/app-marketplace/requirements/web-payments-sdk)  
> [Troubleshoot In-App Payments SDK Problems](https://developer.squareup.com/docs/in-app-payments-sdk/troubleshooting)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [March 31, 2025, 4:26pm UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/3 "2025-03-31T16:26:19Z")

</div>

What test value are you using when you get this error? 🙂

---

<div class="post-metadata">

**Author:** ![shugyoku-style](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shugyoku-style](https://developer.squareup.com/forums/u/shugyoku-style)\
**Post date:** [March 31, 2025, 9:53pm UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/4 "2025-03-31T21:53:14Z")

</div>

I used “SCA testing in the Web Payments SDK” values on the document, but I think this error is not related to the specific test value.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [March 31, 2025, 10:09pm UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/5 "2025-03-31T22:09:20Z")

</div>

Which one did you use so I can try and replicate the error? 🙂

---

<div class="post-metadata">

**Author:** ![shugyoku-style](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shugyoku-style](https://developer.squareup.com/forums/u/shugyoku-style)\
**Post date:** [April 1, 2025, 12:19am UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/6 "2025-04-01T00:19:47Z")

</div>

Visa 4800 0000 0000 0004 or Mastercard 5222 2200 0000 0005.

I’ve got same error, I mean it happened at the same line of square.js, line 5826.  
just line number, I could not get the exact reason of error.

FYI, same code works at production environment.

---

<div class="post-metadata">

**Author:** ![shugyoku-style](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shugyoku-style](https://developer.squareup.com/forums/u/shugyoku-style)\
**Post date:** [April 7, 2025, 12:55am UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/7 "2025-04-07T00:55:32Z")

</div>

more infomation about this error.  
following error messages are catched by code like this.

```
    try {
        const tokenResult = await paymentMethod.tokenize(verificationDetails);
    } catch (e) {
        console.error('Tokenization failed - thrown error', e);
        throw new Error('Tokenization failed - thrown error');
    }

```

[Javascript Console]  
Tokenization failed - thrown error  
TokenizationError: Tokenization has failed An unknown error has occurred  
Vn — square.js:8323  
Ti — square.js:8714  
xo — square.js:9216  
(anonymous function) — square.js:14257:86  
\_d — square.js:14003  
s — square.js:14020

---

<div class="post-metadata">

**Author:** ![waleed.syed](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/waleed.syed/32/7430_2.png) [@waleed.syed](https://developer.squareup.com/forums/u/waleed.syed)\
**Post date:** [May 20, 2025, 8:24am UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/8 "2025-05-20T08:24:52Z")

</div>

> [@shugyoku-style](#):
>
> [Javascript Console]  
> Tokenization failed - thrown error  
> TokenizationError: Tokenization has failed An unknown error has occurred  
> Vn — square.js:8323  
> Ti — square.js:8714  
> xo — square.js:9216  
> (anonymous function) — square.js:14257:86  
> \_d — square.js:14003  
> s — square.js:14020

@Bryan-Square is there any response on this because I am facing same error.

---

<div class="post-metadata">

**Author:** ![shugyoku-style](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shugyoku-style](https://developer.squareup.com/forums/u/shugyoku-style)\
**Post date:** [May 20, 2025, 1:32pm UTC](https://developer.squareup.com/forums/t/paymentmethod-tokenize-verificationdetails-returns-unknown-error/21687/9 "2025-05-20T13:32:14Z")

</div>

nothing from Bryan-Square, or any other person…
