# How do I get the new SCA payment flow to work?

**URL:** <https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136>\
**Category:** Questions\
**Tags:** web-payments-sdk\
**Created:** [December 17, 2024, 9:36am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136 "2024-12-17T09:36:08Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max-Lightspeed](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/max-lightspeed/32/8252_2.png) [@Max-Lightspeed](https://developer.squareup.com/forums/u/Max-Lightspeed)\
**Post date:** [December 17, 2024, 9:36am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/1 "2024-12-17T09:36:08Z")

</div>

Hello there!

I’m currently trying out the new SCA payment flow, which is described. The documentation ([Take a Card Payment](https://developer.squareup.com/docs/web-payments/take-card-payment#payment-flows)) says I need to pass the new parameters to the “tokenize()” method. But there is no global “tokenize” method. I think this code snippet refers to [GitHub - square/web-payments-quickstart: Quickstart for using Square's Web Payments SDK](https://github.com/square/web-payments-quickstart). Specifically to `/public/examples/card-payment.html`. Can you please help me understand how exactly I should pass the new parameters to “Card.tokenize()”?

I created a fork of this repository and tried to implement the new SCA payment flow but it doesn’t work.

I tried the following code:

```javascript
const tokenResult = await paymentMethod.tokenize(
  {
    billingContact: billingContact, 
    intent: 'CHARGE', 
    sellerKeyedIn: 'FALSE', 
    customerInitiated: 'TRUE', 
    total: total
  }
);

```

I also tried this:

```javascript
const tokenResult = await paymentMethod.tokenize(
  billingContact, 
  'CHARGE', 
  'FALSE', 
  'TRUE', 
  total
);

```

What mistake have I made?

Here’s the error I’m getting:

```auto
{
  code: 'CARD_DECLINED_VERIFICATION_REQUIRED',
  detail: "Authorization error: 'CARD_DECLINED_VERIFICATION_REQUIRED'",
  category: 'PAYMENT_METHOD_ERROR'
}

```

It looks like an error if “verifyBuyer” hasn’t been invoked. But in the (beta) new payment flow this method is deprecated.

Without changes (when the code calls “verifyBuyer”) everything works fine with test cards with a challenge type “Modal with verification code”.

Any help is appreciated.

Best regards,  
Max Eliseev

---

<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:** [December 17, 2024, 9:36am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/2 "2024-12-17T09:36:29Z")

</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:

> **[Verify a Buyer](https://developer.squareup.com/docs/in-app-payments-sdk/verify-buyer)**
>
> Learn how to start an SCA buyer verification, get the resulting verification token, and use that token to complete a payment with the Square Payments API.

[https://developer.squareup.com/docs/sca-overview-web](https://developer.squareup.com/docs/sca-overview-web)

> **Additional Documentation**
>
> [Strong Customer Authentication](https://developer.squareup.com/docs/sca-overview)  
> [Strong Customer Authentication](https://developer.squareup.com/docs/sca-overview-iap)  
> [Square Developer Documentation](https://developer.squareup.com/docs/reader-sdk/how-it-works)

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:** [December 17, 2024, 5:42pm UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/3 "2024-12-17T17:42:29Z")

</div>

Our new payment flow allows you to charge and store a card on file using the `CHARGE_AND_STORE` intent. This flow handles buyer verification automatically during tokenization, so you don’t need to call `verifyBuyer` separately.

1. **Tokenization** : You need to create a payment token with the required parameters.
2. **Payment Processing** : Use this token in a Payments API call.
3. **Storing Card on File** : After a successful payment, create a card on file using the payment ID.

The new payment flow will replace the existing Web Payments SDK card payment acceptance implementation and become the new default card payment flow when Square releases it for General Availability.

When Square releases the new payment flow for General Availability, Square will deprecate the [Payments.verifyBuyer()](https://developer.squareup.com/reference/sdks/web/payments/objects/Payments#Payments.verifyBuyer) method that performs buyer verification and generates a verification token. Square will provide a migration guide so that you can update your application to take card payments with the new payment flow. 🙂

---

<div class="post-metadata">

**Author:** ![Max-Lightspeed](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/max-lightspeed/32/8252_2.png) [@Max-Lightspeed](https://developer.squareup.com/forums/u/Max-Lightspeed)\
**Post date:** [December 18, 2024, 7:23am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/4 "2024-12-18T07:23:41Z")

</div>

Thank you for your message, Bryan.

I don’t need store a card after charging. I’m trying to figure out how I should change the code, because the code snippets on [Take a Card Payment](https://developer.squareup.com/docs/web-payments/take-card-payment#modify-the-payment-test-flow) don’t help with that.

Could you please describe exactly how I should modify the “Card.tokenize()” call?

For example, my current code looks like this:

```auto
const payments = window.Square.payments(appId, locationId);
const card = await payments.card();

// attaching card and doing other necessary actions

const tokenizationResult = card.tokenize();
const paymentToken = tokenizationResult.token;

const verificationDetails = {
  amount: '1.00',
  billingContact: {
    givenName: 'Bob',
    familyName: 'Billy',
    email: 'billy.bob@google.com',
    phone: '123456789',
    addressLines: ['20 W 84th St'],
    city: 'New York',
    countryCode: 'US',
  },
  currencyCode: 'USD',
  intent: 'CHARGE',
};

const verificationResult = payments.verifyBuyer(paymentToken, verificationDetails);
const verificationToken = verificationResult.token;

// sending a payment request using paymentToken and verificationToken

```

How should I modify it?

---

<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:** [December 18, 2024, 5:02pm UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/5 "2024-12-18T17:02:40Z")

</div>

While the intent is called `CHARGE_AND_STORE` you don’t need to store the card after it’s charged. You can just charge the card and this will eliminate you calling `verifyBuyer` which will be deprecated in and retired in the future. It will also eliminate the need for you to refactor the code in the future when we do deprecate it. 🙂

---

<div class="post-metadata">

**Author:** ![Max-Lightspeed](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/max-lightspeed/32/8252_2.png) [@Max-Lightspeed](https://developer.squareup.com/forums/u/Max-Lightspeed)\
**Post date:** [December 19, 2024, 6:16am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/6 "2024-12-19T06:16:48Z")

</div>

Why do I need to store the card? Our current integration with Square doesn’t do that, and it works fine.

---

<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:** [December 19, 2024, 5:14pm UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/7 "2024-12-19T17:14:54Z")

</div>

You don’t need to store the card. It’s just a word in the new intent. Also this is going to replace `verifyBuyer` in the very near future. 🙂

---

<div class="post-metadata">

**Author:** ![dougK](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dougK](https://developer.squareup.com/forums/u/dougK)\
**Post date:** [December 20, 2024, 4:47am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/8 "2024-12-20T04:47:13Z")

</div>

I gave up when const verificationResults = await payments.verifyBuyer I get a message saying verifybuyer does not exist!  
So I am trying the new(beta) method for SCA and I find the it fails JSLInt and my js with the error Uncaught SyntaxError: missing ) after argument list (at sq-card-pay.js:23:4). I just copied the code on this link [Take a Card Payment](https://developer.squareup.com/docs/web-payments/take-card-payment#payment-flows)

---

<div class="post-metadata">

**Author:** ![dougK](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dougK](https://developer.squareup.com/forums/u/dougK)\
**Post date:** [December 20, 2024, 4:49am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/9 "2024-12-20T04:49:33Z")

</div>

Its here

 ![image](https://global.discourse-cdn.com/square/original/2X/7/746fa9a62ca9fa1396f94a931ae89f4b7da54b38.png)

---

<div class="post-metadata">

**Author:** ![Max-Lightspeed](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/max-lightspeed/32/8252_2.png) [@Max-Lightspeed](https://developer.squareup.com/forums/u/Max-Lightspeed)\
**Post date:** [December 20, 2024, 5:56am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/10 "2024-12-20T05:56:52Z")

</div>

Bryan, how is this going to replace “verifyBuyer”? Could you please provide more information? [Take a Card Payment](https://developer.squareup.com/docs/web-payments/take-card-payment#payment-flows) doesn’t say it. Or does it say it? Where can I find this information? Could you provide links to the documentation?

---

<div class="post-metadata">

**Author:** ![Max-Lightspeed](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/max-lightspeed/32/8252_2.png) [@Max-Lightspeed](https://developer.squareup.com/forums/u/Max-Lightspeed)\
**Post date:** [December 20, 2024, 5:58am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/11 "2024-12-20T05:58:15Z")

</div>

Take a look at this example - [web-payments-quickstart/public/examples/card-payment.html at main · square/web-payments-quickstart · GitHub](https://github.com/square/web-payments-quickstart/blob/main/public/examples/card-payment.html)

---

<div class="post-metadata">

**Author:** ![dougK](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dougK](https://developer.squareup.com/forums/u/dougK)\
**Post date:** [December 20, 2024, 7:08am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/12 "2024-12-20T07:08:54Z")

</div>

Fixed the JSlint failure by moving all data to a const which then is sent to card.tokenize.  
Now the fail is in process-payment. The first call to  
$create\_payment\_request = new CreatePaymentRequest($token, $idempotency\_key)  
fails as the token is no longer a simple string. I assume that the Beta version must accept the complex token so another day lost. Payments are failing and I need to get the SCA working. I am using square-php-sdk 21 Nov 2024 version.

---

<div class="post-metadata">

**Author:** ![dougK](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dougK](https://developer.squareup.com/forums/u/dougK)\
**Post date:** [December 22, 2024, 12:50am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/13 "2024-12-22T00:50:08Z")

</div>

Its gone! The documentation on the BETA SCA code has disappeared. The new update for SDKs a few days ago has it DEPRECIATED. Did I miss something? Bryan says " Also this is going to replace `verifyBuyer` in the very near future. 🙂"

---

<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:** [December 23, 2024, 5:37pm UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/14 "2024-12-23T17:37:13Z")

</div>

Sorry yes, it was removed due to an issue. It’s being fixed and will be back up soon. We’re very sorry for this inconvenience. 🙂

---

<div class="post-metadata">

**Author:** ![dougK](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dougK](https://developer.squareup.com/forums/u/dougK)\
**Post date:** [April 9, 2025, 6:57pm UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/15 "2025-04-09T18:57:42Z")

</div>

I see its back in January 2025 but the Release Notes still say BETA. When is it safe to use the SCA code in php?

---

<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:** [April 9, 2025, 7:40pm UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/16 "2025-04-09T19:40:05Z")

</div>

It’s definitely safe to use even if marked beta. Beta means the interfaces are considered stable and closely represent what Square intends for final release, but fixes and updates to the interfaces might still be made. 🙂

---

<div class="post-metadata">

**Author:** ![dougK](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dougK](https://developer.squareup.com/forums/u/dougK)\
**Post date:** [April 10, 2025, 8:52am UTC](https://developer.squareup.com/forums/t/how-do-i-get-the-new-sca-payment-flow-to-work/20136/17 "2025-04-10T08:52:45Z")

</div>

Thank you for the update.
