Payments API body fields

Hi, When looking at the payments API it references me to this page for more information, however, I am not seeing what all the fields are. Is that located somewhere that I am not seeng?

Also when I look at the sandbox dashboard I am seeing that the transaction details shows
Source: eCommerce Integrations

Paid by: fake_email@example.com

Where are these values set?

Thanks
Sam

1 Like

Try taking a look at https://developer.squareup.com/reference/square/payments-api/get-payment - it has a list of all the fields a Payment can have.

Thanks for asking in our forums! Could you clarify which page you’re being referred to for more information about the Payments API?

As for your other question, I can help point out where a few of these fields get populated from.

image

The first section that is Collected at is the name of the location that the funds were collected at. By default, if you’re just processing payments in sandbox you’re likely just processing for your default test account (which explains why it says “Default Test Account”).

You can add another account with a different name (like “My Other Test Account”), create a payment for that account, and then launch the dashboard for that account to see a different “Collected At”.

The source that you’re seeing there is simply indicating that it was just a payment collected that isn’t linked to any order. If you have an order associated with the payment, then you would see the following:

image

And finally, the Paid By is populated by the customer that is associated with that payment.

// POST to v2 Payments API
{
	"idempotency_key": "{{$guid}}",
	"amount_money": {
		"amount": 100,
		"currency": "USD"
	},
	"autocomplete": true,
	"source_id": "cnon:card-nonce-ok",
	"customer_id": "M6T9RHKW8MTAX5ZSY0PN10G8XR" // Customer ID for Richard Moot
}

image

If you want to stitch it all together, you want to be sure to associate the customer with the order, then associate the order with the payment.

// POST to v2 Orders API
{
    "idempotency_key": "RANDOM_STRING",
    "order": {
        "line_items": [
            {
                "name": "Half a donut",
                "quantity": "1",
                "base_price_money": {
                    "amount": 100,
                    "currency": "USD"
                }
            }
        ],
        "customer_id": "M6T9RHKW8MTAX5ZSY0PN10G8XR" // Linking the customer with the order
    }
}

then

// POST to v2 Payments API
{
	"idempotency_key": "{{$guid}}",
	"amount_money": {
		"amount": 100,
		"currency": "USD"
	},
	"autocomplete": true,
	"source_id": "cnon:card-nonce-ok",
	"order_id": "dIKvGBiG9xKYfP0sr8KvGlEAxd4F" // Linking that order with the payment
}

Hope that helps, but happy to add more if anything is unclear.

Thanks, that does help. and the link that I was refering to is https://developer.squareup.com/docs/payments-api/overview

2 Likes