{"info":{"_postman_id":"a9cc138c-40b1-409a-8070-1155446fafdc","name":"Mastercard: Magento - Headless API Integration","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"42712332","collectionId":"a9cc138c-40b1-409a-8070-1155446fafdc","publishedId":"2sAYdhJpjq","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"FF6C37"},"publishDate":"2025-03-11T12:48:12.000Z"},"item":[{"name":"REST API","item":[{"name":"Create Customer Token","id":"b68003c4-1db2-42e5-a130-054f63134fed","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"url":"{{Magento base Url}}/rest/V1/integration/customer/token?username={{customer_email}}&password={{customer_password}}","urlObject":{"path":["rest","V1","integration","customer","token"],"host":["{{Magento base Url}}"],"query":[{"key":"username","value":"{{customer_email}}"},{"key":"password","value":"{{customer_password}}"}],"variable":[]}},"response":[{"id":"804763f5-60b9-48cb-a878-411181d66844","name":"Success","originalRequest":{"method":"POST","header":[],"url":{"raw":"https://your-magento-host.com/rest/V1/integration/customer/token?username=user@example.com&password=password@123","protocol":"https","host":["your-magento-host","com"],"path":["rest","V1","integration","customer","token"],"query":[{"key":"username","value":"user@example.com"},{"key":"password","value":"password@123"}]}},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"\"eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjEsInV0eXBpZCI6MywiaWF0IjoxNzQxMjI4ODI5LCJleHAiOjE3NDEyMzI0Mjl9.Xnqmap1eo6-yM4_5IA_zysul13XsqCBdkmgXonG-Qn0\""}],"_postman_id":"b68003c4-1db2-42e5-a130-054f63134fed"},{"name":"Get Customer Cart Id","id":"3ea67727-28b2-4fff-be33-247842aac6f7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{Customer Token}}"}]},"isInherited":false},"method":"POST","header":[{"key":"Authorization","value":"Bearer {{Customer Token}}","type":"text"}],"url":"{{Magento base Url}}/rest/V1/carts/mine","urlObject":{"path":["rest","V1","carts","mine"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"9d9294a4-a271-4faa-a539-73eabebdf6e9","name":"Success","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"url":"https://your-magento-host.com/rest/V1/carts/mine"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"254"}],"_postman_id":"3ea67727-28b2-4fff-be33-247842aac6f7"},{"name":"Add Products To Cart","id":"547ffb92-9650-4dc3-9d09-550941cca6f8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n\"cartItem\": {\n\"sku\": \"sku\",\n\"qty\": 1,\n\"quote_id\": \"Cart Id\"\n}\n}","options":{"raw":{"language":"json"}}},"url":"{{Magento base Url}}/rest/V1/carts/mine/items","urlObject":{"path":["rest","V1","carts","mine","items"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"5fdb3c9e-419b-4aae-b040-d7a0de84f08b","name":"Success","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n\"cartItem\": {\n\"sku\": \"sku\",\n\"qty\": 1,\n\"quote_id\": \"Cart Id\"\n}\n}","options":{"raw":{"language":"json"}}},"url":"https://your-magento-host.com/rest/V1/carts/mine/items"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"item_id\": 250,\n    \"sku\": \"24-WB04\",\n    \"qty\": 1,\n    \"name\": \"Push It Messenger Bag\",\n    \"price\": 45,\n    \"product_type\": \"simple\",\n    \"quote_id\": \"254\"\n}"},{"id":"35f376c9-cbd3-430b-a390-0c2e17853ecb","name":"Failure - Invalid SKU","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n\"cartItem\": {\n\"sku\": \"sku\",\n\"qty\": 1,\n\"quote_id\": \"Cart Id\"\n}\n}","options":{"raw":{"language":"json"}}},"url":"https://your-magento-host.com/rest/V1/carts/mine/items"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"The product that was requested doesn't exist. Verify the product and try again.\"\n}"}],"_postman_id":"547ffb92-9650-4dc3-9d09-550941cca6f8"},{"name":"Set Shipping Information","id":"e310f574-fa62-4cbd-b917-fdf7c148a389","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n  \"addressInformation\": {\n    \"shippingAddress\": {\n      \"country_id\": \"US\",\n      \"street\": [\n        \"Alpha st\"\n      ],\n      \"company\": \"Company\",\n      \"telephone\": \"2313131312\",\n      \"postcode\": \"SD23 4QA\",\n      \"city\": \"California\",\n      \"firstname\": \"john\",\n      \"lastname\": \"harrison\",\n      \"email\": \"test@gmail.com\",\n      \"sameAsBilling\": 1,\n      \"region_id\": 12\n    },\n    \"billingAddress\": {\n      \"country_id\": \"US\",\n      \"street\": [\n        \"Street Address\"\n      ],\n      \"company\": \"Company\",\n      \"telephone\": \"2313131312\",\n      \"postcode\": \"SD23 4QA\",\n      \"city\": \"California\",\n      \"firstname\": \"john\",\n      \"lastname\": \"harrison\",\n      \"email\": \"test@gmail.com\",\n      \"region_id\": 12\n    },\n    \"shipping_method_code\": \"flatrate\",\n    \"shipping_carrier_code\": \"flatrate\"\n  }\n}","options":{"raw":{"language":"json"}}},"url":"{{Magento base Url}}/rest/default/V1/carts/mine/shipping-information","urlObject":{"path":["rest","default","V1","carts","mine","shipping-information"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"45044641-d9fa-40ba-a391-f7cf176c2915","name":"Success","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n  \"addressInformation\": {\n    \"shippingAddress\": {\n      \"country_id\": \"US\",\n      \"street\": [\n        \"Alpha st\"\n      ],\n      \"company\": \"Company\",\n      \"telephone\": \"2313131312\",\n      \"postcode\": \"SD23 4QA\",\n      \"city\": \"California\",\n      \"firstname\": \"john\",\n      \"lastname\": \"harrison\",\n      \"email\": \"test@gmail.com\",\n      \"sameAsBilling\": 1,\n      \"region_id\": 12\n    },\n    \"billingAddress\": {\n      \"country_id\": \"US\",\n      \"street\": [\n        \"Street Address\"\n      ],\n      \"company\": \"Company\",\n      \"telephone\": \"2313131312\",\n      \"postcode\": \"SD23 4QA\",\n      \"city\": \"California\",\n      \"firstname\": \"john\",\n      \"lastname\": \"harrison\",\n      \"email\": \"test@gmail.com\",\n      \"region_id\": 12\n    },\n    \"shipping_method_code\": \"flatrate\",\n    \"shipping_carrier_code\": \"flatrate\"\n  }\n}","options":{"raw":{"language":"json"}}},"url":"https://your-magento-host.com/rest/default/V1/carts/mine/shipping-information"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"payment_methods\": [\n        {\n            \"code\": \"checkmo\",\n            \"title\": \"Check / Money order\"\n        },\n        {\n            \"code\": \"tns_hosted\",\n            \"title\": \"Hosted Checkout\"\n        },\n        {\n            \"code\": \"tns_hpf\",\n            \"title\": \"Hosted Payment Form\"\n        }\n    ],\n    \"totals\": {\n        \"grand_total\": 114,\n        \"base_grand_total\": 114,\n        \"subtotal\": 99,\n        \"base_subtotal\": 99,\n        \"discount_amount\": 0,\n        \"base_discount_amount\": 0,\n        \"subtotal_with_discount\": 99,\n        \"base_subtotal_with_discount\": 99,\n        \"shipping_amount\": 15,\n        \"base_shipping_amount\": 15,\n        \"shipping_discount_amount\": 0,\n        \"base_shipping_discount_amount\": 0,\n        \"tax_amount\": 0,\n        \"base_tax_amount\": 0,\n        \"weee_tax_applied_amount\": null,\n        \"shipping_tax_amount\": 0,\n        \"base_shipping_tax_amount\": 0,\n        \"subtotal_incl_tax\": 99,\n        \"shipping_incl_tax\": 15,\n        \"base_shipping_incl_tax\": 15,\n        \"base_currency_code\": \"USD\",\n        \"quote_currency_code\": \"USD\",\n        \"items_qty\": 3,\n        \"items\": [\n            {\n                \"item_id\": 245,\n                \"price\": 22,\n                \"base_price\": 22,\n                \"qty\": 1,\n                \"row_total\": 22,\n                \"base_row_total\": 22,\n                \"row_total_with_discount\": 0,\n                \"tax_amount\": 0,\n                \"base_tax_amount\": 0,\n                \"tax_percent\": 0,\n                \"discount_amount\": 0,\n                \"base_discount_amount\": 0,\n                \"discount_percent\": 0,\n                \"price_incl_tax\": 22,\n                \"base_price_incl_tax\": 22,\n                \"row_total_incl_tax\": 22,\n                \"base_row_total_incl_tax\": 22,\n                \"options\": \"[{\\\"value\\\":\\\"XS\\\",\\\"label\\\":\\\"Size\\\"},{\\\"value\\\":\\\"Gray\\\",\\\"label\\\":\\\"Color\\\"}]\",\n                \"weee_tax_applied_amount\": null,\n                \"weee_tax_applied\": null,\n                \"name\": \"Argus All-Weather Tank\"\n            },\n            {\n                \"item_id\": 249,\n                \"price\": 32,\n                \"base_price\": 32,\n                \"qty\": 1,\n                \"row_total\": 32,\n                \"base_row_total\": 32,\n                \"row_total_with_discount\": 0,\n                \"tax_amount\": 0,\n                \"base_tax_amount\": 0,\n                \"tax_percent\": 0,\n                \"discount_amount\": 0,\n                \"base_discount_amount\": 0,\n                \"discount_percent\": 0,\n                \"price_incl_tax\": 32,\n                \"base_price_incl_tax\": 32,\n                \"row_total_incl_tax\": 32,\n                \"base_row_total_incl_tax\": 32,\n                \"options\": \"[]\",\n                \"weee_tax_applied_amount\": null,\n                \"weee_tax_applied\": null,\n                \"name\": \"Strive Shoulder Pack\"\n            },\n            {\n                \"item_id\": 250,\n                \"price\": 45,\n                \"base_price\": 45,\n                \"qty\": 1,\n                \"row_total\": 45,\n                \"base_row_total\": 45,\n                \"row_total_with_discount\": 0,\n                \"tax_amount\": 0,\n                \"base_tax_amount\": 0,\n                \"tax_percent\": 0,\n                \"discount_amount\": 0,\n                \"base_discount_amount\": 0,\n                \"discount_percent\": 0,\n                \"price_incl_tax\": 45,\n                \"base_price_incl_tax\": 45,\n                \"row_total_incl_tax\": 45,\n                \"base_row_total_incl_tax\": 45,\n                \"options\": \"[]\",\n                \"weee_tax_applied_amount\": null,\n                \"weee_tax_applied\": null,\n                \"name\": \"Push It Messenger Bag\"\n            }\n        ],\n        \"total_segments\": [\n            {\n                \"code\": \"subtotal\",\n                \"title\": \"Subtotal\",\n                \"value\": 99\n            },\n            {\n                \"code\": \"shipping\",\n                \"title\": \"Shipping & Handling (Flat Rate - Fixed)\",\n                \"value\": 15\n            },\n            {\n                \"code\": \"tax\",\n                \"title\": \"Tax\",\n                \"value\": 0,\n                \"extension_attributes\": {\n                    \"tax_grandtotal_details\": []\n                }\n            },\n            {\n                \"code\": \"grand_total\",\n                \"title\": \"Grand Total\",\n                \"value\": 114,\n                \"area\": \"footer\"\n            }\n        ]\n    }\n}"}],"_postman_id":"e310f574-fa62-4cbd-b917-fdf7c148a389"},{"name":"Create Payment Session","id":"813ecadc-4742-4210-a90b-ce2e9a944c89","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n   \"cartId\": \"253\",\n   \"paymentMethod\":{\n     \"method\":\"tns_hpf\"\n    }\n}\n","options":{"raw":{"language":"json"}}},"url":"{{Magento base Url}}/rest/V1/tns/hc/session/create","urlObject":{"path":["rest","V1","tns","hc","session","create"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"e34b7f04-fd5f-4048-867b-548a6815ae1a","name":"Success","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n   \"cartId\": \"cart_id\",\n   \"paymentMethod\":{\n     \"method\":\"tns_hpf\"\n    }\n}\n","options":{"raw":{"language":"json"}}},"url":"https://your-magento-host.com/rest/V1/tns/hc/session/create"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"[\n    \"SESSION0002275108090L9543020J16\",\n    \"a402917401\"\n]"}],"_postman_id":"813ecadc-4742-4210-a90b-ce2e9a944c89"},{"name":"Update Payment Session","id":"02e5951b-8c1d-4801-8aee-feb9d02ff2d1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"basic","basic":{"basicConfig":[{"key":"username","value":"<username>"},{"key":"password","value":"{{Merchant Password}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n  \"sourceOfFunds\": {\n    \"type\": \"CARD\",\n    \"provided\": {\n      \"card\": {\n        \"number\": \"5123450000000008\",\n        \"expiry\": {\n          \"month\": \"01\",\n          \"year\": \"39\"\n        },\n        \"securityCode\": \"100\"\n      }\n    }\n  }\n}","options":{"raw":{"language":"json"}}},"url":"https://mtf.gateway.mastercard.com/api/rest/version/100/merchant/{{Merchant ID}}/session/SESSION_ID","urlObject":{"protocol":"https","path":["api","rest","version","100","merchant","{{Merchant ID}}","session","SESSION_ID"],"host":["mtf","gateway","mastercard","com"],"query":[],"variable":[]}},"response":[{"id":"74c62391-1de0-498e-8868-4776b86f6b1c","name":"Success","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\n  \"sourceOfFunds\": {\n    \"type\": \"CARD\",\n    \"provided\": {\n      \"card\": {\n        \"number\": \"5123450000000008\",\n        \"expiry\": {\n          \"month\": \"01\",\n          \"year\": \"39\"\n        },\n        \"securityCode\": \"100\"\n      }\n    }\n  }\n}","options":{"raw":{"language":"json"}}},"url":"https://mtf.gateway.mastercard.com/api/rest/version/100/merchant/MID/session/SESSION_ID"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"billing\": {\n        \"address\": {\n            \"city\": \"California\",\n            \"company\": \"Company\",\n            \"country\": \"USA\",\n            \"postcodeZip\": \"sd23 4qa\",\n            \"stateProvince\": \"CA\",\n            \"street\": \"Street Address\"\n        }\n    },\n    \"customer\": {\n        \"email\": \"roni_cost@example.com\",\n        \"firstName\": \"john\",\n        \"lastName\": \"harrison\",\n        \"phone\": \"2313131312\"\n    },\n    \"interaction\": {\n        \"displayControl\": {\n            \"billingAddress\": \"HIDE\",\n            \"customerEmail\": \"HIDE\",\n            \"shipping\": \"HIDE\"\n        },\n        \"operation\": \"NONE\",\n        \"successIndicator\": \"99700aa14120403f\"\n    },\n    \"merchant\": \"FINGENTDCC\",\n    \"order\": {\n        \"amount\": \"50.00\",\n        \"currency\": \"USD\",\n        \"description\": \"Ordered Goods\",\n        \"id\": \"CITY_DEMO_246_000000281\",\n        \"notificationUrl\": \"https://demo-citi-magentoce-mc.fingent.dev/tns/webhook/response/\",\n        \"reference\": \"CITY_DEMO_246_000000281\"\n    },\n    \"partnerSolutionId\": \"Magento_Community_2.4.7-p3__2.4.4.0\",\n    \"session\": {\n        \"id\": \"SESSION0002868644456E7473638G94\",\n        \"updateStatus\": \"SUCCESS\",\n        \"version\": \"9482c24802\"\n    },\n    \"shipping\": {\n        \"address\": {\n            \"city\": \"California\",\n            \"company\": \"Company\",\n            \"country\": \"USA\",\n            \"postcodeZip\": \"sd23 4qa\",\n            \"stateProvince\": \"CA\",\n            \"street\": \"alpha st\"\n        },\n        \"contact\": {\n            \"email\": \"roni_cost@example.com\",\n            \"firstName\": \"john\",\n            \"lastName\": \"harrison\",\n            \"phone\": \"2313131312\"\n        }\n    },\n    \"sourceOfFunds\": {\n        \"provided\": {\n            \"card\": {\n                \"brand\": \"MASTERCARD\",\n                \"expiry\": {\n                    \"month\": \"1\",\n                    \"year\": \"39\"\n                },\n                \"fundingMethod\": \"DEBIT\",\n                \"number\": \"512345xxxxxx0008\",\n                \"scheme\": \"MASTERCARD\",\n                \"securityCode\": \"xxx\"\n            }\n        },\n        \"type\": \"CARD\"\n    },\n    \"transaction\": {\n        \"reference\": \"CITY_DEMO_246_000000281-67c90f3311a39\",\n        \"source\": \"INTERNET\"\n    },\n    \"version\": \"100\"\n}"}],"_postman_id":"02e5951b-8c1d-4801-8aee-feb9d02ff2d1"},{"name":"Place Order","id":"998ae41e-7e47-43b2-824b-91385f889cef","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{Customer Token}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"raw","raw":"{\n\"paymentMethod\": {\n\"method\": \"tns_hpf\",\n\"Additional_data\":\n{\n\"session\": \"session_id\"\n }\n}\n}\n","options":{"raw":{"language":"json"}}},"url":"{{Magento base Url}}/rest/V1/carts/mine/payment-information","urlObject":{"path":["rest","V1","carts","mine","payment-information"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"826c193f-e913-4d71-9b2d-3392e0525f97","name":"Success","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n\"paymentMethod\": {\n\"method\": \"tns_hpf\",\n\"Additional_data\":\n{\n\"session\": \"session_id\"\n }\n}\n}\n","options":{"raw":{"language":"json"}}},"url":"https://your-magento-host.com/rest/V1/carts/mine/payment-information"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"189"},{"id":"2b03ed4a-3b0b-4310-82bb-6aa70c57def2","name":"Failure - Invalid Payment Method","originalRequest":{"method":"POST","header":[{"key":"Authorization","value":"Bearer Token","type":"text","disabled":true}],"body":{"mode":"raw","raw":"{\n\"paymentMethod\": {\n\"method\": \"tns_hpf\",\n\"Additional_data\":\n{\n\"session\": \"session_id\"\n }\n}\n}\n","options":{"raw":{"language":"json"}}},"url":"https://your-magento-host.com/rest/V1/carts/mine/payment-information"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"message\": \"The requested Payment Method is not available.\"\n}"}],"_postman_id":"998ae41e-7e47-43b2-824b-91385f889cef"}],"id":"d4ff6901-aa2c-410d-954c-81a666947598","description":"<p>REST (Representational State Transfer) API is a standardized architectural style for building web services. It uses HTTP methods such as GET, POST, PUT, and DELETE to perform operations on resources, which are identified by unique URLs (endpoints). Each endpoint corresponds to a specific resource or action, and the API response typically includes associated data in a structured format like JSON or XML.</p>\n<p>The <strong>Mastercard Magento Plugin</strong> makes it easy to integrate with <strong>Mastercard Payment Service APIs</strong>, allowing merchants to process payments efficiently. It includes tools for both frontend and backend operations.</p>\n<h4 id=\"frontend-features\">Frontend Features</h4>\n<ul>\n<li><p>Hosted Checkout: A ready-to-use, secure checkout solution.</p>\n</li>\n<li><p>Hosted Session: A solution that lets you manage the payment experience within your website.</p>\n</li>\n<li><p>ACH: Enables direct bank-to-bank payments.</p>\n</li>\n</ul>\n<h4 id=\"backend-features\">Backend Features</h4>\n<p>The plugin also supports backend operations to help merchants and developers manage payments more effectively:</p>\n<ul>\n<li><p>Payment Integration Setup: Easily configure payment methods.</p>\n</li>\n<li><p>Mastercard API Credentials Management: Handle and secure your API keys.</p>\n</li>\n<li><p>3D Secure Enablement: Add an extra layer of security to transactions.</p>\n</li>\n<li><p>Refund Management: Process refunds quickly and accurately.</p>\n</li>\n<li><p>Debugging and Logging: Troubleshoot issues with detailed logs.</p>\n</li>\n</ul>\n<h5 id=\"mastercard-plugin-integration-with-headless-magento\">Mastercard Plugin Integration with Headless Magento</h5>\n<p>Headless Magento separates the front-end and back-end, giving you the flexibility to customize your system. Here's how you can use the Mastercard Plugin in this setup:</p>\n<h4 id=\"for-developers\">For Developers</h4>\n<h5 id=\"backend-integration\">Backend Integration</h5>\n<ol>\n<li><p>Install the Mastercard Magento Plugin in the Magento Admin module.</p>\n</li>\n<li><p>Use the plugin’s backend features to configure API credentials, set up payment methods, and manage transactions.</p>\n</li>\n</ol>\n<h5 id=\"frontend-development\">Frontend Development</h5>\n<ol>\n<li><p>Build custom payment screens using frameworks like React, Angular, or your preferred frontend technology.</p>\n</li>\n<li><p>Connect these screens to the Magento backend APIs for seamless payment processing.</p>\n</li>\n</ol>\n<h4 id=\"benefits-of-headless-integration-with-the-mastercard-plugin\">Benefits of Headless Integration with the Mastercard Plugin</h4>\n<ol>\n<li><p><strong>Flexibility</strong>: Customize the user experience on the frontend while using powerful backend tools.</p>\n</li>\n<li><p><strong>Scalability</strong>: Update or replace the frontend easily without disrupting backend operations.</p>\n</li>\n<li><p><strong>Enhanced Security</strong>: Securely handle sensitive data through Mastercard’s APIs and tokenization.</p>\n</li>\n<li><p>By combining the <strong>Mastercard Plugin</strong> with <strong>Headless Magento</strong>, merchants can deliver a payment experience that is tailored, secure, and smooth.</p>\n</li>\n</ol>\n<h4 id=\"request-body-keys-description\">Request Body keys description</h4>\n<p><strong>cartId</strong>: This is the ID of the customer's shopping cart.</p>\n<p><strong>paymentMethod</strong>: This tells which payment method is being used. For example, if you're using a hosted payment session method, the value will be “tns_hpf”.</p>\n<ul>\n<li><p><strong>method:</strong> This represents the payment method code for hosted payment session.</p>\n</li>\n<li><p><strong>additional_data</strong>: This section contains additional details needed for processing the payment session.</p>\n</li>\n</ul>\n<h4 id=\"notes\">Notes</h4>\n<p>API URL - This is the Magento web address (URL) where the request is sent to create the payment session.<br />By using this custom REST API, the system will communicate with the gateway to create a session.</p>\n<p>Create the payment session only after the billing and shipping addresses are added by utilizing Magento’s default cart and product APIs.</p>\n","_postman_id":"d4ff6901-aa2c-410d-954c-81a666947598"},{"name":"GraphQL","item":[{"name":"Generate Customer Token","id":"646a78f1-3f9c-48c7-a397-a0cb0bcc2a7f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  generateCustomerToken(email: \"customer_email\", password: \"customer_password\") {\n\ttoken\n  }\n}\n","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"d5399a69-819d-4331-b800-accd2c76a099","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  generateCustomerToken(email: \"customer_email\", password: \"customer_password\") {\n\ttoken\n  }\n}\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"generateCustomerToken\": {\n            \"token\": \"eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjEsInV0eXBpZCI6MywiaWF0IjoxNzQxMTc2NDU5LCJleHAiOjE3NDExODAwNTl9.Yx_RFcp97rPuJ5YtyBYSX9gdW1uA--vXTbzmC9zqCOc\"\n        }\n    }\n}"},{"id":"d44316d6-db26-40dc-b264-32e82013f114","name":"Failure","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  generateCustomerToken(email: \"customer_email\", password: \"customer_password\") {\n\ttoken\n  }\n}\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"errors\": [\n        {\n            \"message\": \"The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.\",\n            \"locations\": [\n                {\n                    \"line\": 2,\n                    \"column\": 3\n                }\n            ],\n            \"path\": [\n                \"generateCustomerToken\"\n            ],\n            \"extensions\": {\n                \"category\": \"graphql-authentication\"\n            }\n        }\n    ],\n    \"data\": {\n        \"generateCustomerToken\": null\n    }\n}"}],"_postman_id":"646a78f1-3f9c-48c7-a397-a0cb0bcc2a7f"},{"name":"Get Customer Cart Id","id":"6ae247e8-0f06-457f-8d81-64b1527959e8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"{\n  customerCart{\n\tid\n  }\n}\n","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"0f0ecab0-bc2f-48bc-8e98-a41c068a2904","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"{\n  customerCart{\n\tid\n  }\n}\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"customerCart\": {\n            \"id\": \"7qm2rB8XI5SETkg7LfDxSMDlNGrXvw3I\"\n        }\n    }\n}"}],"_postman_id":"6ae247e8-0f06-457f-8d81-64b1527959e8"},{"name":"Add Products To Cart","id":"841ee380-08f4-4684-b874-3cc748eea704","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  addProductsToCart(\n    cartId: \"cart_id\"\n    cartItems: [\n      {\n        quantity: 1\n        sku: \"sku\"\n      }\n    ]\n  ) {\n    cart {\n      itemsV2 {\n        items {\n          product {\n            name\n            sku\n          }\n          quantity\n        }\n        total_count\n        page_info {\n          page_size\n          current_page\n          total_pages\n        }\n      }\n    }\n    user_errors {\n      code\n      message\n    }\n  }\n}\n","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"8a2c223b-51ae-4906-b218-fb18669c08b9","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  addProductsToCart(\n    cartId: \"cart_id\"\n    cartItems: [\n      {\n        quantity: 1\n        sku: \"sku\"\n      }\n    ]\n  ) {\n    cart {\n      itemsV2 {\n        items {\n          product {\n            name\n            sku\n          }\n          quantity\n        }\n        total_count\n        page_info {\n          page_size\n          current_page\n          total_pages\n        }\n      }\n    }\n    user_errors {\n      code\n      message\n    }\n  }\n}\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"addProductsToCart\": {\n            \"cart\": {\n                \"itemsV2\": {\n                    \"items\": [\n                        {\n                            \"product\": {\n                                \"name\": \"Strive Shoulder Pack\",\n                                \"sku\": \"24-MB04\"\n                            },\n                            \"quantity\": 1\n                        }\n                    ],\n                    \"total_count\": 1,\n                    \"page_info\": {\n                        \"page_size\": 20,\n                        \"current_page\": 1,\n                        \"total_pages\": 1\n                    }\n                }\n            },\n            \"user_errors\": []\n        }\n    }\n}"},{"id":"f7918fd6-28ae-487d-b89d-d99b92143205","name":"Failure - Invalid SKU","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  addProductsToCart(\n    cartId: \"cart_id\"\n    cartItems: [\n      {\n        quantity: 1\n        sku: \"sku\"\n      }\n    ]\n  ) {\n    cart {\n      itemsV2 {\n        items {\n          product {\n            name\n            sku\n          }\n          quantity\n        }\n        total_count\n        page_info {\n          page_size\n          current_page\n          total_pages\n        }\n      }\n    }\n    user_errors {\n      code\n      message\n    }\n  }\n}\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"addProductsToCart\": {\n            \"cart\": {\n                \"itemsV2\": {\n                    \"items\": [\n                        {\n                            \"product\": {\n                                \"name\": \"Strive Shoulder Pack\",\n                                \"sku\": \"24-MB04\"\n                            },\n                            \"quantity\": 1\n                        }\n                    ],\n                    \"total_count\": 1,\n                    \"page_info\": {\n                        \"page_size\": 20,\n                        \"current_page\": 1,\n                        \"total_pages\": 1\n                    }\n                }\n            },\n            \"user_errors\": [\n                {\n                    \"code\": \"PRODUCT_NOT_FOUND\",\n                    \"message\": \"Could not find a product with SKU \\\"24-MB0676\\\"\"\n                }\n            ]\n        }\n    }\n}"}],"_postman_id":"841ee380-08f4-4684-b874-3cc748eea704"},{"name":"Set Shipping Address","id":"394b2f1a-ca28-45e5-a38d-f04f3cd750aa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setShippingAddressesOnCart(\n    input: {\n      cart_id: \"cart_id\",\n      shipping_addresses: [\n        {\n          address: {\n            firstname: \"John\",\n            lastname: \"Doe\",\n            street: [\"123 Main St\"],\n            city: \"Los Angeles\",\n            region: \"CA\",\n            postcode: \"90001\",\n            country_code: \"US\",\n            telephone: \"555-555-5555\",\n            save_in_address_book: false\n          }\n        }\n      ]\n    }\n  ) {\n    cart {\n      shipping_addresses {\n        firstname\n        lastname\n        street\n        city\n        region {\n          label\n        }\n        postcode\n        country {\n          code\n        }\n        telephone\n      }\n    }\n  }\n}","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"6a9bda4a-6c74-4fc7-93bb-f4a094bbb7ac","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setShippingAddressesOnCart(\n    input: {\n      cart_id: \"cart_id\",\n      shipping_addresses: [\n        {\n          address: {\n            firstname: \"John\",\n            lastname: \"Doe\",\n            street: [\"123 Main St\"],\n            city: \"Los Angeles\",\n            region: \"CA\",\n            postcode: \"90001\",\n            country_code: \"US\",\n            telephone: \"555-555-5555\",\n            save_in_address_book: false\n          }\n        }\n      ]\n    }\n  ) {\n    cart {\n      shipping_addresses {\n        firstname\n        lastname\n        street\n        city\n        region {\n          label\n        }\n        postcode\n        country {\n          code\n        }\n        telephone\n      }\n    }\n  }\n}","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"setShippingAddressesOnCart\": {\n            \"cart\": {\n                \"shipping_addresses\": [\n                    {\n                        \"firstname\": \"John\",\n                        \"lastname\": \"Doe\",\n                        \"street\": [\n                            \"123 Main St\"\n                        ],\n                        \"city\": \"Los Angeles\",\n                        \"region\": {\n                            \"label\": \"California\"\n                        },\n                        \"postcode\": \"90001\",\n                        \"country\": {\n                            \"code\": \"US\"\n                        },\n                        \"telephone\": \"555-555-5555\"\n                    }\n                ]\n            }\n        }\n    }\n}"}],"_postman_id":"394b2f1a-ca28-45e5-a38d-f04f3cd750aa"},{"name":"Set Billing Address","id":"d740e720-5e9e-4a13-b63a-c30ddf3c6fde","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setBillingAddressOnCart(\n    input: {\n      cart_id: \"cart_id\"\n      billing_address: {\n        address: {\n          firstname: \"John\"\n          lastname: \"Doe\"\n          street: [\"123 Main St\"]\n          city: \"Los Angeles\"\n          region: \"CA\"\n          postcode: \"90001\"\n          country_code: \"US\"\n          telephone: \"555-555-5555\"\n          save_in_address_book: false\n        }\n        same_as_shipping: false\n      }\n    }\n  ) {\n    cart {\n      billing_address {\n        firstname\n        lastname\n        street\n        city\n        region {\n          label\n        }\n        postcode\n        country {\n          code\n        }\n        telephone\n      }\n    }\n  }\n}","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"ee1df220-ecae-4d13-84ec-928009f03492","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setBillingAddressOnCart(\n    input: {\n      cart_id: \"cart_id\"\n      billing_address: {\n        address: {\n          firstname: \"John\"\n          lastname: \"Doe\"\n          street: [\"123 Main St\"]\n          city: \"Los Angeles\"\n          region: \"CA\"\n          postcode: \"90001\"\n          country_code: \"US\"\n          telephone: \"555-555-5555\"\n          save_in_address_book: false\n        }\n        same_as_shipping: false\n      }\n    }\n  ) {\n    cart {\n      billing_address {\n        firstname\n        lastname\n        street\n        city\n        region {\n          label\n        }\n        postcode\n        country {\n          code\n        }\n        telephone\n      }\n    }\n  }\n}","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"setBillingAddressOnCart\": {\n            \"cart\": {\n                \"billing_address\": {\n                    \"firstname\": \"John\",\n                    \"lastname\": \"Doe\",\n                    \"street\": [\n                        \"123 Main St\"\n                    ],\n                    \"city\": \"Los Angeles\",\n                    \"region\": {\n                        \"label\": \"California\"\n                    },\n                    \"postcode\": \"90001\",\n                    \"country\": {\n                        \"code\": \"US\"\n                    },\n                    \"telephone\": \"555-555-5555\"\n                }\n            }\n        }\n    }\n}"}],"_postman_id":"d740e720-5e9e-4a13-b63a-c30ddf3c6fde"},{"name":"Set Shipping Method","id":"aea6964a-0797-4620-8338-48dba7351d6f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setShippingMethodsOnCart(\n    input: {\n      cart_id: \"cart_id\",\n      shipping_methods: [\n        {\n          carrier_code: \"tablerate\"\n          method_code: \"bestway\"\n        }\n      ]\n    }\n  ) {\n    cart {\n      shipping_addresses {\n        selected_shipping_method {\n          carrier_code\n          carrier_title\n          method_code\n          method_title\n          amount {\n            value\n            currency\n          }\n        }\n      }\n    }\n  }\n}","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"95d5a9cb-e95e-4535-bb13-f1c7b2875e6b","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setShippingMethodsOnCart(\n    input: {\n      cart_id: \"cart_id\",\n      shipping_methods: [\n        {\n          carrier_code: \"tablerate\"\n          method_code: \"bestway\"\n        }\n      ]\n    }\n  ) {\n    cart {\n      shipping_addresses {\n        selected_shipping_method {\n          carrier_code\n          carrier_title\n          method_code\n          method_title\n          amount {\n            value\n            currency\n          }\n        }\n      }\n    }\n  }\n}","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"setShippingMethodsOnCart\": {\n            \"cart\": {\n                \"shipping_addresses\": [\n                    {\n                        \"selected_shipping_method\": {\n                            \"carrier_code\": \"tablerate\",\n                            \"carrier_title\": \"Best Way\",\n                            \"method_code\": \"bestway\",\n                            \"method_title\": \"Table Rate\",\n                            \"amount\": {\n                                \"value\": 15,\n                                \"currency\": \"USD\"\n                            }\n                        }\n                    }\n                ]\n            }\n        }\n    }\n}"}],"_postman_id":"aea6964a-0797-4620-8338-48dba7351d6f"},{"name":"Create Payment Session","id":"497eb923-907f-4295-88b5-9c6586ce6e00","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  createNewPaymentSession(input: { cart_id:\"cart_id\", payment_method: { code: \"tns_hpf\" } }) {\n\tid\n\tversion\n  }\n}\n\n","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"cc5494a1-ac19-4eac-87a6-f9d4932a8cf5","name":"Success","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  createNewPaymentSession(input: { cart_id:\"cart_id\", payment_method: { code: \"tns_hpf\" } }) {\n\tid\n\tversion\n  }\n}\n\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"data\": {\n        \"createNewPaymentSession\": {\n            \"id\": \"SESSION0002052044737G9649310F29\",\n            \"version\": \"b6db5b1001\"\n        }\n    }\n}"}],"_postman_id":"497eb923-907f-4295-88b5-9c6586ce6e00"},{"name":"Update Payment Session","id":"433aaa9d-2145-426f-a82b-8025b569c02d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"basic","basic":{"basicConfig":[{"key":"username","value":"<username>"},{"key":"password","value":"{{Merchant Password}}"}]},"isInherited":false},"method":"PUT","header":[],"body":{"mode":"raw","raw":"{ \n   \"sourceOfFunds\": {\n                         \t\"type\": \"CARD\",\n                         \t\"provided\": {\n                                       \t\"card\": {\n                                                      \t\"number\": \"5123450000000008\",\n                                                      \t\"expiry\": {\n                                                                    \t\"month\": \"01\",\n                                                                    \t\"year\": \"39\"\n                                                      \t},\n                                                      \t\"securityCode\": \"100\"\n                                       \t}\n                         \t}\n   }\n}","options":{"raw":{"language":"json"}}},"url":"https://mtf.gateway.mastercard.com/api/rest/version/100/merchant/{{Merchant ID}}/session/SESSION_ID","urlObject":{"protocol":"https","path":["api","rest","version","100","merchant","{{Merchant ID}}","session","SESSION_ID"],"host":["mtf","gateway","mastercard","com"],"query":[],"variable":[]}},"response":[{"id":"2178a7fd-1849-4bb3-a085-892212a83762","name":"Success","originalRequest":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{ \n   \"sourceOfFunds\": {\n                         \t\"type\": \"CARD\",\n                         \t\"provided\": {\n                                       \t\"card\": {\n                                                      \t\"number\": \"5123450000000008\",\n                                                      \t\"expiry\": {\n                                                                    \t\"month\": \"01\",\n                                                                    \t\"year\": \"39\"\n                                                      \t},\n                                                      \t\"securityCode\": \"100\"\n                                       \t}\n                         \t}\n   }\n}","options":{"raw":{"language":"json"}}},"url":"https://mtf.gateway.mastercard.com/api/rest/version/100/merchant/MID/session/SESSION_ID"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"billing\": {\n        \"address\": {\n            \"city\": \"California\",\n            \"company\": \"Company\",\n            \"country\": \"USA\",\n            \"postcodeZip\": \"sd23 4qa\",\n            \"stateProvince\": \"CA\",\n            \"street\": \"Street Address\"\n        }\n    },\n    \"customer\": {\n        \"email\": \"roni_cost@example.com\",\n        \"firstName\": \"john\",\n        \"lastName\": \"harrison\",\n        \"phone\": \"2313131312\"\n    },\n    \"interaction\": {\n        \"displayControl\": {\n            \"billingAddress\": \"HIDE\",\n            \"customerEmail\": \"HIDE\",\n            \"shipping\": \"HIDE\"\n        },\n        \"operation\": \"NONE\",\n        \"successIndicator\": \"99700aa14120403f\"\n    },\n    \"merchant\": \"FINGENTDCC\",\n    \"order\": {\n        \"amount\": \"50.00\",\n        \"currency\": \"USD\",\n        \"description\": \"Ordered Goods\",\n        \"id\": \"CITY_DEMO_246_000000281\",\n        \"notificationUrl\": \"https://demo-citi-magentoce-mc.fingent.dev/tns/webhook/response/\",\n        \"reference\": \"CITY_DEMO_246_000000281\"\n    },\n    \"partnerSolutionId\": \"Magento_Community_2.4.7-p3__2.4.4.0\",\n    \"session\": {\n        \"id\": \"SESSION0002868644456E7473638G94\",\n        \"updateStatus\": \"SUCCESS\",\n        \"version\": \"9482c24802\"\n    },\n    \"shipping\": {\n        \"address\": {\n            \"city\": \"California\",\n            \"company\": \"Company\",\n            \"country\": \"USA\",\n            \"postcodeZip\": \"sd23 4qa\",\n            \"stateProvince\": \"CA\",\n            \"street\": \"alpha st\"\n        },\n        \"contact\": {\n            \"email\": \"roni_cost@example.com\",\n            \"firstName\": \"john\",\n            \"lastName\": \"harrison\",\n            \"phone\": \"2313131312\"\n        }\n    },\n    \"sourceOfFunds\": {\n        \"provided\": {\n            \"card\": {\n                \"brand\": \"MASTERCARD\",\n                \"expiry\": {\n                    \"month\": \"1\",\n                    \"year\": \"39\"\n                },\n                \"fundingMethod\": \"DEBIT\",\n                \"number\": \"512345xxxxxx0008\",\n                \"scheme\": \"MASTERCARD\",\n                \"securityCode\": \"xxx\"\n            }\n        },\n        \"type\": \"CARD\"\n    },\n    \"transaction\": {\n        \"reference\": \"CITY_DEMO_246_000000281-67c90f3311a39\",\n        \"source\": \"INTERNET\"\n    },\n    \"version\": \"100\"\n}"}],"_postman_id":"433aaa9d-2145-426f-a82b-8025b569c02d"},{"name":"Place Order","id":"137b6a46-437c-4f6a-9be2-d66d174a25c0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"bearer","bearer":{"basicConfig":[{"key":"token","value":"{{CustomerToken}}"}]},"isInherited":false},"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setPaymentMethodAndPlaceOrder(\n\tinput: { cart_id: \"cart_id\", payment_method: { code: \"tns_hpf\" } }\n  ) {\n\torder {\n  \torder_id\n  \torder_number\n\t}\n  }\n}\n","variables":""}},"url":"{{Magento base Url}}/graphql","urlObject":{"path":["graphql"],"host":["{{Magento base Url}}"],"query":[],"variable":[]}},"response":[{"id":"e3cc88ca-c465-4689-a3d8-3afcc659c584","name":"Error - Invalid payment","originalRequest":{"method":"POST","header":[],"body":{"mode":"graphql","graphql":{"query":"mutation {\n  setPaymentMethodAndPlaceOrder(\n\tinput: { cart_id: \"cart_id\", payment_method: { code: \"tns_hpf\" } }\n  ) {\n\torder {\n  \torder_id\n  \torder_number\n\t}\n  }\n}\n","variables":""}},"url":"https://your-magento-host.com/graphql"},"_postman_previewlanguage":null,"header":null,"cookie":[],"responseTime":null,"body":"{\n    \"errors\": [\n        {\n            \"message\": \"Unable to place order: Transaction has been declined. Please try again later.\",\n            \"locations\": [\n                {\n                    \"line\": 2,\n                    \"column\": 3\n                }\n            ],\n            \"path\": [\n                \"setPaymentMethodAndPlaceOrder\"\n            ],\n            \"extensions\": {\n                \"category\": \"graphql-input\"\n            }\n        }\n    ],\n    \"data\": {\n        \"setPaymentMethodAndPlaceOrder\": null\n    }\n}"}],"_postman_id":"137b6a46-437c-4f6a-9be2-d66d174a25c0"}],"id":"1751844c-2576-4b60-ac75-ddc291cdb6a8","description":"<p><strong>GraphQL</strong> is a query language and runtime for APIs that allows clients to request only the specific data they need. Unlike REST, which often returns fixed structures of data, GraphQL enables clients to define the structure of the response, making it more flexible and efficient. Operations (queries, mutations, and subscriptions) are handled via a single endpoint.<br />The plugin supports a Headless Magento architecture, enabling businesses to decouple the front-end and backend. This approach allows greater customization and flexibility:</p>\n<ul>\n<li><p>The front end can be built using modern technologies like React or Angular.</p>\n</li>\n<li><p>The backend Magento admin module handles core payment and transactional functionalities.</p>\n</li>\n</ul>\n<p>Using GraphQL, the plugin facilitates dynamic interactions between the decoupled front-end and backend, ensuring a responsive and tailored user interface.</p>\n<h4 id=\"graphql-schema-keywords\"><strong>GraphQL Schema Keywords</strong></h4>\n<p><strong>mutation</strong>: In GraphQL, a mutation is used for writing or modifying data, such as creating, updating, or deleting records. Here, the mutation is used to authenticate a customer.</p>\n<p><strong>generateCustomerToken</strong>: This is the GraphQL field (or operation) that handles customer authentication. It takes the customer's email and password as inputs and generates a token for the authenticated customer.</p>\n<p><strong>email</strong>: The email address of the customer.</p>\n<p><strong>password</strong>: The password of the customer.</p>\n<p><strong>token</strong>: After the mutation is successfully executed, the response will include a token. This is a string value that represents an authentication token, which can be used in subsequent API requests to authenticate the customer.</p>\n<p><strong>customerCart</strong>: It's a query provided by Magento to fetch details about the customer's cart.</p>\n<p><strong>id</strong>: Requesting the cart ID of the current customer.</p>\n<p><strong>setPaymentMethodAndPlaceOrder</strong>: This is the mutation operation that places an order and sets the payment method for the provided cart.</p>\n<p><strong>cart_id</strong>: This is the customer’s cart id for which the order will be placed. Replace \"cart_id\" with the actual cart ID of the customer.</p>\n<p><strong>payment_method</strong>: This is an object that specifies the payment method to be used for the order. method_code: \"tns_hpf\" or “tns_hosted”. This represents the payment method code.</p>\n","_postman_id":"1751844c-2576-4b60-ac75-ddc291cdb6a8"}]}