Google Orders API-এ অ্যাকশন

অ্যাকশন অন গুগল অর্ডার এপিআই ডেভেলপারদের তাদের অ্যাকশনে ভৌত পণ্যের লেনদেন পরিচালনা করতে দেয়।

অনুরোধ প্রমাণীকরণ

API-এর এন্ডপয়েন্ট অ্যাক্সেসের জন্য OAuth 2.0 প্রমাণীকরণ প্রয়োজন। আপনার https://www.googleapis.com/auth/actions.order স্কোপের জন্য অনুমোদিত একটি OAuth 2.0 ব্যবহারকারী টোকেন প্রয়োজন।

টোকেন পেতে, আপনি পরিষেবা অ্যাকাউন্টের প্রবাহ ব্যতীত যেকোনও উপলব্ধ প্রবাহ ব্যবহার করতে পারেন।

নিম্নলিখিত স্নিপেটে একটি উদাহরণ অর্ডারের JSON পেলোড রয়েছে:

{
  "order": {
    "merchantOrderId": "1234",
    "userVisibleOrderId": "6789",
    "userVisibleStateLabel": "CONFIRMED",
    "buyerInfo": {
      "email": "xyz@example.com",
      "firstName": "Jane",
      "lastName": "Doe",
      "displayName": "Jane Doe",
      "phoneNumbers": [
        {
          "e164PhoneNumber": "+1234567890"
        }
      ]
    },
    "image": {
      "url": "www.someurl.com"
    },
    "createTime": "2017-01-15T01:30:15.01Z",
    "lastUpdateTime": "2017-01-15T01:30:15.01Z",
    "transactionMerchant": {
      "id": "www.examplemerchant.com",
      "name": "Example Merchant",
      "image": {
        "url": "www.someurl.com"
      },
      "phoneNumbers": [
        {
          "e164PhoneNumber": "+11112223333"
        }
      ],
      "address": {
        "zipCode": "94043",
        "city": "Mountain View",
        "postalAddress": {
          "regionCode": "US",
          "postalCode": "94043",
          "administrativeArea": "CA",
          "locality": "Mountain View",
          "addressLines": [
            "1600, Amphiteatre Parkway"
          ]
        }
      }
    },
    "contents": {
      "lineItems": [
        {
          "id": "1",
          "name": "Pizza Extreme",
          "description": "Has everything a pizza should have",
          "notes": [
            "Vegetarian please"
          ],
          "priceAttributes": [
            {
              "type": "REGULAR",
              "name": "Item Price",
              "state": "ACTUAL",
              "amount": {
                "currencyCode": "USD",
                "amountInMicros": "6000000"
              },
              "taxIncluded": false
            }
          ],
          "vertical": {
            "@type": "type.googleapis.com/google.actions.orders.v3.verticals.purchase.PurchaseItemExtension",
            "productId": "www.examplemerchant.com/123/3333",
            "quantity": 1,
            "itemOptions": [
              {
                "id": "",
                "name": "",
                "prices": [
                  {
                    "type": "REGULAR",
                    "name": "Item Price",
                    "state": "ACTUAL",
                    "amount": {
                      "currencyCode": "USD",
                      "amountInMicros": "2000000"
                    },
                    "taxIncluded": false
                  }
                ],
                "quantity": 1,
                "productId": "www.examplemerchant.com/123/3333/1",
                "subOptions": []
              }
            ]
          },
          "provider": {
            "id": "www.examplemerchant2.com/123",
            "name": "Example Merchant 2",
            "image": {},
            "phoneNumbers": [
              {
                "e164PhoneNumber": "+11112223333"
              }
            ],
            "address": {
              "zipCode": "94043",
              "city": "Mountain View",
              "postalAddress": {
                "regionCode": "US",
                "postalCode": "94043",
                "administrativeArea": "CA",
                "locality": "Mountain View",
                "addressLines": [
                  "1350 Charleston Road"
                ]
              }
            }
          }
        }
      ]
    },
    "priceAttributes": [
      {
        "type": "TOTAL",
        "name": "Total Price",
        "state": "ACTUAL",
        "amount": {
          "currencyCode": "USD",
          "amountInMicros": "10000000"
        },
        "taxIncluded": true
      },
      {
        "type": "TAX",
        "name": "Tax",
        "state": "ACTUAL",
        "amount": {
          "currencyCode": "USD",
          "amountInMicros": "2000000"
        },
        "taxIncluded": true
      },
      {
        "type": "SUBTOTAL",
        "name": "Subtotal",
        "state": "ACTUAL",
        "amount": {
          "currencyCode": "USD",
          "amountInMicros": "6000000"
        },
        "taxIncluded": false
      },
      {
        "type": "DELIVERY",
        "name": "Delivery",
        "state": "ACTUAL",
        "amount": {
          "currencyCode": "USD",
          "amountInMicros": "2000000"
        },
        "taxIncluded": false
      }
    ],
    "followUpActions": [
      {
        "type": "CALL",
        "title": "Call us",
        "openUrlAction": {
          "url": "tel:+16501112222"
        }
      },
      {
        "type": "EMAIL",
        "title": "Email us",
        "openUrlAction": {
          "url": "mailto:person@example.com"
        }
      }
    ],
    "paymentData": {
      "paymentInfo": {
        "paymentMethodDisplayInfo": {
          "paymentType": "PAYMENT_CARD",
          "paymentMethodDisplayName": "VISA **** 1234"
        },
        "paymentMethodProvenance": "PAYMENT_METHOD_PROVENANCE_GOOGLE"
      }
    },
    "termsOfServiceUrl": "www.examplemerchant.com/policy",
    "note": "Vegetarian only",
    "vertical": {
      "@type": "type.googleapis.com/google.actions.orders.v3.verticals.purchase.PurchaseOrderExtension",
      "status": "IN_PREPARATION",
      "type": "FOOD",
      "returnsInfo": {
        "isReturnable": false
      },
      "fulfillmentInfo": {
        "id": "www.examplemerchant.com/merchant-id/123",
        "fulfillmentType": "DELIVERY",
        "expectedFulfillmentTime": {
          "timeIso8601": "PT10M"
        },
        "location": {
          "zipCode": "94086",
          "city": "Sunnyvale",
          "postalAddress": {
            "regionCode": "US",
            "postalCode": "94086",
            "administrativeArea": "CA",
            "locality": "Sunnyvale",
            "addressLines": [
              "222, Some other Street"
            ]
          }
        },
        "price": {
          "type": "REGULAR",
          "name": "Delivery Price",
          "state": "ACTUAL",
          "amount": {
            "currencyCode": "USD",
            "amountInMicros": "2000000"
          },
          "taxIncluded": "FALSE"
        },
        "fulfillmentContact": {
          "email": "xyz@example.com",
          "firstName": "Jane",
          "lastName": "Doe",
          "displayName": "Jane Doe",
          "phoneNumbers": [
            {
              "e164PhoneNumber": "+16507146554"
            }
          ]
        }
      }
    }
  }
}