Generation of source_id with api endpoint

How can I generate the source_id of my card data with api endpoint? I want to use postman to call the api endpoint.

You’ll need to use the Web Payments SDK to generate a source_id. Passing raw card data to an endpoint to generate a source_id isn’t available. :slightly_smiling_face:

Thank you for your answer. I only make the API of backend of my server. So I do not use Web Form in my backend. You mean, Square is not provide the backend to generate source_id of the card data. Right?

Right, you’ll have to use the front end SDK to first to generate the source_id. There isn’t a backend way to generate the source_id. If your testing in sandbox we do have a test value cnon:card-nonce-ok that you can use for testing all the backend functions. :slightly_smiling_face:

But how is the opencart Square module worked without your front end sdk?

The form field that the customer puts the card information in is the Web Payment SDK form field. They use that to generate the source_id that’s then passed to the backend to make the server side CreatePayment call. :slightly_smiling_face:

hmmm, looks like you didn’t see the Square opencart module. Ok, thanks for your answer.

Where are you looking in the module? I see the JS library link to the Web Payments SDK in the square_3.4_2c414bc09c/upload/catalog/controller/extension/payment/squareup.php :slightly_smiling_face:

At opencart plugin, how to use js library in php backend?

For specific questions about the Opencart plugin you’ll want to reach out to them directly since they’re the ones that built the integration. As for how to use the Web Payments SDK with a PHP backend we have this example that you can use. :slightly_smiling_face:

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: