question

Chris H avatar image
Chris H asked David Marginian Deactivated commented

"Ghost" customer while using ecommerce pay end point

I'm having an issue in the sandbox with our work flow creating an additional customer record after using the ecommerce v1/order/<order id>/pay endpoint AND then swapping all items to the new customer record (yes i know this sounds odd).

We are using the following flow:

1. I'm creating a token with the token endpiont and the following object "v1/tokens", returning a source token to assign to a customer and use for payment later.

  • brand (i.e DISCOVER)
  • number
  • cvv
  • exp_month
  • exp_year


2. I'm creating a customer record with the ecommerce endpoint "V1/customers"

  • ecomind = "ecom",
  • email
  • firstName
  • lastName
  • name = firstName + lastName,
  • source (from step 1)
  • phone


this is what the customer record looks like

{

"href": "https://sandbox.dev.clover.com/v3/merchants/9QPTP66T7X9BE/customers/ATKQP7YRZCP86",

"id": "ATKQP7YRZCP86", <-- customer id

"firstName": "Harrison,",

"lastName": "Chris",

"marketingAllowed": false,

"customerSince": 1607195931000,

"cards": {

"elements": [

{

"id": "BHGPQP7Q006NP",

"first6": "601136",

"last4": "6668",

"cardType": "DISCOVER",

"token": "clv_1TSTSzjCMwRejX2zS2915z8v", < --- token I'm using

"tokenType": "CTOKEN",

"modifiedTime": 1607195931000,

"customer": {

"id": "ATKQP7YRZCP86"

}

.....

3. I'm creating the order with the ecommerce endpoint with the following object "v1/orders"

  • items[]
  • currency = "usd",
  • customer = customer id (from step 2)
  • email

this is what the response order object looks like

{

"id": "SG9PKV9CYKNBE",

"object": "order",

"amount": 425,

"currency": "USD",

"customer": "ATKQP7YRZCP86", <---- customer id from step 2

"items": [

{

"quantity": 1,

"amount": 100,

"description": "BarGuard Application Hold"

},

{

"parent": "0DCE3GPZT46E4",

"amount": 5,

"description": "Pizza",

"tax_rates": [

{

"name": "Ohio 6.5 % Sales Tax",

"rate": 650000

}

]

},

.....

4. At this point the merchant adds the line items (our app is not handling line item additions)

5. I've trying paying with both customer and source token "/v1/orders/<order id from step 3>/pay" and the following object:

  • ecomind": "ecom",
  • source: <source from step 1>
  • tip_amount

AND

  • ecomind: "ecom",
  • customer: <customer id from step 2>,
  • tip_amount

Paying this way i end up with an additonional customer object like below (../v3/merchants/{ {merchant_id}}/customers?expand=cards):

{

"elements": [

{

"href": "https://sandbox.dev.clover.com/v3/merchants/9QPTP66T7X9BE/customers/6K4CS0TRG75QW",

"id": "6K4CS0TRG75QW", <-- New customer created

"marketingAllowed": false,

"customerSince": 1607197044000,

"cards": {

"elements": [

{

"id": "9ZPQDHPZ3RARP",

"token": "7297162975886668",

"tokenType": "MULTIPAY",

"modifiedTime": 1607197043000,

"customer": {

"id": "6K4CS0TRG75QW"

}

}

]

}

},

{

"href": "https://sandbox.dev.clover.com/v3/merchants/9QPTP66T7X9BE/customers/ATKQP7YRZCP86",

"id": "ATKQP7YRZCP86", < ----- Old customer never charged

"firstName": "Harrison,",

"lastName": "Chris",

"marketingAllowed": false,

"customerSince": 1607195931000,

"cards": {

"elements": [

{

"id": "BHGPQP7Q006NP",

"first6": "601136",

"last4": "6668",

"cardType": "DISCOVER",

"token": "clv_1TSTSzjCMwRejX2zS2915z8v",

"tokenType": "CTOKEN",

"modifiedTime": 1607195931000,

"customer": {

"id": "ATKQP7YRZCP86"

}

}

]

}

}

],

"href": "http://apisandbox.dev.clover.com/v3/merchants/9QPTP66T7X9BE/customers?limit=100"

}

ghost-customer-created-with-ecommerce-endpoint-v1.png


e-commerce api
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

I haven't looked into this in detail, but are you certain the ghost customer is being created as part of the payment of this order? There is nearly 20 minutes between the customer since times of each customer.

4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Chris H avatar image Chris H commented ·

Hi david, we have around 10 locations signed up for our app and this issue has broken our app. In the issue above you reference two workarounds. One reassigning the order to the customer after the order is paid, and the following:

It looks like in addition to passing in the customer when you create the order, you also need to pass it in when you pay for the order. Otherwise, it appears the server is creating a brand new/empty customer for the order and overwriting the customer you set when you created the order.

can you show me what my post object should look like to the ecom payment endpoint for this option? i've tried passing the customer id as the source object and i still end up with a new ghost shell customer?


works but creates ghost customer shell

customer = {customerid}

tip_amount = {tip amount}


works but creates ghost customer shell

source = {customerid}

tip_amount = {tip amount}


returns bad request

customer = {customerid}

source = {card_token}

tip_amount = {tip amount}

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ Chris H commented ·

The symptom the other poster was trying to solve was different. They wanted to see the customer associated with the order, not avoid the ghost. You want to avoid the ghost, the workarounds I posted won't avoid the ghost (the ghost will be created until our fix is in production which will be in January).

0 Likes 0 ·
Chris H avatar image Chris H David Marginian ♦♦ commented ·

Ok thanks for your attention David. Yeah in our instance we are creating customers on the behalf of the clover merchant. I can do the reassignment but don't want to dump a bunch of empty shells into their datastore.

0 Likes 0 ·
Show more comments
Chris H avatar image
Chris H answered David Marginian Deactivated commented

Hi David, yeah its definitely at the time of payment (..v1/order/<orderid>/pay) that the customer is created (and line items swapped). I did look at the end point documentation. I've tried with no email and with email, custid and no custid, with source and without source.

The delay is just time I took for accumulate all of the documentation in hopes of having everything needed to figure out what's going on. Sorry for such a long question but I'm really at a loss on this one.

4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image David Marginian ♦♦ commented ·

Ok, I will look into it in the next few days.

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ David Marginian ♦♦ commented ·

A very similar issue was actually previously reported:

https://community.clover.com/questions/26748/customer-name-not-display-on-live-clover-dashboard.html

If you retrieve the order after you pay, is the old (expected) or new (ghost) customer associated with it?


0 Likes 0 ·
Chris H avatar image Chris H David Marginian ♦♦ commented ·

when i retrieve the order the new "ghost" customer is associated with the order. The "Name Unknown" customer has all of the line items assigned after payment. This appears to be the same issue.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community