Create payment api - How to generate Source Id for one time payment?

I am trying to integrate Salesforce with Square. My use case is, the customer information and payment information(card/bank) will be passed from Salesforce.

When I am trying to use a Create Payment Api, it asks for the source_id. How to generate this source id/payment id for the one-time charge with the payment info provided.?

I did not find API documentation to pass the Card information anywhere. Any help will be greatly appreciated. Thank you.

:wave: With Square the ability to pass raw card data to the API to process a payment isn’t available. You’ll need to use the Web Payments SDK to generate the source_id to pass to CreatePayment. :slightly_smiling_face:

Thank you for the response @Bryan-Square. But we have our own UI screen to get the payment and customer information, which is already integrated with the other payment providers. We wanted to hook the Square as well. Is there any other way to achieve this?

Because with the Web Payments SDK, it seems we need to use the standard UI/structure provided by Square. We want to keep the look and feel consistent with the existing.

Any alternative way to achieve this? Thank you.

Currently there isn’t any other alternative. You have to use the Web Payments SDK to generate the source_id. Also you can definitely keep your custom UI and still use the Web Payments SDK. All you need to do is to put our form field on your existing page. It doesn’t need to be a stand alone page. :slightly_smiling_face:

Hello Brian,
Using c# .NET I programmed the square payment process, it is working fine on my destop (localhost) running the program with Visual Studio 2022, I can see in square sandbox that the transaction went through but when I try to process in my website (VPS Godaddy) the same aplication I can see that the transaction arrives to square sandbox (get) but does not return the response (post) to the server, what could it be? any ideas?

:wave: That would mean that something is going wrong with the way you’re getting the response. Did you change anything from our example?

No, I just updated ApplicationId and LocationId with the ones I got from sanbox, and remember it is working fine in my desktop, Sandbox Get and Post are fine when is from my desktop.

What’s the application Id you are using?

application Id= sandbox-sq0idb-FUYFEKMp5kP2TroTwRIRjQ

The web is develop, the web is in spanish but I can guide you to te deposit page.

https://quinielafutbolera.com

click ENTRAR link (top right) to enter the customer section of the web

username: venevilla
password: Vene@@2021

click on CAJERO/DEPOSITO
¿Cuánto le gustaría agregar a su cuenta? = amount = 100

I use the sandbox credit card sample:
4111 1111 1111 1111
01/22 111 89144

In my desktop this website return succes and I can save amount in databaase and update balance, so balance on the top increments $100

I need help :slight_smile:

I used Code source from here