AD0-E724 · Question #1
A developer has created the backend models for a new payment method. To make this method appear as an option on the checkout page, it must be declared to the system. Which XML file is specifically use
The correct answer is B. 'etc/payment.xml'. In Magento 2, etc/payment.xml is the dedicated configuration file for declaring payment methods - it registers the method with the payment system, making it available as a checkout option and associating it with the corresponding models. Why the distractors are wrong: A (etc/fron
Question
A developer has created the backend models for a new payment method. To make this method appear as an option on the checkout page, it must be declared to the system. Which XML file is specifically used to register new payment methods and their corresponding models?
Options
- A'etc/frontend/di.xml'
- B'etc/payment.xml'
- C'etc/sales.xml'
- D'etc/config.xml'
How the community answered
(19 responses)- A5% (1)
- B84% (16)
- C11% (2)
Explanation
In Magento 2, etc/payment.xml is the dedicated configuration file for declaring payment methods - it registers the method with the payment system, making it available as a checkout option and associating it with the corresponding models.
Why the distractors are wrong:
- A (
etc/frontend/di.xml) -di.xmlhandles dependency injection and class preferences/plugins, not payment method registration;frontend/scoping just limits it to the frontend area. - C (
etc/sales.xml) -sales.xmlconfigures sales-related settings like order statuses and totals, not payment method declarations. - D (
etc/config.xml) -config.xmlprovides default configuration values (like default store settings), but it doesn't register payment methods with the system.
Memory tip: Think of payment.xml as the "menu registration" file - just like a new item must be added to a restaurant menu before customers can order it, a new payment method must be declared in payment.xml before shoppers can select it at checkout.
Topics
Community Discussion
No community discussion yet for this question.