Orders/Create webhook missing address field and shopify send duplicate events on order/create

Hi

i am working on a shopify app with using nodes.js template.

  1. i have integrated webhook or orders/create. In shipping_address i don’t find address field but it is show in UI page of checkout. Please see the below respond on orders/create webhook. see “shipping_address”.

  2. Secondly i receive same event multiple times. All i’m doing right is console.log. My app isn’t throwing any error

ORDERS_CREATE: {
    deliveryMethod: DeliveryMethod.Http,
    callbackUrl: "/api/webhooks",
    callback: async (topic, shop, body, webhookId, apiVersion, subTopic) => {
      console.log('In ORDERS_CREATE');
      const payload = JSON.parse(body);
      console.log(body)
      // tfmService.createShipmentAtTFM(payload)
      // Payload has the following shape:
      // {
      //   "shop_id": 954889,
      //   "shop_domain": "{shop}.myshopify.com"
      // }
    },
  },

Package versions:

@shopify/shopify-app-express”: “^4.1.3”,

@shopify/shopify-app-session-storage-sqlite”: “^3.0.2”,

{
id: 5304122409029,
admin_graphql_api_id: "gid://shopify/Order/5304122409029",
app_id: 580111,
browser_ip: "217.165.138.37",
buyer_accepts_marketing: false,
cancel_reason: null,
cancelled_at: null,
cart_token: "Z2NwLXVzLWVhc3QxOjAxSFNETVlSQjBWVDE3RldBOTc0SzlSRDdF",
checkout_id: 27804376531013,
checkout_token: "f0aba4b4667f01e38900e9e62c522f7b",
client_details: {
accept_language: "en-AE",
browser_height: null,
browser_ip: "217.165.138.37",
browser_width: null,
session_hash: null,
user_agent: "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0",
},
closed_at: null,
company: null,
confirmation_number: "PEYNK9TVV",
confirmed: true,
contact_email: "custom_uae@yopmail.com",
created_at: "2024-03-20T06:48:58-04:00",
currency: "AED",
current_subtotal_price: "50.00",
current_subtotal_price_set: {
shop_money: {
amount: "50.00",
currency_code: "AED",
},
presentment_money: {
amount: "50.00",
currency_code: "AED",
},
},
current_total_additional_fees_set: null,
current_total_discounts: "0.00",
current_total_discounts_set: {
shop_money: {
amount: "0.00",
currency_code: "AED",
},
presentment_money: {
amount: "0.00",
currency_code: "AED",
},
},
current_total_duties_set: null,
current_total_price: "72.50",
current_total_price_set: {
shop_money: {
amount: "72.50",
currency_code: "AED",
},
presentment_money: {
amount: "72.50",
currency_code: "AED",
},
},
current_total_tax: "2.50",
current_total_tax_set: {
shop_money: {
amount: "2.50",
currency_code: "AED",
},
presentment_money: {
amount: "2.50",
currency_code: "AED",
},
},
customer_locale: "en-AE",
device_id: null,
discount_codes: [
],
email: "custom_uae@yopmail.com",
estimated_taxes: false,
financial_status: "paid",
fulfillment_status: null,
landing_site: "/",
landing_site_ref: null,
location_id: null,
merchant_of_record_app_id: null,
name: "#1012",
note: null,
note_attributes: [
],
number: 12,
order_number: 1012,
order_status_url: "https://tfm-janjua.myshopify.com/58797916229/orders/1d166e7e62bbb9fc8d4555fee4f1ecf8/authenticate?key=717a1608ab5910c1d90b8b9734a0c666",
original_total_additional_fees_set: null,
original_total_duties_set: null,
payment_gateway_names: [
"bogus",
],
po_number: null,
presentment_currency: "AED",
processed_at: "2024-03-20T06:48:55-04:00",
reference: "99d8bebd54212964301959312d93934d",
referring_site: "",
source_identifier: "99d8bebd54212964301959312d93934d",
source_name: "web",
source_url: null,
subtotal_price: "50.00",
subtotal_price_set: {
shop_money: {
amount: "50.00",
currency_code: "AED",
},
presentment_money: {
amount: "50.00",
currency_code: "AED",
},
},
tags: "",
tax_exempt: false,
tax_lines: [
{
price: "2.50",
rate: 0.05,
title: "VAT",
price_set: {
shop_money: {
amount: "2.50",
currency_code: "AED",
},
presentment_money: {
amount: "2.50",
currency_code: "AED",
},
},
channel_liable: false,
},
],
taxes_included: false,
test: true,
token: "1d166e7e62bbb9fc8d4555fee4f1ecf8",
total_discounts: "0.00",
total_discounts_set: {
shop_money: {
amount: "0.00",
currency_code: "AED",
},
presentment_money: {
amount: "0.00",
currency_code: "AED",
},
},
total_line_items_price: "50.00",
total_line_items_price_set: {
shop_money: {
amount: "50.00",
currency_code: "AED",
},
presentment_money: {
amount: "50.00",
currency_code: "AED",
},
},
total_outstanding: "0.00",
total_price: "72.50",
total_price_set: {
shop_money: {
amount: "72.50",
currency_code: "AED",
},
presentment_money: {
amount: "72.50",
currency_code: "AED",
},
},
total_shipping_price_set: {
shop_money: {
amount: "20.00",
currency_code: "AED",
},
presentment_money: {
amount: "20.00",
currency_code: "AED",
},
},
total_tax: "2.50",
total_tax_set: {
shop_money: {
amount: "2.50",
currency_code: "AED",
},
presentment_money: {
amount: "2.50",
currency_code: "AED",
},
},
total_tip_received: "0.00",
total_weight: 1000,
updated_at: "2024-03-20T06:48:59-04:00",
user_id: null,
billing_address: {
first_name: "Aslam",
province: "Dubai",
country: "United Arab Emirates",
last_name: "Emraitee",
company: null,
name: "Aslam Emraitee",
country_code: "AE",
province_code: "DU",
},
customer: {
id: 6475022336069,
email: "custom_uae@yopmail.com",
created_at: "2024-03-20T04:57:39-04:00",
updated_at: "2024-03-20T06:48:58-04:00",
first_name: "Aslam",
last_name: "Emraitee",
state: "disabled",
note: null,
verified_email: true,
multipass_identifier: null,
tax_exempt: false,
email_marketing_consent: {
state: "not_subscribed",
opt_in_level: "single_opt_in",
consent_updated_at: null,
},
sms_marketing_consent: null,
tags: "",
currency: "AED",
tax_exemptions: [
],
admin_graphql_api_id: "gid://shopify/Customer/6475022336069",
default_address: {
id: 7881708961861,
customer_id: 6475022336069,
first_name: "Aslam",
last_name: "Emraitee",
company: null,
province: "Dubai",
country: "United Arab Emirates",
name: "Aslam Emraitee",
province_code: "DU",
country_code: "AE",
country_name: "United Arab Emirates",
default: true,
},
},
discount_applications: [
],
fulfillments: [
],
line_items: [
{
id: 13030693044293,
admin_graphql_api_id: "gid://shopify/LineItem/13030693044293",
attributed_staffs: [
],
current_quantity: 1,
fulfillable_quantity: 1,
fulfillment_service: "manual",
fulfillment_status: null,
gift_card: false,
grams: 1000,
name: "Shoes",
price: "50.00",
price_set: {
shop_money: {
amount: "50.00",
currency_code: "AED",
},
presentment_money: {
amount: "50.00",
currency_code: "AED",
},
},
product_exists: true,
product_id: 7071310774341,
properties: [
],
quantity: 1,
requires_shipping: true,
sku: "",
taxable: true,
title: "Shoes",
total_discount: "0.00",
total_discount_set: {
shop_money: {
amount: "0.00",
currency_code: "AED",
},
presentment_money: {
amount: "0.00",
currency_code: "AED",
},
},
variant_id: 41109781938245,
variant_inventory_management: "shopify",
variant_title: null,
vendor: "tfm-janjua",
tax_lines: [
{
channel_liable: false,
price: "2.50",
price_set: {
shop_money: {
amount: "2.50",
currency_code: "AED",
},
presentment_money: {
amount: "2.50",
currency_code: "AED",
},
},
rate: 0.05,
title: "VAT",
},
],
duties: [
],
discount_allocations: [
],
},
],
payment_terms: null,
refunds: [
],
shipping_address: {
first_name: "Aslam",
province: "Dubai",
country: "United Arab Emirates",
last_name: "Emraitee",
company: null,
name: "Aslam Emraitee",
country_code: "AE",
province_code: "DU",
},
shipping_lines: [
{
id: 4508561506373,
carrier_identifier: "650f1a14fa979ec5c74d063e968411d4",
code: "Flat",
discounted_price: "20.00",
discounted_price_set: {
shop_money: {
amount: "20.00",
currency_code: "AED",
},
presentment_money: {
amount: "20.00",
currency_code: "AED",
},
},
phone: null,
price: "20.00",
price_set: {
shop_money: {
amount: "20.00",
currency_code: "AED",
},
presentment_money: {
amount: "20.00",
currency_code: "AED",
},
},
requested_fulfillment_service_id: null,
source: "shopify",
title: "Flat",
tax_lines: [
],
discount_allocations: [
],
},
],
}

See the below screen shot. Here it show address.

After search answering my own question. According to latest Api i am using 2024-01. App should request explicit permission in order to get those fields

  1. Goto partnersAccount

  2. Goto Api Access

  3. Goto Proteced customer data access

  4. Click manage

  5. Goto Protected Customer Data

  6. Click select

  7. Select required fields and save.

After this i was getting the address field along with other fields in order/create hook.

Hello,

We are having the same issue, unfortunately we already have access to the Protected Customer Data and the address data of the customer is still missing. The addresses are only missing for orders with source “pos”. For web orders, de address is available.