Webhooks and Order Issues

Hello,
I see issues with webhooks. I tested them on Sandbox and everything works correctly, but on 11th of May there was an issue on Production.
The error occurs when through Square App on Mobile device user create an order. The first issue is that it’s returned “ECOMMERCE_API” instead one of “SQUARE_POS” or something else that is related. This is bug ? How I can recognize that the order was made through my app ? When I used it on sandbox if I use Square Website it returned “VIRTUAL_TERMINAL” and when using API it returned “ECOMMERCE_API” and that make sense. Please let me know if this is bug or please give me more information about all of types when you send each depend if you use API, Mobile APP, Website app, or POS device. In documentation there is no information about it

PROD WEBHOOK:
{
“merchant_id”: “MLASHESVB7F00”,
“type”: “payment.updated”,
“event_id”: “f381ec59-6c77-3d59-81f9-a04ac6592eab”,
“created_at”: “2024-05-10T21:45:31.32Z”,
“data”: {
“type”: “payment”,
“id”: “RCNUCkZErndBMQv9Gtv02SZJmFHZY”,
“object”: {
“payment”: {
“amount_money”: {
“amount”: 5300,
“currency”: “USD”
},
“application_details”: {
“application_id”: “sq0idp-w46nJ_NCNDMSOywaCY0mwA”,
“square_product”: “ECOMMERCE_API”
},
“approved_money”: {
“amount”: 5300,
“currency”: “USD”
},
“billing_address”: {
“address_line_1”: “1005 Winding Way”,
“country”: “US”,
“first_name”: “Tace”,
“last_name”: “Loeb”,
“locality”: “Baltimore”,
“postal_code”: “21210”
},
“card_details”: {
“auth_result_code”: “09805D”,
“avs_status”: “AVS_ACCEPTED”,
“card”: {
“bin”: “440355”,
“card_brand”: “VISA”,
“card_type”: “CREDIT”,
“exp_month”: 8,
“exp_year”: 2030,
“fingerprint”: “sq-1-2IzpkWPqKGjzqePCQKRkNPMzgQZdiOMNTCKMtE8elTl8aNVSUsx46xn71Q-ifnPSLw”,
“last_4”: “0756”,
“prepaid_type”: “NOT_PREPAID”
},
“card_payment_timeline”: {
“authorized_at”: “2024-05-10T21:43:26.996Z”,
“captured_at”: “2024-05-10T21:43:27.439Z”
},
“cvv_status”: “CVV_NOT_CHECKED”,
“entry_method”: “KEYED”,
“statement_description”: “SQ *BALTIMORE FALLEN LUM”,
“status”: “CAPTURED”
},
“created_at”: “2024-05-10T21:43:26.645Z”,
“customer_id”: “J9KEBNJ8SC22R144R9QWHP9658”,
“delay_action”: “CANCEL”,
“delay_duration”: “PT168H”,
“delayed_until”: “2024-05-17T21:43:26.645Z”,
“id”: “RCNUCkZErndBMQv9Gtv02SZJmFHZY”,
“location_id”: “LG5QD7X8HPC8P”,
“order_id”: “M2gXhrmgec5u0DtIWA1c2HkQcmWZY”,
“processing_fee”: [
{
“amount_money”: {
“amount”: 184,
“currency”: “USD”
},
“effective_at”: “2024-05-10T23:43:28.000Z”,
“type”: “INITIAL”
}
],
“receipt_number”: “RCNU”,
“receipt_url”: “Receipt from Fallen Lumber”,
“risk_evaluation”: {
“created_at”: “2024-05-10T21:45:29.747Z”,
“risk_level”: “NORMAL”
},
“source_type”: “CARD”,
“status”: “COMPLETED”,
“tip_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_money”: {
“amount”: 5300,
“currency”: “USD”
},
“updated_at”: “2024-05-10T21:43:28.999Z”,
“version”: 5
}
}
}
}

The second issue is in order related to the payment why it’s returned custom amount as “ITEM” ? When I using Sandbox and set custom amount the item_type in line_items is “CUSTOM AMOUNT” and that make sense.

PROD RESPONSE:
{
“order”: {
“id”: “M2gXhrmgec5u0DtIWA1c2HkQcmWZY”,
“location_id”: “LG5QD7X8HPC8P”,
“line_items”: [
{
“uid”: “jAZNodnMyfRpCcOTcZIfPC”,
“quantity”: “1”,
“name”: “Custom Amount”,
“base_price_money”: {
“amount”: 5000,
“currency”: “USD”
},
“gross_sales_money”: {
“amount”: 5000,
“currency”: “USD”
},
“total_tax_money”: {
“amount”: 300,
“currency”: “USD”
},
“total_discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_money”: {
“amount”: 5300,
“currency”: “USD”
},
“variation_total_price_money”: {
“amount”: 5000,
“currency”: “USD”
},
“applied_taxes”: [
{
“uid”: “663e94d70dfdb”,
“tax_uid”: “F6E33A41-2DB4-4A77-BDC4-089518610A6C”,
“applied_money”: {
“amount”: 300,
“currency”: “USD”
}
}
],
“item_type”: “ITEM”,
“total_service_charge_money”: {
“amount”: 0,
“currency”: “USD”
}
}
],
“taxes”: [
{
“uid”: “F6E33A41-2DB4-4A77-BDC4-089518610A6C”,
“catalog_object_id”: “ZV7XJIWTA7PLOZT42JX4SVDM”,
“catalog_version”: 1715377276883,
“name”: “MD sales tax”,
“percentage”: “6.0”,
“type”: “ADDITIVE”,
“applied_money”: {
“amount”: 300,
“currency”: “USD”
},
“scope”: “LINE_ITEM”
}
],
“fulfillments”: [
{
“uid”: “DGwEEpkgnhYMIWIsLsRt3B”,
“type”: “DIGITAL”,
“state”: “PROPOSED”
}
],
“created_at”: “2024-05-10T21:42:47.178Z”,
“updated_at”: “2024-05-10T21:43:27.494Z”,
“state”: “OPEN”,
“version”: 6,
“total_tax_money”: {
“amount”: 300,
“currency”: “USD”
},
“total_discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_tip_money”: {
“amount”: 0,
“currency”: “USD”
},
“total_money”: {
“amount”: 5300,
“currency”: “USD”
},
“tenders”: [
{
“id”: “RCNUCkZErndBMQv9Gtv02SZJmFHZY”,
“location_id”: “LG5QD7X8HPC8P”,
“transaction_id”: “M2gXhrmgec5u0DtIWA1c2HkQcmWZY”,
“created_at”: “2024-05-10T21:43:26.645Z”,
“amount_money”: {
“amount”: 5300,
“currency”: “USD”
},
“type”: “CARD”,
“card_details”: {
“status”: “CAPTURED”,
“card”: {
“card_brand”: “VISA”,
“last_4”: “0756”,
“exp_month”: 8,
“exp_year”: 2030,
“fingerprint”: “sq-1-2IzpkWPqKGjzqePCQKRkNPMzgQZdiOMNTCKMtE8elTl8aNVSUsx46xn71Q-ifnPSLw”,
“card_type”: “CREDIT”,
“prepaid_type”: “NOT_PREPAID”,
“bin”: “440355”
},
“entry_method”: “KEYED”
},
“tip_money”: {
“amount”: 0,
“currency”: “USD”
},
“payment_id”: “RCNUCkZErndBMQv9Gtv02SZJmFHZY”
}
],
“total_service_charge_money”: {
“amount”: 0,
“currency”: “USD”
},
“net_amounts”: {
“total_money”: {
“amount”: 5300,
“currency”: “USD”
},
“tax_money”: {
“amount”: 300,
“currency”: “USD”
},
“discount_money”: {
“amount”: 0,
“currency”: “USD”
},
“tip_money”: {
“amount”: 0,
“currency”: “USD”
},
“service_charge_money”: {
“amount”: 0,
“currency”: “USD”
}
},
“source”: {
“name”: “Payment Link”
},
“customer_id”: “J9KEBNJ8SC22R144R9QWHP9658”,
“net_amount_due_money”: {
“amount”: 0,
“currency”: “USD”
}
}
}

Please let me know ASAP if this it bug on your side or if not what I should handle this ?

Best regards
Michael

These payments are payment link payments which is why they’re labeled as ECOMMERCE_API instead of POS payments. :slightly_smiling_face:

Ok, could you please provide me with a link to a better article with application details assigned to each payment type or this is a single case that only link payments from mobile app are returned also as ECOMMERCE_API ? What about second question? Why custom amount is sending as ITEM instead od CUSTOM_AMOUNT ?

I’m not sure I fully understand the question. The above is from a payment link which is why it came back as ECOMMERCE_API. What were you expecting to get back?

Also if you don’t pass in an item when creating a link it will process the payment as a custom amount. This is the expected behavior. If you want an itemized order then you can pass in items when creating the link that customers will pay for. :slightly_smiling_face:

I need to recognize if order was created through website that’s using my API key vs the other options that can create orders eg. POS, Square web or Square App.

The second issue is that there was not selected specific item but just custom amount. And prod returned “item_type”: “ITEM”, but the same action on sandbox returned “item_type”: “CUSTOM_AMOUNT” which I think is correct. So why request on prod returned type as ITEM?

Have you looked at using the source to identify where the order came from?

As for the custom amount vs item in the order where are you seeing the differences? The Square Online Store doesn’t have sandbox so you can only test in production. :slightly_smiling_face:

Thanks, I will check the sources.
You can create orders on sandbox account. Order can be created with items (in this case item_type is item) or add custom amount (in this case item_type is custom_amount). On sandbox it works as expected, but on production it returned probably wrong item type ( it’s returning item, but should custom_amount for case I attached in first post).

Hello,
The source works correctly :slight_smile:
I found out what was the issue. The name was changed for custom amount and thats changes the item type to “ITEM”.
Thanks for helping me solve the issue. You can close this ticket.

Glad to here you got it working as expected. :slightly_smiling_face: