इस गाइड में, यूनिवर्सल कॉमर्स प्रोटोकॉल (यूसीपी) के नेटिव चेकआउट के वर्शन 2026-04-08 के लिए, तकनीकी एपीआई रेफ़रंस और पेलोड स्कीमा दिए गए हैं.
अपने एंडपॉइंट बनाने से पहले, पक्का करें कि आपने सीधे चेकआउट करने की सुविधा की खास जानकारी पढ़ ली हो. इसमें चेकआउट प्रोसेस, पुष्टि करने से जुड़ी ज़रूरी शर्तें, और डेवलपर टूल के बारे में बताया गया है.
चेकआउट सेशन बनाना
इस एंडपॉइंट की मदद से, ऐसा चेकआउट सेशन बनाया जा सकता है जिसमें वे प्रॉडक्ट शामिल हों जिन्हें कोई व्यक्ति खरीदना चाहता है.
- एंडपॉइंट:
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"
}
]
}
}
जवाब: आपको कुल कीमत, टैक्स (शुरुआत में अनुमानित), और पेमेंट की सुविधाओं के साथ शुरू किया गया सेशन वापस मिलता है.
ucp.status फ़ील्ड के बारे में जानकारी:
2026-04-08 वर्शन में पेश किया गया ucp.status फ़ील्ड, क्रिएटिव के बनने की स्थिति के बारे में बताता है:
"success"(या छोड़ा गया): डिफ़ॉल्ट. सेशन बनाया गया, भले हीmessagesको वापस लाया जा सकता हो."error": किसी ऐसी गड़बड़ी की वजह से सेशन नहीं बनाया जा सका जिसे ठीक नहीं किया जा सकता. उदाहरण के लिए, सभी आइटम स्टॉक में नहीं हैं. इस मामले में, जवाब का मुख्य हिस्सा गड़बड़ी का जवाब देने वाला ऑब्जेक्ट होना चाहिए, न कि चेकआउट ऑब्जेक्ट. गड़बड़ी ठीक करने से जुड़े सेक्शन में, ठीक न की जा सकने वाली गड़बड़ी का उदाहरण देखें.
totals ऐरे में किए गए बदलावों के बारे में जानकारी:
totalsकैटगरी में मौजूद हर ऑब्जेक्ट में मौजूदtypeफ़ील्ड अब एक ओपन स्ट्रिंग है.- अब
amountफ़ील्ड में नेगेटिव वैल्यू दी जा सकती है. उदाहरण के लिए, छूट दिखाने के लिए. totalsमें मौजूद ऑब्जेक्ट (जैसे किtype: "fee"औरtype: "tax") में, उप-कंपोनेंट की जानकारी देने के लिएlinesऐरे शामिल किया जा सकता है. उदाहरण के लिए, सेवा या रीसाइक्लिंग शुल्क या कनाडा के जीएसटी, पीएसटी या क्यूएसटी जैसे कई लेवल वाले प्रांतीय और संघीय टैक्स की जानकारी.- टैक्स के साथ कीमत: जिन देशों/इलाकों में टैक्स के साथ कीमत दिखाने की सुविधा उपलब्ध है वहां
subtotalमें टैक्स शामिल होना चाहिए. साथ ही,taxलाइन आइटम को शामिल नहीं किया जाना चाहिए. इसके अलावा,totalsमेंsubtotalऔरfulfillmentएंट्री के लिएdisplay_textकी जानकारी साफ़ तौर पर दी जानी चाहिए. ज़्यादा जानकारी के लिए, टैक्स के साथ कीमत देखें.
// Response Example: Initialize Session with multiple items.
{
"ucp": {
"version": "2026-04-08",
"status": "success",
"capabilities": {
"dev.ucp.shopping.checkout": [ { "version": "2026-04-08" } ],
"dev.ucp.shopping.fulfillment": [ { "version": "2026-04-08", "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": "bf8c1b4b-6b1c-4c6a-8f2a-53c2a7c3b2e1",
"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": "fee",
"display_text": "Fees",
"amount": 549,
"lines": [
{ "display_text": "Service Fee", "amount": 399 },
{ "display_text": "Recycling Fee", "amount": 150 }
]
},
{
"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": 1050
},
{
"type": "total",
"display_text": "Total",
"amount": 14599
}
],
"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
}
]
टैक्स के हिसाब से कई टियर में बंटे आइटम
जिन बाज़ारों में आइटम के हिसाब से कई लेवल या कई अधिकार क्षेत्र के टैक्स की जानकारी देनी होती है (जैसे, कनाडा में फ़ेडरल जीएसटी या एचएसटी और प्रोविंशियल पीएसटी या क्यूएसटी), वहां आप नेस्ट किए गए lines कलेक्शन के साथ टॉप-लेवल type: "tax" ऑब्जेक्ट दे सकते हैं:
- टॉप-लेवल टैक्स को एग्रीगेट करें: कुल टैक्स
amountऔर जानकारी देने वालाdisplay_text(जैसे,"Taxes") शामिल करने वाला एक एग्रीगेटtaxऑब्जेक्ट दिखाएं. - सब-लाइन ब्रेकडाउन:
linesऐरे में, टैक्स के अलग-अलग कॉम्पोनेंट को उनकीdisplay_text(जैसे,"TPS / GST (5%)","TVQ / QST (9.975%)") औरamountके साथ आइटम के तौर पर दिखाएं. - इनवेरिएंट: सभी सब-लाइन के कुल पैसे, पैरंट
taxएंट्री केamountके बराबर होने चाहिए.
उदाहरण: टैक्स के अलग-अलग स्तरों की जानकारी
{
"type": "tax",
"display_text": "Taxes",
"amount": 1498,
"lines": [
{ "display_text": "TPS / GST (5%)", "amount": 500 },
{ "display_text": "TVQ / QST (9.975%)", "amount": 998 }
]
}
चेकआउट सेशन पाना
इस एंडपॉइंट की मदद से, चेकआउट सेशन की जानकारी वापस पाई जा सकती है.
- एंडपॉइंट:
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
}
],
"context": {
"language": "en"
},
"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": "bf8c1b4b-6b1c-4c6a-8f2a-53c2a7c3b2e1",
"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", "amount": 12500 },
// Shipping cost might change based on new address
{ "type": "fulfillment", "display_text": "Ground Shipping", "amount": 600 },
{
"type": "fee",
"display_text": "Fees",
"amount": 549,
"lines": [
{ "display_text": "Service Fee", "amount": 399 },
{ "display_text": "Recycling Fee", "amount": 150 }
]
},
// Tax will likely change based on new address
{ "type": "tax", "display_text": "Estimated Tax", "amount": 1120 },
{ "type": "total", "display_text": "Total", "amount": 14769 }
],
"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-04-08",
"status": "success",
"capabilities": {
"dev.ucp.shopping.checkout": [ { "version": "2026-04-08" } ],
"dev.ucp.shopping.fulfillment": [ { "version": "2026-04-08", "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": "bf8c1b4b-6b1c-4c6a-8f2a-53c2a7c3b2e1",
"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": "fee",
"display_text": "Fees",
"amount": 549,
"lines": [
{ "display_text": "Service Fee", "amount": 399 },
{ "display_text": "Recycling Fee", "amount": 150 }
]
},
{ "type": "tax", "display_text": "Estimated Tax", "amount": 1120 },
{ "type": "total", "display_text": "Total", "amount": 14769 }
],
"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 पर सेट करके, यह बताया गया हो कि कौनसी जानकारी मौजूद नहीं है.
{
"ucp": {
"version": "2026-04-08",
"status": "success"
},
"id": "bf8c1b4b-6b1c-4c6a-8f2a-53c2a7c3b2e1",
"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-04-08",
"status": "success",
"capabilities": [...]
},
"id": "bf8c1b4b-6b1c-4c6a-8f2a-53c2a7c3b2e1",
"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-04-08 से शुरू होने वाले वर्शन में, अगर कोई ऐसी गड़बड़ी होती है जिसे ठीक नहीं किया जा सकता और इस वजह से चेकआउट सेशन नहीं बनाया जा सकता (जैसे, सभी आइटम स्टॉक में नहीं हैं), तो एचटीटीपी 200 OK दिखाएं. जवाब के मुख्य हिस्से में, ucp ऑब्जेक्ट में "status": "error" सेट करें.
इससे Google को पता चलता है कि अनुरोध मान्य था, लेकिन कारोबार के नियम की वजह से सेशन नहीं बन सका. इस मामले में, कोई चेकआउट सेशन आईडी नहीं मिलता है.
HTTP/1.1 200 OK
Content-Type: application/json
{
"ucp": {
"version": "2026-04-08",
"status": "error"
},
"messages": [
{
"type": "error",
"code": "out_of_stock",
"content": "All requested items are currently out of stock",
"severity": "unrecoverable"
}
],
"continue_url": "https://merchant.com/"
}