इस गाइड में, यूनिवर्सल कॉमर्स प्रोटोकॉल (यूसीपी) के नेटिव चेकआउट के वर्शन 2026-01-23 के लिए, तकनीकी एपीआई रेफ़रंस और पेलोड स्कीमा दिए गए हैं.
अपने एंडपॉइंट बनाने से पहले, पक्का करें कि आपने सीधे चेकआउट करने की सुविधा की खास जानकारी पढ़ ली हो. इसमें चेकआउट प्रोसेस, पुष्टि करने से जुड़ी ज़रूरी शर्तें, और डेवलपर टूल के बारे में बताया गया है.
चेकआउट सेशन बनाना
इस एंडपॉइंट की मदद से, ऐसा चेकआउट सेशन बनाया जा सकता है जिसमें वे प्रॉडक्ट शामिल हों जिन्हें कोई व्यक्ति खरीदना चाहता है.
- एंडपॉइंट:
POST /checkout-sessions - ट्रिगर: उपयोगकर्ता किसी प्रॉडक्ट पर "अभी खरीदें" या कार्ट में जाकर "Google पर चेकआउट करें" पर क्लिक करता है.
अनुरोध: Google, खरीदार के बारे में लाइन आइटम और पते की सीमित जानकारी भेजता है. इसमें शहर, राज्य, और पिन कोड शामिल होता है.
// Request Example: Create checkout with multiple items.
{
"line_items": [
{
"item": {
// Must match ID in product feed
"id": "product_12345"
},
"quantity": 1
},
{
"item": {
// Must match ID in product feed
"id": "product_67890"
},
"quantity": 1
}
],
"context": {
"language": "en"
},
"fulfillment": {
"methods": [
{
"type": "shipping",
"line_item_ids": [
"line_1",
"line_2"
],
"destinations": [
{
"id": "addr_1",
"address_locality": "Sunnyvale",
"address_region": "CA",
"postal_code": "94089",
"address_country": "US"
}
],
"selected_destination_id": "addr_1"
}
]
}
}
जवाब: आपको कुल कीमत, टैक्स (शुरुआत में अनुमानित), और पेमेंट की सुविधाओं के साथ शुरू किया गया सेशन वापस मिलता है.
// Response Example: Initialize Session with multiple items.
{
"ucp": {
"version": "2026-01-23",
"capabilities": {
"dev.ucp.shopping.checkout": [ { "version": "2026-01-23" } ],
"dev.ucp.shopping.fulfillment": [ { "version": "2026-01-23", "extends": "dev.ucp.shopping.checkout" } ]
},
"payment_handlers": {
"com.google.pay": [
{
"id": "8c9202bd-63cc-4241-8d24-d57ce69ea31c",
"version": "2026-01-23",
"spec": "https://pay.google.com/gp/p/ucp/2026-01-23/",
"schema": "https://pay.google.com/gp/p/ucp/2026-01-23/schemas/config.json",
"config": {
"api_version": 2,
"api_version_minor": 0,
"environment": "TEST",
"merchant_info": {
"merchant_name": "Example Merchant",
"merchant_id": "KWMZPRLQFTYNXSDB",
"merchant_origin": "checkout.merchant.com"
},
"allowed_payment_methods": [
{
"type": "CARD",
"parameters": {
"allowed_auth_methods": [ "PAN_ONLY", "CRYPTOGRAM_3DS" ],
"allowed_card_networks": [
"AMEX",
"DISCOVER",
"JCB",
"MASTERCARD",
"VISA"
],
"billing_address_required": true,
"billing_address_parameters": {
"format": "FULL",
"phone_number_required": true
}
},
"tokenization_specification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "example",
"gatewayMerchantId": "exampleGatewayMerchantId"
}
}
}
]
}
}
]
}
},
"id": "da2e25ec-eef8-41b7-a439-4e62dea41bdc",
"status": "incomplete",
"messages": [
{
"type": "error",
"code": "missing_buyer_info",
"path": "$.buyer",
"content_type": "plain",
"content": "Buyer information is required for checkout",
"severity": "recoverable"
},
{
"type": "error",
"code": "missing_fulfillment_info",
"path": "$.fulfillment.methods[0].destinations[0]",
"content_type": "plain",
"content": "Shipping address is incomplete",
"severity": "recoverable"
}
],
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item": {
"id": "product_12345",
"title": "Running Shoes",
"price": 10000,
"image_url": "https://merchant.example.com/images/product_12345.png"
},
"quantity": 1,
"totals": [
{
"type": "subtotal",
"amount": 10000
},
{
"type": "total",
"amount": 10000
}
]
},
{
"id": "line_2",
"item": {
"id": "product_67890",
"title": "T-Shirt",
"price": 2500,
"image_url": "https://merchant.example.com/images/product_67890.png"
},
"quantity": 1,
"totals": [
{
"type": "subtotal",
"amount": 2500
},
{
"type": "total",
"amount": 2500
}
]
}
],
"totals": [
{
"type": "subtotal",
"display_text": "Subtotal", // Tax-inclusive markets: Set to "Subtotal (including taxes)".
"amount": 12500 // Tax-inclusive markets: Amount must include tax.
},
{
"type": "fulfillment",
"display_text": "Ground Shipping", // Tax-inclusive markets: Provide display text for fulfillment totals.
"amount": 500
},
{
"type": "tax", // Tax-inclusive markets: Omit this entry.
"display_text": "Estimated Tax",
"amount": 100
},
{
"type": "total",
"amount": 13100
}
],
"fulfillment": {
"methods": [
{
"id": "method_shipping",
"type": "shipping",
"line_item_ids": [
"line_1",
"line_2"
],
"destinations": [
{
"id": "addr_1",
"address_locality": "Sunnyvale",
"address_region": "CA",
"postal_code": "94089",
"address_country": "US"
}
],
"selected_destination_id": "addr_1",
"groups": [
{
"id": "group_1",
"line_item_ids": [
"line_1",
"line_2"
],
"options": [
{
"id": "ship_ground",
"title": "Ground (3-5 days)",
"description": "Estimated Delivery: Fri 5/8", // Maximum length: 200 characters.
"totals": [ {"type": "total", "amount": 500} ]
},
{
"id": "ship_express",
"title": "Express (1-2 days)",
"description": "Estimated Delivery: Wed 5/6", // Maximum length: 200 characters.
"totals": [ {"type": "total", "amount": 1500} ]
}
],
"selected_option_id": "ship_ground"
}
]
}
]
},
"links": [
{
"type": "terms_of_service",
"url": "https://m.com/terms",
"title": "Terms of Service"
},
{
"type": "privacy_policy",
"url": "https://m.com/privacy",
"title": "Privacy Policy"
}
]
}
टैक्स के साथ कीमत
जिन देशों/इलाकों में टैक्स को अलग से न दिखाकर, दिखाए गए सबटोटल में शामिल किया जाता है वहां चेकआउट सेशन का डेटा देते समय, आपको इन ज़रूरी शर्तों का पालन करना होगा:
- सबटोटल में टैक्स शामिल करें:
subtotalएंट्री के लिएamountफ़ील्ड में, लागू होने वाले सभी टैक्स शामिल होने चाहिए. - टैक्स की अलग-अलग एंट्री शामिल न करें:
totalsऐरे मेंtype: "tax"वाला कोई अलग ऑब्जेक्ट शामिल न करें. - कस्टम डिसप्ले टेक्स्ट दें: आपको सबटोटल ऑब्जेक्ट में
display_textएट्रिब्यूट शामिल करना होगा. इससे यह साफ़ तौर पर पता चलता है कि टैक्स शामिल हैं. जैसे,"Subtotal (including taxes)". आपको फ़ुलफ़िलमेंट की एंट्री के लिएdisplay_textएट्रिब्यूट भी शामिल करना होगा. जैसे,"Shipping".
उदाहरण: टैक्स के साथ कुल कीमत दिखाने वाला ऐरे
यहां टैक्स शामिल करने वाले देश/इलाके में मौजूद किसी कारोबारी या कंपनी के लिए, totals कलेक्शन का उदाहरण दिया गया है:
"totals": [
{
"type": "subtotal",
"display_text": "Subtotal (including taxes)",
"amount": 12500
},
{
"type": "fulfillment",
"display_text": "Shipping",
"amount": 399
},
{
"type": "total",
"display_text": "Total",
"amount": 12899
}
]
चेकआउट सेशन पाना
इस एंडपॉइंट से, चेकआउट सेशन की जानकारी वापस पाई जा सकती है.
- एंडपॉइंट:
GET /checkout-sessions/{id}
अनुरोध: Google, चेकआउट सेशन का आईडी भेजता है. अगर ग्लोबल आईडी का इस्तेमाल किया जाता है
(जैसे, gid://merchant.example.com/Checkout/session_abc123), तो ध्यान दें कि अनुरोध पाथ में मौजूद आईडी, इस आईडी का सिर्फ़ आखिरी कॉम्पोनेंट होगा (जैसे, session_abc123).
जवाब: आपको पूरा चेकआउट ऑब्जेक्ट वापस भेजना होगा. 2026-01-23 या इसके बाद के वर्शन में बनाए गए एक से ज़्यादा आइटम वाले सेशन के लिए, line_items अरे में एक से ज़्यादा आइटम एंट्री होंगी.
चेकआउट सेशन अपडेट करना
इस एंडपॉइंट की मदद से, चेकआउट सेशन को अपडेट किया जा सकता है. शिपिंग पता अपडेट होने पर, उसे टैक्स और शिपिंग के विकल्पों की फिर से गणना करनी होगी और उन्हें दिखाना होगा.
- एंडपॉइंट:
PUT /checkout-sessions/{id}
शिपिंग पता अपडेट करना
- ट्रिगर: जब उपयोगकर्ता शिपिंग पता चुनता है या बदलता है.
अनुरोध: जब उपयोगकर्ता शिपिंग का पता बदलता है, तो Google, फ़ुलफ़िलमेंट का पता अपडेट कर देता है.
// Request Example: Update shipping address with multiple items.
{
"line_items": [
{
// line_items id from Create Checkout response
"id": "line_1",
"item": {
"id": "product_12345"
},
"quantity": 1
},
{
// line_items id from Create Checkout response
"id": "line_2",
"item": {
"id": "product_67890"
},
"quantity": 1
}
],
"fulfillment": {
"methods": [
{
"id": "method_shipping",
"type": "shipping",
"line_item_ids": [
"line_1",
"line_2"
],
"destinations": [
{
"id": "addr_1",
"address_locality": "Mountain View",
"address_region": "CA",
"postal_code": "94043",
"address_country": "US"
}
],
"selected_destination_id": "addr_1",
"groups": [
{
"id": "group_1",
"selected_option_id": "ship_ground"
}
]
}
]
}
}
जवाब: ज़रूरी होने पर, टैक्स और शिपिंग के विकल्पों की फिर से गिनती करें. इसके बाद, पूरा चेकआउट ऑब्जेक्ट वापस भेजें.
// Response Example: Updated session with new address for multiple items.
{
"id": "da2e25ec-eef8-41b7-a439-4e62dea41bdc",
"currency": "USD",
"line_items": [
{
"id": "line_1",
"item": {
"id": "product_12345",
"title": "Running Shoes",
"price": 10000,
"image_url": "https://merchant.example.com/images/product_12345.png"
},
"quantity": 1,
"totals": [
{ "type": "subtotal", "amount": 10000 },
{ "type": "total", "amount": 10000 }
]
},
{
"id": "line_2",
"item": {
"id": "product_67890",
"title": "T-Shirt",
"price": 2500,
"image_url": "https://merchant.example.com/images/product_67890.png"
},
"quantity": 1,
"totals": [
{ "type": "subtotal", "amount": 2500 },
{ "type": "total", "amount": 2500 }
]
}
],
"totals": [
{ "type": "subtotal", "amount": 12500 },
// Shipping cost might change based on new address
{ "type": "fulfillment", "display_text": "Ground Shipping", "amount": 600 },
// Tax will likely change based on new address
{ "type": "tax", "amount": 1120 },
{ "type": "total", "amount": 14220 }
],
"fulfillment": {
"methods": [
{
"id": "method_shipping",
"type": "shipping",
"line_item_ids": ["line_1", "line_2"],
"selected_destination_id": "addr_1",
"destinations": [
{
"id": "addr_1",
"address_locality": "Mountain View",
"address_region": "CA",
"postal_code": "94043",
"address_country": "US"
}
],
"groups": [
{
"id": "group_1",
"line_item_ids": ["line_1", "line_2"],
"selected_option_id": "ship_ground",
"options": [
{
"id": "ship_ground",
"title": "Ground (3-5 days)",
"description": "Estimated Delivery: Fri 5/8", // Maximum length: 200 characters.
"totals": [ { "type": "total", "amount": 600 } ]
},
{
"id": "ship_express",
"title": "Express (1-2 days)",
"description": "Estimated Delivery: Wed 5/6", // Maximum length: 200 characters.
"totals": [ { "type": "total", "amount": 1600 } ]
}
]
}
]
}
]
}
// ... other fields like ucp, status, messages, links
}
चेकआउट ऑब्जेक्ट के हाइड्रेशन की पूरी प्रोसेस
अनुरोध: जब खरीदार "GPay से पेमेंट करें" पर क्लिक करता है, तब Google अपडेट की गई जानकारी के साथ पूरा चेकआउट ऑब्जेक्ट भेजता है. इसमें खरीदार का पूरा पता और संपर्क जानकारी शामिल होती है.
// Request Example: full checkout object hydration for multiple items.
{
"buyer": {
"first_name": "John",
"last_name": "Buyer",
"email": "johnbuyer@example.com",
"phone_number": "+18888888888"
},
"line_items": [
{
"id": "line_1",
"item": { "id": "product_12345" },
"quantity": 1
},
{
"id": "line_2",
"item": { "id": "product_67890" },
"quantity": 1
}
],
"fulfillment": {
"methods": [
{
"id": "method_shipping",
"type": "shipping",
"line_item_ids": ["line_1", "line_2"],
"selected_destination_id": "addr_1",
"destinations": [
{
"id": "addr_1",
"first_name": "Alice",
"last_name": "Receiver",
"street_address": "1600 Amphitheatre Pkwy",
"extended_address": "Suite #60",
"address_locality": "Mountain View",
"address_region": "CA",
"postal_code": "94043",
"address_country": "US",
"phone_number": "+18888888888"
}
],
"groups": [
{
"id": "group_1",
"selected_option_id": "ship_ground"
}
]
}
]
}
}
जवाब: ज़रूरी होने पर, टैक्स और शिपिंग के विकल्पों की फिर से गिनती करें. इसके बाद, पूरा चेकआउट ऑब्जेक्ट वापस भेजें.
// Response Example: Session after full hydration with multiple items.
{
"ucp": {
"version": "2026-01-23",
"capabilities": {
"dev.ucp.shopping.checkout": [ { "version": "2026-01-23" } ],
"dev.ucp.shopping.fulfillment": [ { "version": "2026-01-23", "extends": "dev.ucp.shopping.checkout" } ]
},
"payment_handlers": {
"com.google.pay": [
{
"id": "8c9202bd-63cc-4241-8d24-d57ce69ea31c",
"version": "2026-01-23",
"spec": "https://pay.google.com/gp/p/ucp/2026-01-23/",
"schema": "https://pay.google.com/gp/p/ucp/2026-01-23/schemas/config.json",
"config": {
"api_version": 2,
"api_version_minor": 0,
"environment": "TEST",
"merchant_info": {
"merchant_name": "Example Merchant",
"merchant_id": "KWMZPRLQFTYNXSDB",
"merchant_origin": "checkout.merchant.com"
},
"allowed_payment_methods": [
{
"type": "CARD",
"parameters": {
"allowed_auth_methods": [ "PAN_ONLY", "CRYPTOGRAM_3DS" ],
"allowed_card_networks": [ "AMEX", "DISCOVER", "JCB", "MASTERCARD", "VISA" ],
"billing_address_required": true,
"billing_address_parameters": {
"format": "FULL",
"phone_number_required": true
}
},
"tokenization_specification": {
"type": "PAYMENT_GATEWAY",
"parameters": {
"gateway": "example",
"gatewayMerchantId": "exampleGatewayMerchantId"
}
}
}
]
}
}
]
}
},
"id": "da2e25ec-eef8-41b7-a439-4e62dea41bdc",
"status": "ready_for_complete",
"currency": "USD",
"buyer": {
"first_name": "John",
"last_name": "Buyer",
"email": "johnbuyer@example.com",
"phone_number": "+18888888888"
},
"line_items": [
{
"id": "line_1",
"item": {
"id": "product_12345",
"title": "Running Shoes",
"price": 10000,
"image_url": "https://merchant.example.com/images/product_12345.png"
},
"quantity": 1,
"totals": [
{ "type": "subtotal", "amount": 10000 },
{ "type": "total", "amount": 10000 }
]
},
{
"id": "line_2",
"item": {
"id": "product_67890",
"title": "T-Shirt",
"price": 2500,
"image_url": "https://merchant.example.com/images/product_67890.png"
},
"quantity": 1,
"totals": [
{ "type": "subtotal", "amount": 2500 },
{ "type": "total", "amount": 2500 }
]
}
],
"totals": [
{ "type": "subtotal", "display_text": "Subtotal", "amount": 12500 },
{ "type": "fulfillment", "display_text": "Ground Shipping", "amount": 600 },
{ "type": "tax", "display_text": "Estimated Tax", "amount": 1120 },
{ "type": "total", "display_text": "Total", "amount": 14220 }
],
"fulfillment": {
"methods": [
{
"id": "method_shipping",
"type": "shipping",
"line_item_ids": ["line_1", "line_2"],
"selected_destination_id": "addr_1",
"destinations": [
{
"id": "addr_1",
"first_name": "Alice",
"last_name": "Receiver",
"street_address": "1600 Amphitheatre Pkwy",
"extended_address": "Suite #60",
"address_locality": "Mountain View",
"address_region": "CA",
"postal_code": "94043",
"address_country": "US",
"phone_number": "+18888888888"
}
],
"groups": [
{
"id": "group_1",
"line_item_ids": ["line_1", "line_2"],
"selected_option_id": "ship_ground",
"options": [
{
"id": "ship_ground",
"title": "Ground (3-5 days)",
"description": "Estimated Delivery: Fri 5/8", // Maximum length: 200 characters.
"totals": [ { "type": "total", "amount": 600 } ]
},
{
"id": "ship_express",
"title": "Express (1-2 days)",
"description": "Estimated Delivery: Wed 5/6", // Maximum length: 200 characters.
"totals": [ { "type": "total", "amount": 1600 } ]
}
]
}
]
}
]
},
"links": [
{
"type": "terms_of_service",
"url": "https://m.com/terms",
"title": "Terms of Service"
},
{
"type": "privacy_policy",
"url": "https://m.com/privacy",
"title": "Privacy Policy"
}
]
}
चेकआउट सेशन पूरा करें
इस एंडपॉइंट की मदद से, चेकआउट सेशन पूरा किया जा सकता है और ऑर्डर दिया जा सकता है. इससे पूरा किया गया चेकआउट सेशन दिखना चाहिए. साथ ही, इसमें ऑर्डर की जानकारी भी शामिल होनी चाहिए. यह कॉल मिलने के बाद, पेमेंट प्रोसेस करना शुरू कर दें.
- एंडपॉइंट:
POST /checkout-sessions/{id}/complete - ट्रिगर: जब उपयोगकर्ता "GPay से पेमेंट करें" पर क्लिक करता है और Google को पूरी जानकारी वाले चेकआउट अपडेट से सही जवाब मिलता है.
अनुरोध: Google, पेमेंट हैंडलर से खरीदार के चुने गए पेमेंट इंस्ट्रूमेंट की जानकारी भेजता है.इसमें क्रेडेंशियल (जैसे, Google Pay टोकनाइज़ेशन का डेटा) और खरीदार के बारे में जोखिम से जुड़े सिग्नल शामिल होते हैं. इससे आपको धोखाधड़ी का पता लगाने में मदद मिलती है. टोकन का कॉन्टेंट, पेमेंट की सेवा देने वाली कंपनी पर निर्भर करेगा.
{
"payment": {
"instruments": [
{
"billing_address": {
"first_name": "John",
"last_name": "Buyer",
"street_address": "100 Main St",
"extended_address": "Apt 4B",
"address_locality": "San Francisco",
"address_region": "CA",
"postal_code": "94105",
"address_country": "US",
"phone_number": "+18888888888"
},
"credential": {
"token": "examplePaymentMethodToken",
"type": "PAYMENT_GATEWAY"
},
"display": {
"brand": "VISA",
"description": "Visa •••• 1234",
"last_digits": "1234"
},
"handler_id": "8c9202bd-63cc-4241-8d24-d57ce69ea31c",
"id": "94e7fee0-1a82-4c2a-9ef4-0861a3c829b2",
"selected": true,
"type": "card"
}
]
},
"signals": {
"com.google.authentication_triggered": "",
"com.google.authorization_processed_with_3ds": "",
"com.google.avs_full_result": "",
"com.google.cvv_result": "",
"com.google.ip_address": "203.0.113.1",
"dev.ucp.buyer_id": "ec46fedc6aad89d3660a50a61d00b4908fd160ecf5dda6d49ed41a605c5b180a",
"dev.ucp.buyer_ip": "203.0.113.1"
}
}
अगर आपको चेकआउट पूरा करने के लिए ऐसी ज़रूरी जानकारी चाहिए जो चेकआउट सेशन में नहीं दी गई है, तो चेकआउट पूरा होने से रोका जा सकता है. साथ ही, जवाब में 'पूरा नहीं हुआ' स्टेटस भेजकर, उस जानकारी का अनुरोध किया जा सकता है.
अगर Google, यूसीपी के तय किए गए फ़ील्ड का इस्तेमाल करके, छूटी हुई जानकारी इकट्ठा कर सकता है (उदाहरण के लिए, खरीदार का ईमेल पता), तो status को incomplete पर सेट करें. साथ ही, messages ऐरे में एक या उससे ज़्यादा मैसेज शामिल करें. इनमें severity को recoverable पर सेट करके, यह बताया गया हो कि कौनसी जानकारी मौजूद नहीं है.
{
"id": "da2e25ec-eef8-41b7-a439-4e62dea41bdc",
"status": "incomplete",
"messages": [
{
"type": "error",
"code": "missing_buyer_info",
"severity": "recoverable",
"content": "Buyer email is required"
},
{
"type": "error",
"code": "missing_fulfillment_info",
"severity": "recoverable",
"content": "Select delivery window for your purchase"
}
]
}
Google Pay के पेमेंट इंस्ट्रूमेंट मिलने पर, आपको ये काम करने होंगे:
- पुष्टि करने वाला हैंडलर: पुष्टि करें कि
handler_id, आपके कॉन्फ़िगरेशन में तय किए गए Google Pay पेमेंट हैंडलर से मेल खाता हो. - टोकन निकालना: जनरेट किए गए पेमेंट के तरीके का टोकन,
payment.instruments[0].credential.tokenसे वापस पाएं. - पेमेंट प्रोसेस करना: पेमेंट पूरा करने के लिए, टोकन और लेन-देन की जानकारी का इस्तेमाल करें. टोकनाइज़ेशन के बारे में खास जानकारी और इसे मैनेज करने के तरीके के बारे में ज़्यादा जानकारी के लिए, Google Pay API के दस्तावेज़ देखें.
जवाब: अगर चेकआउट की प्रोसेस पूरी की जा सकती है और आपने पेमेंट प्रोसेस कर दिया है, तो
पूरा चेकआउट ऑब्जेक्ट वापस भेजें. इससे पता चलेगा कि ऑर्डर पूरा हो गया है. इसमें
पुष्टि किया गया पेमेंट करने का तरीका (इंस्ट्रूमेंट के मेटाडेटा और बिलिंग पते की जानकारी
देना, जिसमें संवेदनशील credential टोकन या signals शामिल नहीं है), ऑर्डर आईडी, और ऑर्डर का
स्थायी लिंक यूआरएल शामिल है.
{
"ucp": {
"version": "2026-01-23",
"capabilities": [...]
},
"id": "da2e25ec-eef8-41b7-a439-4e62dea41bdc",
"status": "completed",
// ... other fields (line_items, currency, etc.)
"payment": {
"instruments": [
{
"id": "94e7fee0-1a82-4c2a-9ef4-0861a3c829b2",
"handler_id": "8c9202bd-63cc-4241-8d24-d57ce69ea31c",
"type": "card",
"selected": true,
"display": {
"brand": "VISA",
"description": "Visa •••• 1234",
"last_digits": "1234"
},
"billing_address": {
"first_name": "John",
"last_name": "Buyer",
"street_address": "100 Main St",
"extended_address": "Apt 4B",
"address_locality": "San Francisco",
"address_region": "CA",
"postal_code": "94105",
"address_country": "US",
"phone_number": "+18888888888"
}
}
]
},
"order": {
"id": "ORD1773956535.2727807",
// Example customer-facing order number
"label": "#100",
"permalink_url": "https://merchant.example.com/orders/789"
}
}
चेकआउट सेशन रद्द करना
यह एंडपॉइंट, चेकआउट सेशन को रद्द करता है.
- एंडपॉइंट:
POST /checkout-sessions/{id}/cancel
अनुरोध: Google, चेकआउट सेशन का आईडी भेजता है.
जवाब: आपको पूरा चेकआउट ऑब्जेक्ट वापस भेजना होगा. साथ ही, स्टेटस को canceled पर अपडेट करना होगा.
गड़बड़ी ठीक करना
गड़बड़ी के मैसेज को फ़ॉर्मैट करने के तरीके और प्रोटोकॉल और कारोबारी नियमों से जुड़ी गड़बड़ियों के बीच के अंतर के बारे में पूरी जानकारी पाने के लिए, गड़बड़ी के कोड की खास जानकारी देखें.
वह गड़बड़ी जिसकी वजह से डेटा वापस नहीं पाया जा सकता
वर्शन 2026-01-23 के लिए, जब कारोबारी नियम से जुड़ी कोई ऐसी गड़बड़ी होती है जिसे ठीक नहीं किया जा सकता और इस वजह से चेकआउट सेशन नहीं बनाया जा सकता (जैसे, सभी आइटम स्टॉक में नहीं हैं), तो एचटीटीपी 200 OK दिखाएं.
वर्शन 2026-01-23 में, आपको टर्मिनल फ़ेल होने की जानकारी देनी होगी. इसके लिए, चेकआउट सेशन आईडी को हटाना होगा और messages ऐरे में "severity": "unrecoverable" को शामिल करना होगा. इससे Google को पता चलता है कि अनुरोध मान्य था, लेकिन कारोबार के नियम की वजह से सेशन नहीं बनाया जा सका.
HTTP/1.1 200 OK
Content-Type: application/json
{
"ucp": {
"version": "2026-01-23"
},
"messages": [
{
"type": "error",
"code": "out_of_stock",
"content": "All requested items are currently out of stock",
"severity": "unrecoverable"
}
],
"continue_url": "https://merchant.com/"
}