এই নির্দেশিকাটি ইউনিভার্সাল কমার্স প্রোটোকল (UCP)-এর 2026-04-08 সংস্করণের জন্য ওয়েবহুক ব্যবহার করে গুগল-এ সম্পূর্ণ অর্ডার স্ট্যাটাস আপডেট, ফুলফিলমেন্ট ইভেন্ট এবং পরিবর্তনসমূহ পাঠানোর প্রযুক্তিগত এপিআই রেফারেন্স ও পেলোড স্কিমা প্রদান করে।
আপনার এন্ডপয়েন্টগুলো তৈরি করার আগে, উচ্চ-স্তরের ধারণা, বাধ্যতামূলক ইভেন্ট এবং ওয়েবহুক এন্ডপয়েন্টের বিবরণ জানার জন্য অর্ডার লাইফসাইকেল ওভারভিউটি পর্যালোচনা করে নিন।
প্রমাণীকরণ এবং অনুরোধ স্বাক্ষর
2026-04-08 সংস্করণের প্রধান পরিবর্তনগুলোর মধ্যে রয়েছে নতুন বাধ্যতামূলক ওয়েবহুক হেডার এবং নির্দিষ্ট অনুরোধ স্বাক্ষর পদ্ধতির প্রবর্তন।
প্রয়োজনীয় ওয়েবহুক হেডার
সকল ওয়েবহুক অনুরোধের জন্য নিম্নলিখিত HTTP হেডারগুলি বাধ্যতামূলক:
-
Webhook-Id: এই নির্দিষ্ট ওয়েবহুক ইভেন্টের জন্য একটি অনন্য শনাক্তকারী। এই আইডিটি প্রেরিত মূল ইভেন্টেরidসাথে মিলতে হবে (উদাহরণস্বরূপ, ফুলফিলমেন্ট ইভেন্ট আইডি বা অ্যাডজাস্টমেন্ট ইভেন্ট আইডি)। -
Webhook-Timestamp: যে টাইমস্ট্যাম্পটি ইভেন্টটি ঘটার সময় নির্দেশ করে।
এই হেডারগুলো অর্ডার পেলোডে পূর্বে প্রত্যাশিত id এবং created_time ফিল্ডগুলোকে প্রতিস্থাপন করে।
স্বাক্ষর করার অনুরোধ
- অনুরোধের মূল অংশের SHA-256 ডাইজেস্ট গণনা করুন এবং
Content-Digestহেডার সেট করুন। - আপনার UCP প্রোফাইলের
signing_keysথেকে একটি সাইনিং কী নির্বাচন করুন। - RFC 9421 অনুযায়ী সিগনেচার বেস তৈরি করুন।
- স্বাক্ষরিত উপাদানগুলির জন্য স্পেক দেখুন
-
UCP-Agent,Signature-InputএবংSignatureহেডারগুলো সেট করুন।-
UCP-Agentহলো আপনার UCP প্রোফাইলের একটি লিঙ্ক, যাprofile="https://merchant.example.com/.well-known/ucp"এই ফরম্যাটে থাকে। -
Signature-Inputহলো একটি ডিকশনারি-কাঠামোর ফিল্ড, যা স্বাক্ষরের অন্তর্ভুক্ত উপাদানগুলোর বর্ণনা দেয় এবং স্বাক্ষর করার জন্য ব্যবহৃতkeyidও এতে থাকে, যা অবশ্যই আপনার UCP প্রোফাইলেরsigning_keysথেকে নির্বাচিত signing key-এরkidএর সাথে মিলতে হবে। -
Signatureহেডারে আপনার সিগনেচার বেস থাকে, যা আপনার প্রাইভেট কী ব্যবহার করে স্বাক্ষরিত এবং তারপর বেস৬৪ (base64) এনকোড করা হয়।
-
আরও তথ্যের জন্য ucp.dev-এ স্বাক্ষর করার নির্দেশাবলী দেখুন।
অর্ডার তৈরি ইভেন্ট
- ট্রিগার: অর্ডার নিশ্চিত হওয়ার ঠিক পরেই (
status: processing)।
এই সংস্করণের প্রধান পরিবর্তনসমূহ:
- এখন থেকে অর্ডার অবজেক্টের শীর্ষ স্তরে
currencyফিল্ডটি থাকা আবশ্যক। -
totalsঅ্যারের প্রতিটি অবজেক্টেরtypeফিল্ডটি এখন একটি ওপেন স্ট্রিং (উদাহরণস্বরূপ, 'subtotal', 'tax', 'fee', 'total")। - বাধ্যতামূলক
Webhook-Idহেডারে ওয়েবহুক ইভেন্টের জন্য একটি অনন্য শনাক্তকারী থাকে। উল্লেখ্য যে, পেলোডের মধ্যে থাকাidফিল্ড, যেখানে অর্ডার কনফার্মেশন আইডি থাকে, সেটিও আবশ্যক। - বাধ্যতামূলক
Webhook-Timestampহেডারটি তৈরির সময় প্রদান করে, যা পেলোডের পূর্ববর্তীcreated_timeফিল্ডটিকে প্রতিস্থাপন করে।
উদাহরণ: এই উদাহরণটি একজন ক্রেতা চেকআউট সম্পন্ন করার পর তৈরি হওয়া একটি অর্ডার দেখাচ্ছে।
প্রয়োজনীয় হেডার:
-
Webhook-Id: order_01 -
Webhook-Timestamp: 2026-03-23T19:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_01",
"checkout_id": "checkout_01",
"currency": "USD",
// Always include all line items, even for single-item checkouts. This ensures any add-ons, gifts, or separate charges are accounted for.
"line_items": [
{
"id": "line_1",
"item":
{
"id": "product_123",
"title": "Running Shoes",
"price": 10000
},
"quantity": { "total": 1, "fulfilled": 0 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 10000},
{"type": "total", "display_text": null, "amount": 10000}
],
// The status of a line item must match total and fulfilled quantities (e.g., total 1, fulfilled 0 -> status: processing).
"status": "processing"
}
],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": 10000}, // Tax-inclusive markets: Set display_text to "Subtotal (including taxes)". Amount must include tax.
{"type": "fee", "display_text": "Service Fee", "amount": 100},
{"type": "tax", "display_text": "Tax", "amount": 800}, // Tax-inclusive markets: Omit this entry.
{"type": "total", "display_text": "Total", "amount": 10900}
],
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Arrives in 2-3 business days", // Maximum length: 200 characters.
"fulfillable_on": "now"
}
]
},
"permalink_url": "https://merchant.example.com/orders/789"
}
পরিপূর্ণতার ইভেন্ট
এই ইভেন্টগুলো fulfillment.events অ্যারের অংশ হিসেবে পাঠানো হয়।
অর্ডার পাঠানো হয়েছে
অর্ডারের আইটেমগুলো পাঠানো হয়ে গেলে। 'শিপড' ইভেন্টের জন্য tracking_number এবং tracking_url ফিল্ডগুলো আবশ্যক, কারণ 'আমার অর্ডার' পেজে আইটেমগুলোকে সঠিকভাবে গ্রুপ করার জন্য এগুলো প্রয়োজন।
অর্ডার ডেলিভারি করা হয়েছে
অর্ডারের পণ্যগুলো ডেলিভারি হয়ে গেলে
উদাহরণ ( shipped ও delivered ): এই উদাহরণটি দেখায় যে পণ্যটি প্রেরণ এবং বিতরণ করার পরে কীভাবে অর্ডার আপডেট করা হয়।
প্রয়োজনীয় হেডার:
-
Webhook-Id: fulfill_evt_2 -
Webhook-Timestamp: 2026-02-10T14:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_01",
"checkout_id": "checkout_01",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item":
{
"id": "product_123",
"title": "Running Shoes",
"price": 10000
},
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "amount": 10000},
{"type": "total", "amount": 10000}
],
"status": "fulfilled"
}
],
"totals": [
{"type": "subtotal", "amount": 10000},
{"type": "total", "amount": 10000}
],
// Updated fulfillment details
"fulfillment": {
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-08T10:30:00Z",
"type": "shipped",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"tracking_number": "123456789",
"tracking_url": "https://fedex.com/track/123456789",
"carrier": "FedEx",
"description": "Shipping departed from warehouse"
},
{
"id": "fulfill_evt_2",
"occurred_at": "2026-02-10T14:00:00Z",
"type": "delivered",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"tracking_number": "123456789",
"tracking_url": "https://fedex.com/track/123456789",
"carrier": "FedEx",
"description": "Package delivered"
}
],
"expectations": [{ "...": "..." }]
},
"permalink_url": "https://merchant.example.com/orders/123"
}
একাধিক আইটেমের অর্ডারের উদাহরণ
নিম্নলিখিত উদাহরণগুলি দেখায় কিভাবে একাধিক আইটেমের অর্ডার এবং বিভক্ত চালানের জন্য আপডেটগুলি গঠন করতে হয়। প্যাকেজের স্ট্যাটাস কীভাবে নির্ধারণ করা হয় তার নিয়মের জন্য, "প্যাকেজের স্ট্যাটাস কীভাবে নির্ধারিত হয়" দেখুন।
একাধিক পণ্যের অর্ডার, একই প্যাকেজে ডেলিভারি
এই উদাহরণটি একাধিক আইটেম সম্বলিত একটি একক প্যাকেজের অর্ডার আপডেট দেখাচ্ছে। সমস্ত লাইন আইটেম একই ট্র্যাকিং নম্বর ব্যবহার করে একটি একক shipped ইভেন্টের অধীনে একত্রিত করা হয়েছে।
প্রয়োজনীয় হেডার:
-
Webhook-Id: fulfill_evt_1 -
Webhook-Timestamp: 2026-02-08T10:30:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_multi_01",
"checkout_id": "checkout_multi_01",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item": { "id": "product_1", "title": "Item 1", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
},
{
"id": "line_2",
"item": { "id": "product_2", "title": "Item 2", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
}
],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
{"type": "fee", "display_text": "Shipping", "amount": 500},
{"type": "total", "display_text": "Total", "amount": 10500}
],
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [
{ "id": "line_1", "quantity": 1 },
{ "id": "line_2", "quantity": 1 }
],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Standard Shipping",
"fulfillable_on": "now"
}
],
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-08T10:30:00Z",
"type": "shipped",
"line_items": [
{ "id": "line_1", "quantity": 1 },
{ "id": "line_2", "quantity": 1 }
],
"tracking_number": "123456789",
"tracking_url": "https://fedex.com/track/123456789",
"carrier": "FedEx",
"description": "Both items shipped together"
}
]
},
"permalink_url": "https://merchant.example.com/orders/456"
}
একাধিক আইটেমের অর্ডার, বিভক্ত চালান
এই উদাহরণটি বিভক্ত চালানের জন্য একটি অর্ডার আপডেট দেখাচ্ছে। এখানে একাধিক shipped ইভেন্ট রয়েছে, যার প্রতিটি সংশ্লিষ্ট প্যাকেজের মধ্যে থাকা নির্দিষ্ট line_items নির্দেশ করে এবং সেগুলোর আলাদা ট্র্যাকিং নম্বর থাকে। যেহেতু প্রতিটি প্যাকেজ একটি স্বতন্ত্র ফুলফিলমেন্ট প্রতিশ্রুতিকে প্রতিনিধিত্ব করে (উদাহরণস্বরূপ, একটি মাল্টি-গ্রুপ চেকআউট থেকে ভিন্ন গতি এবং খরচ), তাই expectations বিভক্ত করা হয়।
প্রয়োজনীয় হেডার:
-
Webhook-Id: fulfill_evt_2 -
Webhook-Timestamp: 2026-02-09T14:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_multi_02",
"checkout_id": "checkout_multi_02",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item": { "id": "product_1", "title": "Item 1", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
},
{
"id": "line_2",
"item": { "id": "product_2", "title": "Item 2", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
}
],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
{"type": "fee", "display_text": "Shipping", "amount": 1500},
{"type": "total", "display_text": "Total", "amount": 11500}
],
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Standard Shipping",
"fulfillable_on": "now"
},
{
"id": "exp_2",
"line_items": [{ "id": "line_2", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Express Shipping",
"fulfillable_on": "now"
}
],
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-08T10:30:00Z",
"type": "shipped",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"tracking_number": "PKG1_TRACKING",
"tracking_url": "https://fedex.com/track/PKG1_TRACKING",
"carrier": "FedEx",
"description": "First item shipped in package 1"
},
{
"id": "fulfill_evt_2",
"occurred_at": "2026-02-09T14:00:00Z",
"type": "shipped",
"line_items": [{ "id": "line_2", "quantity": 1 }],
"tracking_number": "PKG2_TRACKING",
"tracking_url": "https://fedex.com/track/PKG2_TRACKING",
"carrier": "FedEx",
"description": "Second item shipped in package 2"
}
]
},
"permalink_url": "https://merchant.example.com/orders/457"
}
সমন্বয় ইভেন্টের উদাহরণ
নিম্নলিখিত উদাহরণগুলি রিফান্ড, রিটার্ন এবং ক্যান্সেলেশনের জন্য আপডেটগুলি কীভাবে গঠন করতে হয় তা প্রদর্শন করে। সমর্থিত ইভেন্টগুলির তালিকা এবং তাদের সংজ্ঞার জন্য, অর্ডার লাইফসাইকেল ওভারভিউতে অ্যাডজাস্টমেন্ট ইভেন্টগুলি দেখুন।
অর্ডার বাতিল এবং ফেরত
এই উদাহরণে এমন একটি অর্ডার দেখানো হয়েছে, যেখানে অর্ডারটি দেওয়ার অল্প সময়ের মধ্যেই পণ্যটি বাতিল করে অর্থ ফেরত দেওয়া হয়েছিল।
এই সংস্করণে এই উদাহরণে প্রধান পরিবর্তনগুলি হলো:
-
cancellationদ্বারা প্রভাবিত লাইন আইটেমগুলো এখন মূলline_itemsঅ্যারেতে"status": "removed"ব্যবহার করে। - যখন
line_items.statusremovedহয়:-
line_items.quantity.totalএর মান0নির্ধারণ করা হয়েছে। - আসল পরিমাণটি নতুন
line_items.quantity.originalফিল্ডে সংরক্ষিত থাকে।
-
প্রয়োজনীয় হেডার:
-
Webhook-Id: adj_refund_1 -
Webhook-Timestamp: 2026-02-09T11:05:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_02",
"checkout_id": "checkout_02",
"currency": "USD",
"line_items": [
{
"id": "line_2",
"item": {
"id": "product_456",
"title": "Smart Watch",
"price": 29900
},
"quantity": {
"total": 0, // Item removed from order total.
"original": 1, // Original quantity before removal.
"fulfilled": 0 // Item was not fulfilled before cancellation.
},
"totals": [
{"type": "subtotal", "amount": 29900},
{"type": "tax", "amount": 2400},
{"type": "total", "amount": 32300}
],
"status": "removed" // Item is cancelled, returned, or refunded.
}
],
"totals": [
{"type": "subtotal", "amount": 29900},
{"type": "tax", "amount": 2400},
{"type": "total", "amount": 32300}
],
// Fulfillment expectations should still be present even if cancelled early.
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [{ "id": "line_2", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Bob",
"last_name": "Consumer",
"street_address": "456 Oak Ave",
"address_locality": "Anytown",
"address_region": "CA",
"address_country": "US",
"postal_code": "90210"
},
"description": "Standard Shipping",
"fulfillable_on": "now"
}
]
// "events": [] // No fulfillment events occurred before cancellation.
},
"adjustments": [
{
"id": "adj_cancel_1",
"type": "cancellation",
"description": "Customer changed mind",
"line_items": [{ "id": "line_2", "quantity": -1 }],
"occurred_at": "2026-02-09T11:00:00Z",
"status": "completed"
},
{
"id": "adj_refund_1",
"type": "refund",
"description": "Refund for cancelled item",
"line_items": [{ "id": "line_2", "quantity": -1 }],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": -29900}, // Negative amounts indicate money returned to the buyer. Tax-inclusive markets: Set display_text to "Subtotal (including taxes)". Amount must include tax.
{"type": "tax", "amount": -2400}, // Tax-inclusive markets: Omit this entry.
{"type": "total", "display_text": "Total", "amount": -32300}
],
"occurred_at": "2026-02-09T11:05:00Z",
"status": "completed"
}
],
"permalink_url": "https://merchant.example.com/orders/12345"
}
অর্ডার ফেরত এবং রিফান্ড
এই উদাহরণটিতে এমন একটি অর্ডার দেখানো হয়েছে, যেখানে পণ্যটি পাঠানো, ডেলিভারি করা এবং তারপর ফেরত নিয়ে টাকা ফেরত দেওয়া হয়েছে।
এই সংস্করণে এই উদাহরণে প্রধান পরিবর্তনগুলি হলো:
-
returnদ্বারা প্রভাবিত লাইন আইটেমগুলো এখন মূলline_itemsঅ্যারেতে"status": "removed"ব্যবহার করে। - যখন
line_items.statusremovedহয়:-
line_items.quantity.totalএর মান0নির্ধারণ করা হয়েছে। - আসল পরিমাণটি নতুন
line_items.quantity.originalফিল্ডে সংরক্ষিত থাকে।
-
-
returnটাইপেরadjustmentsক্ষেত্রে, আইটেমগুলো ফেরত নেওয়া হচ্ছে তা বোঝাতে অ্যাডজাস্টমেন্টের ভেতরেরline_items.quantityফিল্ডে একটি নেগেটিভ ভ্যালু (যেমন,-1) ব্যবহার করা হয়।
প্রয়োজনীয় হেডার:
-
Webhook-Id: adj_refund_2 -
Webhook-Timestamp: 2026-02-10T10:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_03",
"checkout_id": "checkout_03",
"currency": "USD",
"line_items": [
{
"id": "line_3",
"item": {
"id": "product_789",
"title": "Wireless Earbuds",
"price": 14900
},
"quantity": {
"total": 0, // Item removed from order total.
"original": 1, // Original quantity before removal.
"fulfilled": 1 // Was fulfilled before return.
},
"totals": [
{"type": "subtotal", "amount": 14900},
{"type": "tax", "amount": 1200},
{"type": "total", "amount": 16100}
],
"status": "removed" // Item is cancelled, returned, or refunded.
}
],
"totals": [
{"type": "subtotal", "amount": 14900},
{"type": "tax", "amount": 1200},
{"type": "total", "amount": 16100}
],
"fulfillment": {
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-05T09:00:00Z",
"type": "shipped",
"line_items": [{ "id": "line_3", "quantity": 1 }],
"tracking_number": "987654321",
"tracking_url": "https://fedex.com/track/987654321",
"carrier": "FedEx",
"description": "Item shipped"
},
{
"id": "fulfill_evt_2",
"occurred_at": "2026-02-07T16:00:00Z",
"type": "delivered",
"line_items": [{ "id": "line_3", "quantity": 1 }],
"tracking_number": "987654321",
"tracking_url": "https://fedex.com/track/987654321",
"carrier": "FedEx",
"description": "Item delivered"
},
{
"id": "fulfill_evt_3",
"occurred_at": "2026-02-09T09:00:00Z",
"type": "returned",
"line_items": [{ "id": "line_3", "quantity": 1 }],
"tracking_number": "987654321",
"tracking_url": "https://fedex.com/track/987654321",
"carrier": "FedEx",
"description": "Item returned"
}
],
"expectations": [{ "...": "..." }]
},
"adjustments": [
{
"id": "adj_return_1",
"type": "return", // a matching fulfillment event is also added to represent return shipping.
"description": "Item not compatible",
"line_items": [{ "id": "line_3", "quantity": -1 }], // Uses a negative value (such as -1) to indicate a return.
"occurred_at": "2026-02-09T09:00:00Z",
"status": "completed"
},
{
"id": "adj_refund_2",
"type": "refund",
"description": "Refund for returned item",
"line_items": [{ "id": "line_3", "quantity": -1 }],
"totals": [
{"type": "subtotal", "amount": -14900}, // Negative amounts indicate money returned to the buyer.
{"type": "tax", "amount": -1200},
{"type": "total", "amount": -16100}
],
"occurred_at": "2026-02-10T10:00:00Z",
"status": "completed"
}
],
"permalink_url": "https://merchant.example.com/orders/67890"
}
এই নির্দেশিকাটি ইউনিভার্সাল কমার্স প্রোটোকল (UCP)-এর 2026-04-08 সংস্করণের জন্য ওয়েবহুক ব্যবহার করে গুগল-এ সম্পূর্ণ অর্ডার স্ট্যাটাস আপডেট, ফুলফিলমেন্ট ইভেন্ট এবং পরিবর্তনসমূহ পাঠানোর প্রযুক্তিগত এপিআই রেফারেন্স ও পেলোড স্কিমা প্রদান করে।
আপনার এন্ডপয়েন্টগুলো তৈরি করার আগে, উচ্চ-স্তরের ধারণা, বাধ্যতামূলক ইভেন্ট এবং ওয়েবহুক এন্ডপয়েন্টের বিবরণ জানার জন্য অর্ডার লাইফসাইকেল ওভারভিউটি পর্যালোচনা করে নিন।
প্রমাণীকরণ এবং অনুরোধ স্বাক্ষর
2026-04-08 সংস্করণের প্রধান পরিবর্তনগুলোর মধ্যে রয়েছে নতুন বাধ্যতামূলক ওয়েবহুক হেডার এবং নির্দিষ্ট অনুরোধ স্বাক্ষর পদ্ধতির প্রবর্তন।
প্রয়োজনীয় ওয়েবহুক হেডার
সকল ওয়েবহুক অনুরোধের জন্য নিম্নলিখিত HTTP হেডারগুলি বাধ্যতামূলক:
-
Webhook-Id: এই নির্দিষ্ট ওয়েবহুক ইভেন্টের জন্য একটি অনন্য শনাক্তকারী। এই আইডিটি প্রেরিত মূল ইভেন্টেরidসাথে মিলতে হবে (উদাহরণস্বরূপ, ফুলফিলমেন্ট ইভেন্ট আইডি বা অ্যাডজাস্টমেন্ট ইভেন্ট আইডি)। -
Webhook-Timestamp: যে টাইমস্ট্যাম্পটি ইভেন্টটি ঘটার সময় নির্দেশ করে।
এই হেডারগুলো অর্ডার পেলোডে পূর্বে প্রত্যাশিত id এবং created_time ফিল্ডগুলোকে প্রতিস্থাপন করে।
স্বাক্ষর করার অনুরোধ
- অনুরোধের মূল অংশের SHA-256 ডাইজেস্ট গণনা করুন এবং
Content-Digestহেডার সেট করুন। - আপনার UCP প্রোফাইলের
signing_keysথেকে একটি সাইনিং কী নির্বাচন করুন। - RFC 9421 অনুযায়ী সিগনেচার বেস তৈরি করুন।
- স্বাক্ষরিত উপাদানগুলির জন্য স্পেক দেখুন
-
UCP-Agent,Signature-InputএবংSignatureহেডারগুলো সেট করুন।-
UCP-Agentহলো আপনার UCP প্রোফাইলের একটি লিঙ্ক, যাprofile="https://merchant.example.com/.well-known/ucp"এই ফরম্যাটে থাকে। -
Signature-Inputহলো একটি ডিকশনারি-কাঠামোর ফিল্ড, যা স্বাক্ষরের অন্তর্ভুক্ত উপাদানগুলোর বর্ণনা দেয় এবং স্বাক্ষর করার জন্য ব্যবহৃতkeyidও এতে থাকে, যা অবশ্যই আপনার UCP প্রোফাইলেরsigning_keysথেকে নির্বাচিত signing key-এরkidএর সাথে মিলতে হবে। -
Signatureহেডারে আপনার সিগনেচার বেস থাকে, যা আপনার প্রাইভেট কী ব্যবহার করে স্বাক্ষরিত এবং তারপর বেস৬৪ (base64) এনকোড করা হয়।
-
আরও তথ্যের জন্য ucp.dev-এ স্বাক্ষর করার নির্দেশাবলী দেখুন।
অর্ডার তৈরি ইভেন্ট
- ট্রিগার: অর্ডার নিশ্চিত হওয়ার ঠিক পরেই (
status: processing)।
এই সংস্করণের প্রধান পরিবর্তনসমূহ:
- এখন থেকে অর্ডার অবজেক্টের শীর্ষ স্তরে
currencyফিল্ডটি থাকা আবশ্যক। -
totalsঅ্যারের প্রতিটি অবজেক্টেরtypeফিল্ডটি এখন একটি ওপেন স্ট্রিং (উদাহরণস্বরূপ, 'subtotal', 'tax', 'fee', 'total")। - বাধ্যতামূলক
Webhook-Idহেডারে ওয়েবহুক ইভেন্টের জন্য একটি অনন্য শনাক্তকারী থাকে। উল্লেখ্য যে, পেলোডের মধ্যে থাকাidফিল্ড, যেখানে অর্ডার কনফার্মেশন আইডি থাকে, সেটিও আবশ্যক। - বাধ্যতামূলক
Webhook-Timestampহেডারটি তৈরির সময় প্রদান করে, যা পেলোডের পূর্ববর্তীcreated_timeফিল্ডটিকে প্রতিস্থাপন করে।
উদাহরণ: এই উদাহরণটি একজন ক্রেতা চেকআউট সম্পন্ন করার পর তৈরি হওয়া একটি অর্ডার দেখাচ্ছে।
প্রয়োজনীয় হেডার:
-
Webhook-Id: order_01 -
Webhook-Timestamp: 2026-03-23T19:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_01",
"checkout_id": "checkout_01",
"currency": "USD",
// Always include all line items, even for single-item checkouts. This ensures any add-ons, gifts, or separate charges are accounted for.
"line_items": [
{
"id": "line_1",
"item":
{
"id": "product_123",
"title": "Running Shoes",
"price": 10000
},
"quantity": { "total": 1, "fulfilled": 0 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 10000},
{"type": "total", "display_text": null, "amount": 10000}
],
// The status of a line item must match total and fulfilled quantities (e.g., total 1, fulfilled 0 -> status: processing).
"status": "processing"
}
],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": 10000}, // Tax-inclusive markets: Set display_text to "Subtotal (including taxes)". Amount must include tax.
{"type": "fee", "display_text": "Service Fee", "amount": 100},
{"type": "tax", "display_text": "Tax", "amount": 800}, // Tax-inclusive markets: Omit this entry.
{"type": "total", "display_text": "Total", "amount": 10900}
],
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Arrives in 2-3 business days", // Maximum length: 200 characters.
"fulfillable_on": "now"
}
]
},
"permalink_url": "https://merchant.example.com/orders/789"
}
পরিপূর্ণতার ইভেন্ট
এই ইভেন্টগুলো fulfillment.events অ্যারের অংশ হিসেবে পাঠানো হয়।
অর্ডার পাঠানো হয়েছে
অর্ডারের আইটেমগুলো পাঠানো হয়ে গেলে। 'শিপড' ইভেন্টের জন্য tracking_number এবং tracking_url ফিল্ডগুলো আবশ্যক, কারণ 'আমার অর্ডার' পেজে আইটেমগুলোকে সঠিকভাবে গ্রুপ করার জন্য এগুলো প্রয়োজন।
অর্ডার ডেলিভারি করা হয়েছে
অর্ডারের পণ্যগুলো ডেলিভারি হয়ে গেলে
উদাহরণ ( shipped ও delivered ): এই উদাহরণটি দেখায় যে পণ্যটি প্রেরণ এবং বিতরণ করার পরে কীভাবে অর্ডার আপডেট করা হয়।
প্রয়োজনীয় হেডার:
-
Webhook-Id: fulfill_evt_2 -
Webhook-Timestamp: 2026-02-10T14:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_01",
"checkout_id": "checkout_01",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item":
{
"id": "product_123",
"title": "Running Shoes",
"price": 10000
},
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "amount": 10000},
{"type": "total", "amount": 10000}
],
"status": "fulfilled"
}
],
"totals": [
{"type": "subtotal", "amount": 10000},
{"type": "total", "amount": 10000}
],
// Updated fulfillment details
"fulfillment": {
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-08T10:30:00Z",
"type": "shipped",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"tracking_number": "123456789",
"tracking_url": "https://fedex.com/track/123456789",
"carrier": "FedEx",
"description": "Shipping departed from warehouse"
},
{
"id": "fulfill_evt_2",
"occurred_at": "2026-02-10T14:00:00Z",
"type": "delivered",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"tracking_number": "123456789",
"tracking_url": "https://fedex.com/track/123456789",
"carrier": "FedEx",
"description": "Package delivered"
}
],
"expectations": [{ "...": "..." }]
},
"permalink_url": "https://merchant.example.com/orders/123"
}
একাধিক আইটেমের অর্ডারের উদাহরণ
নিম্নলিখিত উদাহরণগুলি দেখায় কিভাবে একাধিক আইটেমের অর্ডার এবং বিভক্ত চালানের জন্য আপডেটগুলি গঠন করতে হয়। প্যাকেজের স্ট্যাটাস কীভাবে নির্ধারণ করা হয় তার নিয়মের জন্য, "প্যাকেজের স্ট্যাটাস কীভাবে নির্ধারিত হয়" দেখুন।
একাধিক পণ্যের অর্ডার, একই প্যাকেজে ডেলিভারি
এই উদাহরণটি একাধিক আইটেম সম্বলিত একটি একক প্যাকেজের অর্ডার আপডেট দেখাচ্ছে। সমস্ত লাইন আইটেম একই ট্র্যাকিং নম্বর ব্যবহার করে একটি একক shipped ইভেন্টের অধীনে একত্রিত করা হয়েছে।
প্রয়োজনীয় হেডার:
-
Webhook-Id: fulfill_evt_1 -
Webhook-Timestamp: 2026-02-08T10:30:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_multi_01",
"checkout_id": "checkout_multi_01",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item": { "id": "product_1", "title": "Item 1", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
},
{
"id": "line_2",
"item": { "id": "product_2", "title": "Item 2", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
}
],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
{"type": "fee", "display_text": "Shipping", "amount": 500},
{"type": "total", "display_text": "Total", "amount": 10500}
],
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [
{ "id": "line_1", "quantity": 1 },
{ "id": "line_2", "quantity": 1 }
],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Standard Shipping",
"fulfillable_on": "now"
}
],
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-08T10:30:00Z",
"type": "shipped",
"line_items": [
{ "id": "line_1", "quantity": 1 },
{ "id": "line_2", "quantity": 1 }
],
"tracking_number": "123456789",
"tracking_url": "https://fedex.com/track/123456789",
"carrier": "FedEx",
"description": "Both items shipped together"
}
]
},
"permalink_url": "https://merchant.example.com/orders/456"
}
একাধিক আইটেমের অর্ডার, বিভক্ত চালান
এই উদাহরণটি বিভক্ত চালানের জন্য একটি অর্ডার আপডেট দেখাচ্ছে। এখানে একাধিক shipped ইভেন্ট রয়েছে, যার প্রতিটি সংশ্লিষ্ট প্যাকেজের মধ্যে থাকা নির্দিষ্ট line_items নির্দেশ করে এবং সেগুলোর আলাদা ট্র্যাকিং নম্বর থাকে। যেহেতু প্রতিটি প্যাকেজ একটি স্বতন্ত্র ফুলফিলমেন্ট প্রতিশ্রুতিকে প্রতিনিধিত্ব করে (উদাহরণস্বরূপ, একটি মাল্টি-গ্রুপ চেকআউট থেকে ভিন্ন গতি এবং খরচ), তাই expectations বিভক্ত করা হয়।
প্রয়োজনীয় হেডার:
-
Webhook-Id: fulfill_evt_2 -
Webhook-Timestamp: 2026-02-09T14:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_multi_02",
"checkout_id": "checkout_multi_02",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item": { "id": "product_1", "title": "Item 1", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
},
{
"id": "line_2",
"item": { "id": "product_2", "title": "Item 2", "price": 5000 },
"quantity": { "total": 1, "fulfilled": 1 },
"totals": [
{"type": "subtotal", "display_text": null, "amount": 5000},
{"type": "total", "display_text": null, "amount": 5000}
],
"status": "fulfilled"
}
],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": 10000},
{"type": "fee", "display_text": "Shipping", "amount": 1500},
{"type": "total", "display_text": "Total", "amount": 11500}
],
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Standard Shipping",
"fulfillable_on": "now"
},
{
"id": "exp_2",
"line_items": [{ "id": "line_2", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Alice",
"last_name": "Example",
"street_address": "123 Main St",
"address_locality": "Austin",
"address_region": "TX",
"address_country": "US",
"postal_code": "78701"
},
"description": "Express Shipping",
"fulfillable_on": "now"
}
],
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-08T10:30:00Z",
"type": "shipped",
"line_items": [{ "id": "line_1", "quantity": 1 }],
"tracking_number": "PKG1_TRACKING",
"tracking_url": "https://fedex.com/track/PKG1_TRACKING",
"carrier": "FedEx",
"description": "First item shipped in package 1"
},
{
"id": "fulfill_evt_2",
"occurred_at": "2026-02-09T14:00:00Z",
"type": "shipped",
"line_items": [{ "id": "line_2", "quantity": 1 }],
"tracking_number": "PKG2_TRACKING",
"tracking_url": "https://fedex.com/track/PKG2_TRACKING",
"carrier": "FedEx",
"description": "Second item shipped in package 2"
}
]
},
"permalink_url": "https://merchant.example.com/orders/457"
}
সমন্বয় ইভেন্টের উদাহরণ
নিম্নলিখিত উদাহরণগুলি রিফান্ড, রিটার্ন এবং ক্যান্সেলেশনের জন্য আপডেটগুলি কীভাবে গঠন করতে হয় তা প্রদর্শন করে। সমর্থিত ইভেন্টগুলির তালিকা এবং তাদের সংজ্ঞার জন্য, অর্ডার লাইফসাইকেল ওভারভিউতে অ্যাডজাস্টমেন্ট ইভেন্টগুলি দেখুন।
অর্ডার বাতিল এবং ফেরত
এই উদাহরণে এমন একটি অর্ডার দেখানো হয়েছে, যেখানে অর্ডারটি দেওয়ার অল্প সময়ের মধ্যেই পণ্যটি বাতিল করে অর্থ ফেরত দেওয়া হয়েছিল।
এই সংস্করণে এই উদাহরণে প্রধান পরিবর্তনগুলি হলো:
-
cancellationদ্বারা প্রভাবিত লাইন আইটেমগুলো এখন মূলline_itemsঅ্যারেতে"status": "removed"ব্যবহার করে। - যখন
line_items.statusremovedহয়:-
line_items.quantity.totalএর মান0নির্ধারণ করা হয়েছে। - আসল পরিমাণটি নতুন
line_items.quantity.originalফিল্ডে সংরক্ষিত থাকে।
-
প্রয়োজনীয় হেডার:
-
Webhook-Id: adj_refund_1 -
Webhook-Timestamp: 2026-02-09T11:05:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_02",
"checkout_id": "checkout_02",
"currency": "USD",
"line_items": [
{
"id": "line_2",
"item": {
"id": "product_456",
"title": "Smart Watch",
"price": 29900
},
"quantity": {
"total": 0, // Item removed from order total.
"original": 1, // Original quantity before removal.
"fulfilled": 0 // Item was not fulfilled before cancellation.
},
"totals": [
{"type": "subtotal", "amount": 29900},
{"type": "tax", "amount": 2400},
{"type": "total", "amount": 32300}
],
"status": "removed" // Item is cancelled, returned, or refunded.
}
],
"totals": [
{"type": "subtotal", "amount": 29900},
{"type": "tax", "amount": 2400},
{"type": "total", "amount": 32300}
],
// Fulfillment expectations should still be present even if cancelled early.
"fulfillment": {
"expectations": [
{
"id": "exp_1",
"line_items": [{ "id": "line_2", "quantity": 1 }],
"method_type": "shipping",
"destination": {
"first_name": "Bob",
"last_name": "Consumer",
"street_address": "456 Oak Ave",
"address_locality": "Anytown",
"address_region": "CA",
"address_country": "US",
"postal_code": "90210"
},
"description": "Standard Shipping",
"fulfillable_on": "now"
}
]
// "events": [] // No fulfillment events occurred before cancellation.
},
"adjustments": [
{
"id": "adj_cancel_1",
"type": "cancellation",
"description": "Customer changed mind",
"line_items": [{ "id": "line_2", "quantity": -1 }],
"occurred_at": "2026-02-09T11:00:00Z",
"status": "completed"
},
{
"id": "adj_refund_1",
"type": "refund",
"description": "Refund for cancelled item",
"line_items": [{ "id": "line_2", "quantity": -1 }],
"totals": [
{"type": "subtotal", "display_text": "Subtotal", "amount": -29900}, // Negative amounts indicate money returned to the buyer. Tax-inclusive markets: Set display_text to "Subtotal (including taxes)". Amount must include tax.
{"type": "tax", "amount": -2400}, // Tax-inclusive markets: Omit this entry.
{"type": "total", "display_text": "Total", "amount": -32300}
],
"occurred_at": "2026-02-09T11:05:00Z",
"status": "completed"
}
],
"permalink_url": "https://merchant.example.com/orders/12345"
}
অর্ডার ফেরত এবং রিফান্ড
এই উদাহরণটিতে এমন একটি অর্ডার দেখানো হয়েছে, যেখানে পণ্যটি পাঠানো, ডেলিভারি করা এবং তারপর ফেরত নিয়ে টাকা ফেরত দেওয়া হয়েছে।
এই সংস্করণে এই উদাহরণে প্রধান পরিবর্তনগুলি হলো:
-
returnদ্বারা প্রভাবিত লাইন আইটেমগুলো এখন মূলline_itemsঅ্যারেতে"status": "removed"ব্যবহার করে। - যখন
line_items.statusremovedহয়:-
line_items.quantity.totalএর মান0নির্ধারণ করা হয়েছে। - আসল পরিমাণটি নতুন
line_items.quantity.originalফিল্ডে সংরক্ষিত থাকে।
-
-
returnটাইপেরadjustmentsক্ষেত্রে, আইটেমগুলো ফেরত নেওয়া হচ্ছে তা বোঝাতে অ্যাডজাস্টমেন্টের ভেতরেরline_items.quantityফিল্ডে একটি নেগেটিভ ভ্যালু (যেমন,-1) ব্যবহার করা হয়।
প্রয়োজনীয় হেডার:
-
Webhook-Id: adj_refund_2 -
Webhook-Timestamp: 2026-02-10T10:00:00Z
{
"ucp": {
"version": "2026-04-08",
"capabilities": {
"dev.ucp.shopping.order": [{"version": "2026-04-08"}]
}
},
"id": "order_03",
"checkout_id": "checkout_03",
"currency": "USD",
"line_items": [
{
"id": "line_3",
"item": {
"id": "product_789",
"title": "Wireless Earbuds",
"price": 14900
},
"quantity": {
"total": 0, // Item removed from order total.
"original": 1, // Original quantity before removal.
"fulfilled": 1 // Was fulfilled before return.
},
"totals": [
{"type": "subtotal", "amount": 14900},
{"type": "tax", "amount": 1200},
{"type": "total", "amount": 16100}
],
"status": "removed" // Item is cancelled, returned, or refunded.
}
],
"totals": [
{"type": "subtotal", "amount": 14900},
{"type": "tax", "amount": 1200},
{"type": "total", "amount": 16100}
],
"fulfillment": {
"events": [
{
"id": "fulfill_evt_1",
"occurred_at": "2026-02-05T09:00:00Z",
"type": "shipped",
"line_items": [{ "id": "line_3", "quantity": 1 }],
"tracking_number": "987654321",
"tracking_url": "https://fedex.com/track/987654321",
"carrier": "FedEx",
"description": "Item shipped"
},
{
"id": "fulfill_evt_2",
"occurred_at": "2026-02-07T16:00:00Z",
"type": "delivered",
"line_items": [{ "id": "line_3", "quantity": 1 }],
"tracking_number": "987654321",
"tracking_url": "https://fedex.com/track/987654321",
"carrier": "FedEx",
"description": "Item delivered"
},
{
"id": "fulfill_evt_3",
"occurred_at": "2026-02-09T09:00:00Z",
"type": "returned",
"line_items": [{ "id": "line_3", "quantity": 1 }],
"tracking_number": "987654321",
"tracking_url": "https://fedex.com/track/987654321",
"carrier": "FedEx",
"description": "Item returned"
}
],
"expectations": [{ "...": "..." }]
},
"adjustments": [
{
"id": "adj_return_1",
"type": "return", // a matching fulfillment event is also added to represent return shipping.
"description": "Item not compatible",
"line_items": [{ "id": "line_3", "quantity": -1 }], // Uses a negative value (such as -1) to indicate a return.
"occurred_at": "2026-02-09T09:00:00Z",
"status": "completed"
},
{
"id": "adj_refund_2",
"type": "refund",
"description": "Refund for returned item",
"line_items": [{ "id": "line_3", "quantity": -1 }],
"totals": [
{"type": "subtotal", "amount": -14900}, // Negative amounts indicate money returned to the buyer.
{"type": "tax", "amount": -1200},
{"type": "total", "amount": -16100}
],
"occurred_at": "2026-02-10T10:00:00Z",
"status": "completed"
}
],
"permalink_url": "https://merchant.example.com/orders/67890"
}