Is source_id the transaction id that my app generates?

Hello,
I am trying to integrate my own app with Square API using the SDK to process payments. I am confused on that source_id or what it is used for.

So when I save a transaction/order to my database, I generate a transactionId (GUID) value that represents the transaction itself. Is this the source_id? If not, what would be the source_id?

Also, the parameter LocationId, is that something can be anything like the locationId from my app? or is this Square specific ID? My app have multiple locations and depending from where the transaction was initiated, I can have a different location-id.

Similarly, the parameter customerId, would this be the customerId from my app or is this Square specific ID?

Lastly, how can I pay when the amount is decimal type not long? The Square.Models.Money object take long type for the amount, but what if the payment is $17.45 not $17?

source_id is what you’re using to actually pay for the payment. Typically it would either be a nonce (which is a value that represents a card, generated by the Square Payment Form), or a customer_card_id that exists within a customer’s profile.

Location ID is Square-specific. Every Square account has one location by default, and have the ability to create more. This ID tells the Payments API where to send the payment to (what location). You can find the location id(s) by using the Locations API.

Customer ID is also specific to Square; it’s the customer_id from your Square account’s customer directory. It is how you tell “this customer is paying for this payment”. You can find customer id(s) in the Customers API.

Money is always in the lowest-denomination for the currency. In the US, that would be cents. So, for $17.45, you would pass 1745.

Thank you for clarifying this. Is there an way using the C# SDK to generate the nonce? If not, what would be the correct way to convert the credit card into to source_id?

The only way is by using the Square Payment Form that I linked above, which is a Javascript library that converts divs into secure iframes. It will then take the submitted card data and convert it into a nonce. There’s no way to pass raw card data to our APIs currently.