Skip to content

How to get parameters for payment methods at checkout process using api magento 2 #14

@Balochfahad

Description

@Balochfahad

I want to know how can I get the fields of payment methods

My Shipping Method JSON:

{
payment_methods: [
{
code: "authorizenet_directpost",
title: "Credit Card Direct Post (Authorize.net)"
},
{
code: "braintree",
title: "Credit Card (Braintree)"
},
{
code: "braintree_paypal_vault",
title: "Stored Accounts (Braintree PayPal)"
},
{
code: "braintree_cc_vault",
title: "Stored Cards (Braintree)"
},
{
code: "braintree_paypal",
title: "PayPal (Braintree)"
},
{
code: "banktransfer",
title: "Bank Transfer Payment"
},
{
code: "checkmo",
title: "Check / Money order"
},
{
code: "cashondelivery",
title: "Cash On Delivery"
},
{
code: "paypal_express",
title: "PayPal Express Checkout"
},
{
code: "paypal_express_bml",
title: "PayPal Credit"
}
],
totals: {
grand_total: 188.8,
base_grand_total: 188.8,
subtotal: 236,
base_subtotal: 236,
discount_amount: -47.2,
base_discount_amount: -47.2,
subtotal_with_discount: 188.8,
base_subtotal_with_discount: 188.8,
shipping_amount: 0,
base_shipping_amount: 0,
shipping_discount_amount: 0,
base_shipping_discount_amount: 0,
tax_amount: 0,
base_tax_amount: 0,
weee_tax_applied_amount: null,
shipping_tax_amount: 0,
base_shipping_tax_amount: 0,
subtotal_incl_tax: 236,
shipping_incl_tax: 0,
base_shipping_incl_tax: 0,
base_currency_code: "USD",
quote_currency_code: "USD",
items_qty: 1,
items: [
{
item_id: 209,
price: 236,
base_price: 236,
qty: 1,
row_total: 236,
base_row_total: 236,
row_total_with_discount: 0,
tax_amount: 0,
base_tax_amount: 0,
tax_percent: 0,
discount_amount: 47.2,
base_discount_amount: 47.2,
discount_percent: 20,
price_incl_tax: 236,
base_price_incl_tax: 236,
row_total_incl_tax: 236,
base_row_total_incl_tax: 236,
options: "[]",
weee_tax_applied_amount: null,
weee_tax_applied: null,
name: "Dell C300 Route Processor"
}
],
total_segments: [
{
code: "subtotal",
title: "Subtotal",
value: 236
},
{
code: "shipping",
title: "Shipping & Handling",
value: 0
},
{
code: "discount",
title: "Discount",
value: -47.2
},
{
code: "tax",
title: "Tax",
value: 0,
extension_attributes: {
tax_grandtotal_details: [ ]
}
},
{
code: "grand_total",
title: "Grand Total",
value: 188.8,
area: "footer"
}
]
}
}

checkout

In the above screenshot I had taken a snapshot of fields.. If I have have different payment methods they all have different fields for credit card option..

My issue is here that I need these field parameters related to every payment method dynamically using rest api magento 2.

Api available in magento is only providing me payment method name.. I do not want to send my choice parameters in json but I need dynamically which are provided by the payment gateways?

Anyone can help..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions