x

Connect V2 API: Linking a transaction to customer id

I am using V2 connect API. The list trsanction API returns a list of transaction along with few additional details. I did not find a link to a customer. E.g. if via Register app, i have charged a customer and created it as a customer.

 

How can I link a transaction to a customer? Is there any way to get this link?

 

Tags (1)
6,982 Views
Message 1 of 12
Report
1 Best Answer
Square

Best Answer

Appreciate your patience! One of our API Engineers confirmed that if you add a customer to the payment via Square Register, the customer will be added to the payment and returned in the API. It was also mentioned that adding the customer is a separate API call, and as such there may be some (seconds) delay before it appears on the payment according to the API.

 

PS) If my answer solved your problem, would you mind marking it as "Best Answer"? That'll help the rest of the community find what they're looking for. If not, just write back, and I'll continue to help. Thanks!


Sean
he/him/his
Product Manager | Square, Inc.

View Best Answer >

9,160 Views
Message 3 of 12
Report
11 REPLIES 11
Square

I'll check in with our API Team, and then follow up with your shortly! 👍


Sean
he/him/his
Product Manager | Square, Inc.
6,934 Views
Message 2 of 12
Report
Square

Best Answer

Appreciate your patience! One of our API Engineers confirmed that if you add a customer to the payment via Square Register, the customer will be added to the payment and returned in the API. It was also mentioned that adding the customer is a separate API call, and as such there may be some (seconds) delay before it appears on the payment according to the API.

 

PS) If my answer solved your problem, would you mind marking it as "Best Answer"? That'll help the rest of the community find what they're looking for. If not, just write back, and I'll continue to help. Thanks!


Sean
he/him/his
Product Manager | Square, Inc.
9,161 Views
Message 3 of 12
Report

THanks for your answer. I have few follow up quesitons and appretiate your help on this.

 

  1. I can see that when a transaction is done, we can associate a customer to it (existing/new). This happens post a transaction is complete. Is there a way to ask for customer before the order items are collected.
  2. Is there any way we can plug in our own data base of customers? I mean, master data still be with us, POS calls our APIs ans shows additional info when an order is getting placed
  3. We wanted to have realtime notification of new transations. Is there any way to get notified about new transactions instead of polling every minute?
  4. Using connect V2 API, I find that first a transaction is created and later a customer is associated to it. Is there anyway we can query transactions fro updated date, rather then `begin_time`?
6,915 Views
Message 4 of 12
Report
Admin

Hey @arti-bandi, thanks for following up! I'm running this by our API Team and we'll reply here as soon as we have some updates. Appreciate your patience in the meantime!

️ Tom | he/him
Seller Community Manager | Square, Inc.
Find step-by-step help in our Support Center
6,901 Views
Message 5 of 12
Report
Admin

Hi @arti-bandi, thanks for your patience! We have a few updates for you:

 

I can see that when a transaction is done, we can associate a customer to it (existing/new). This happens post a transaction is complete. Is there a way to ask for customer before the order items are collected.

 

Yes, there are settings that let you add & remove “Add Customer” functionality before and after checkout, for both Android and iOS, either phone or tablets.

 

Is there any way we can plug in our own data base of customers? I mean, master data still be with us, POS calls our APIs ans shows additional info when an order is getting placed

 

No. But the developer/merchant can set the Customer.reference_id with the identifier of the customer in their own system. (https://docs.connect.squareup.com/api/connect/v2/#type-customer)

 

We wanted to have realtime notification of new transations. Is there any way to get notified about new transactions instead of polling every minute?

 

You can receive notifications at payment/transaction tender level:https://docs.connect.squareup.com/api/connect/v1/#setupwebhooks,https://docs.connect.squareup.com/api/connect/v1/#enum-webhookeventtype.

 

For example, this is a payment event:

 

{

"merchant_id": "18YC4JBH91E1H",

"location_id": "JGHJ0343",

"event_type": "PAYMENT_UPDATED",

"entity_id": "Jq74mCczmFXk1tC10GB"

}

 

Note, you need to use the Connect V1 Retrieve Payment endpoint to retrieve the payment details:https://docs.connect.squareup.com/api/connect/v1/#get-paymentid

 

Using connect V2 API, I find that first a transaction is created and later a customer is associated to it. Is there anyway we can query transactions fro updated date, rather then `begin_time`?

 

We don't support this filtering yet.

 

Hope this helps clear things up! Please don't hesitate to reply if you have any other questions. 👍

️ Tom | he/him
Seller Community Manager | Square, Inc.
Find step-by-step help in our Support Center
6,892 Views
Message 6 of 12
Report

@arti-bandi@Tom @Sean

 

Hi - we're trying to do the below: 

 

"I can see that when a transaction is done, we can associate a customer to it (existing/new)."  

 

We're trying to associate existing customers to the transaction once its compelte, but cannot figure out how to associate them - can you share how this is done?

 

Thanks,
Craig

 

6,550 Views
Message 7 of 12
Report
Alumni

Sure, just add a customer id in your charge request, like this:

 

POST /v2/locations/LOCATION_ID/transactions
{
  "idempotency_key": "74ae1696-b1e3-4328-af6d-f1e04d947a13",
  "shipping_address": {
    "address_line_1": "123 Main St",
    "locality": "San Francisco",
    "administrative_district_level_1": "CA",
    "postal_code": "94114",
    "country": "US"
  },
  "billing_address": {
    "address_line_1": "500 Electric Ave",
    "address_line_2": "Suite 600",
    "administrative_district_level_1": "NY",
    "locality": "New York",
    "postal_code": "10003",
    "country": "US"
  },
  "amount_money": {
    "amount": 5000,
    "currency": "USD"
  },
  "card_nonce": "card_nonce_from_square_123",
  "customer_id": "***YOUR CUSTOMER ID***",
  "note": "some optional note",
  "delay_capture": false
}
6,539 Views
Message 8 of 12
Report

Thanks for the reply...but I think I need to clarify my question a little more:

 

We're using square with an external app - here is the code to do the initial transaction:

{
"transactions": [
{
"id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"location_id": "18YC4JDH91E1H",
"created_at": "2016-03-10T22:57:56Z",
"tenders": [
{
"id": "MtZRYYdDrYNQbOvV7nbuBvMF",
"location_id": "18YC4JDH91E1H",
"transaction_id": "KnL67ZIwXCPtzOrqj0HrkxMF",
"created_at": "2016-03-10T22:57:56Z",
"note": "some optional note",
"amount_money": {
"amount": 5000,
"currency": "USD"
},
"processing_fee_money": {
"amount": 138,
"currency": "USD"
},
"type": "CARD",
"card_details": {
"status": "CAPTURED",
"card": {
"card_brand": "VISA",
"last_4": "1111"
},
"entry_method": "KEYED"
}
}
],
"reference_id": "some optional reference id",
"product": "EXTERNAL_API"
}
]
}

 

 

But, the problem is that when we have this compete trasaction - we want to associate it with a customer that is already in my square account - and pull the name from square and display in the our app.

 

 Is this possible?

 

6,535 Views
Message 9 of 12
Report
Alumni

You cannot associate previous transactions with a customer via the API. If you associate the customer during the transaction, and retrieve the customer id from the tender field. You can add customers to previous transactions in the Square Dashboard as shown in this picture.  http://imgur.com/Pb2Bk2q

6,527 Views
Message 10 of 12
Report

The question I have, after looking at this code, is how do we then see in the Dashboard, the customer_id, or buyer_email_address, or reference_id?

The only info we see is the Note.

3,031 Views
Message 11 of 12
Report
Admin

If the transaction has an associated customer_id (that was generated using the CreateCustomer endpoint), there will be a link to the customer when you click on the transaction in the Dashboard. Click Sales > Transactions > click on a transaction.

 

At this time, the reference_id or buyer_email_id are not available from the Square Dashboard:

  • For reference_id data you’ll need to use the the Transactions API. 
  • For the buyer_email_id if you have an associated customer, you can attach an email address to the customer object that will show up in both the Dashboard and API.
️ Helen
Seller Community Manager

Did you find help in the Seller Community? Mark a Best Answer to help others.
2,999 Views
Message 12 of 12
Report