How will I get the source_id string?

We are integrating the Squareup Payment SDK at our website. But I can’t find the way to get the source_id with the card details like card number, expiry, cvv, postal code. What is the endpoint to get the source_id from card details?

:wave: With Square you will get the source_id with the Web Payments SDK. With Square Web Payments SDK it provides a secure buyer payment card entry method along with other secure payment methods. The SDK produces a secure one-time use payment token that your application web client sends to your backend, where it is processed as a payment with the Payments API. The Web Payments SDK was created to make integration with your web application simpler and provide better performance. The SDK provides the following advantages:

  • Granular configuration. You only need to write configuration code for the payment methods that your application accepts. Each payment method has its own objects with configuration options appropriate for the method.
  • Promise-based pattern. The async/await pattern is used in place of the callback pattern of earlier payment libraries. This pattern lets your application react to events in a more reasonable way with less code.
  • Automatic localization. The SDK determines the locale of the buyer’s browser automatically. However, your application can override localization by setting a configuration option.

The Web Payments SDK produces payment tokens from any of the following payment methods:

To get started, please visit our Web Payments SDK documentation.

I am having the same issue.

I can’t find the way to get the source_id with the card details like card number, expiry, cvv, postal code. What is the endpoint to get the source_id from card details?

How can I get the source_id?
I searched all documents and examples on Square website but it keeps going back to Bryan’s answer that “The SDK produces a secure one-time use payment token that your application web client sends to your backend”. OK OK.
Where and How SDK produces that TOKEN??

I am using Django as my backend. I made it work to process payment with dummy souce_id:cnon:card-nonce-ok

But I need to get REAL source_id not ```cnon:card-nonce-ok"

You have to use our client side Web Payments SDK to generate the source_id that’s used to pass to the CreatePayment call. There isn’t an endpoint you can call that will generate a source_id. :slightly_smiling_face: