অর্ডারের জীবনচক্র (ক্রয়ের পরে)

চেকআউট সম্পন্ন হওয়ার পর এবং অর্ডার দেওয়ার পর, আপনাকে Webhooks ব্যবহার করে Google-এ স্ট্যাটাস আপডেট পাঠাতে হবে। API কীটি অবশ্যই কোয়েরি প্যারামিটার বা হেডারে পাঠাতে হবে।

১. অর্ডার তৈরি ইভেন্ট

  • ট্রিগার: অর্ডার নিশ্চিত হওয়ার পরপরই ( status: processing )।
  • শেষবিন্দু: POST /webhooks/partners/{partner_id}/events/order

পেলোড: আপনাকে অবশ্যই সম্পূর্ণ অর্ডার সত্তা পাঠাতে হবে।

{
  "ucp": { "version": "2026-01-01", "capabilities": [...] },
  "id": "order_789",
  "checkout_id": "checkout_xyz789",
  "line_items": [
    {
      "id": "line_1",
      "item":
        {
          "id": "product_12345",
          "title": "Running Shoes",
          "price": 10000
        },
      "quantity": { "total": 1, "fulfilled": 0 },
      "totals": [
        {"type": "subtotal", "amount": 10000},
        {"type": "total", "amount": 10000}
      ],
      "status": "processing"
    }
  ],
  "fulfillment": {
    "expectations": [
      {
        "id": "exp_1",
        "line_items": [{ "id": "line_1", "quantity": 1 }],
        "method_type": "shipping",
        "destination": {
          "street_address": "123 Main St",
          "address_locality": "Austin",
          "address_region": "TX",
          "address_country": "US",
          "postal_code": "78701"
        },
        "description": "Arrives in 2-3 business days",
        "fulfillable_on": "now"
      }
    ]
  },
  "permalink_url": "https://merchant.example.com/orders/789"
}

2. অর্ডার আপডেট (শিপিং/বাতিলকরণ)

  • ট্রিগার: যখন অর্ডারের অবস্থা আপডেট করা হয় (যেমন, পণ্য পাঠানো হয় বা বাতিল করা হয়)।
  • প্রয়োজনীয়তা: আপনাকে কেবল আংশিক আপডেট নয়, সম্পূর্ণ অর্ডার সত্তাটি আবার পাঠাতে হবে।

উদাহরণ (পাঠানো):

{
  "id": "order_789",
  "checkout_id": "checkout_xyz789",
  // Full line items must be included
  "line_items": [
    {
      "id": "line_1",
      "item":
        {
          "id": "product_12345",
          "title": "Running Shoes",
          "price": 10000
        },
      "quantity": { "total": 1, "fulfilled": 1 },
      "totals": [
        {"type": "subtotal", "amount": 10000},
        {"type": "total", "amount": 10000}
      ],
      "status": "fulfilled"
    }
  ],
  // Updated fulfillment details
  "fulfillment": {
    "events": [
      {
        "id": "evt_1",
        "occurred_at": "2025-01-08T10:30:00Z",
        "type": "shipped",
        "line_items": [{ "id": "line_1", "quantity": 1 }],
        "tracking_number": "123456789",
        "tracking_url": "https://fedex.com/track/123456789",
        "description": "Shipping departed from warehouse"
      }
    ]
  },
  "expectations": {"..."},
  "permalink_url": "https://merchant.example.com/orders/789"
}