getPaymentConfig query
data-variant=info
data-slots=text
The getPaymentConfig query returns the payment configuration details from locations in the storefront and Admin where the payment method can be set.
The query can return details about the following supported payment methods in Payment Services:
- Apple Pay
- Google Pay
- PayPal Hosted Fields
- PayPal Smart Buttons
Each of these payment methods can have a different payment source, for example, hosted_fields only works with credit cards.
Syntax
{
getPaymentConfig(
input: getPaymentConfigInput!
) getPaymentConfigOutput
}
Reference
The getPaymentConfig reference provides detailed information about the types and fields defined in this query.
Example usage
The following example runs the getPaymentConfig query for a location: CHECKOUT. This query provides all available payment methods for that location:
Request:
{
getPaymentConfig( location: CHECKOUT ) {
hosted_fields {
code
title
payment_intent
sort_order
sdk_params {
name
value
}
is_visible
payment_source
three_ds_mode
is_vault_enabled
cc_vault_code
requires_card_details
}
smart_buttons {
code
title
payment_intent
sort_order
sdk_params {
name
value
}
is_visible
message_styles {
layout
logo {
type
}
}
display_message
display_venmo
button_styles {
layout
color
shape
label
tagline
height
use_default_height
}
}
apple_pay {
payment_source
code
title
payment_intent
sort_order
sdk_params {
name
value
}
is_visible
button_styles {
layout
color
shape
label
tagline
height
use_default_height
}
}
google_pay {
payment_source
code
title
payment_intent
sort_order
sdk_params {
name
value
}
is_visible
button_styles {
color
height
type
}
}
}
}
Response:
{
"data": {
"getPaymentConfig": {
"config": {
"hosted_fields": {
"code": "payment_services_paypal_hosted_fields",
"title": "Credit Card",
"payment_intent": "capture",
"sort_order": "1",
"sdk_params": [
{
"name": "src",
"value": "https:\/\/www.paypal.com\/sdk\/js?client-id=..."
},
{
"name": "data-partner-attribution-id",
"value": "MagentoPayments_SP_PCP_Int"
},
{
"name": "data-client-token",
"value": "..."
},
{
"name": "data-expires-in",
"value": "3600"
}
],
"is_visible": true,
"payment_source": "cc",
"three_ds_mode": false,
"is_commerce_vault_enabled": true,
"cc_vault_code": "payment_services_paypal_vault"
"requires_card_details": false
},
"smart_buttons": {
"code": "payment_services_paypal_smart_buttons",
"title": "PayPal",
"payment_intent": "capture",
"sort_order": "10",
"sdk_params": [
{
"name": "src",
"value": "https:\/\/www.paypal.com\/sdk\/js?client-id=..."
},
{
"name": "data-partner-attribution-id",
"value": "MagentoPayments_SP_PCP_Int"
},
{
"name": "data-client-token",
"value": "..."
},
{
"name": "data-expires-in",
"value": "3600"
}
],
"is_visible": true,
"display_venmo": true,
"message_styles": {
"layout": "text",
"logo": {
"type": "inline"
}
},
"display_message": true,
"button_styles": {
"layout": "vertical",
"color": "gold",
"shape": "rect",
"height": null,
"label": "paypal",
"tagline": false
}
},
"apple_pay": {
"code": "payment_services_paypal_apple_pay",
"title": "Apple Pay",
"payment_intent": "authorize",
"sort_order": "10",
"sdk_params": [
{
"name": "src",
"value": "https:\/\/www.paypal.com\/sdk\/js?client-id=..."
}
],
"is_visible": true,
"button_styles": {
"layout": "vertical",
"color": "gold",
"shape": "rect",
"height": null,
"label": "paypal",
"tagline": false
}
}
"google_pay": {
"payment_source": "googlepay",
"code": "payment_services_paypal_google_pay",
"title": "Google Pay",
"payment_intent": "authorize",
"sort_order": "20",
"sdk_params": [
{
"name": "src",
"value": "https://www.paypal.com/sdk/js?client-id=..."
}
],
"is_visible": true,
"button_styles": {
"color": "default",
"height": 10,
"type": "buy"
}
}
}
}
}
}
Input attributes
The getPaymentConfig query requires the following input attribute:
locationPRODUCT_DETAIL, MINICART, CART, CHECKOUT, ADMINOutput attributes
The PaymentConfigOutput contains details about each configured payment method:
ApplePayConfigGooglePayConfigHostedFieldsConfigSmartButtonsConfigEach of these output attributes implements the PaymentConfigItem interface.
PaymentConfigItem interface
The PaymentConfigItem interface contains the fields that are common to all the payment methods. This interface contains the following attributes:
codeis_visiblepayment_intentAuthorize or Capturesdk_paramssort_ordertitleThis interface also has the following implementations:
- ApplePayConfig
- GooglePayConfig
- HostedFieldsConfig
- SmartButtonsConfig
Each implementation contains objects with specific attributes for each of these payment methods.
ApplePayConfig attributes
The ApplePayConfig payment method configuration has a button_styles object containing the following attributes:
colorheightlabellayoutshapetaglineuse_default_heightFalse, the value of height is usedSee Payment options for more information.
GooglePayConfig attributes
The GooglePayConfig payment method configuration contains the following attributes:
codeis_visiblepayment_intentAuthorize or Capturepayment_sourcesdk_paramssort_ordertitleThe possible values for payment_source are credit card (cc), PayPal (paypal), Google Pay (googlepay), and Apple Pay (applepay), depending on the payment method.
The GooglePayConfig payment method configuration also has a button_styles object containing the following attributes:
colorheighttypebuy, checkout, order, pay, and plainSee Google Pay API request object options documentation for more information.
HostedFieldsConfig attributes
The HostedFieldsConfig payment method configuration contains the following attributes:
cc_vault_codeis_vault_enabledpayment_sourcerequires_card_detailsthree_ds_modeOFF, SCA_WHEN_REQUIRED, SCA_ALWAYSNote: The three_ds attribute is deprecated. The HostedFieldsConfig payment method configuration currently uses a three_ds_mode attribute instead.
SmartButtonsConfig attributes
The SmartButtonsConfig payment method configuration contains the following attributes:
button_stylesdisplay_messagedisplay_venmomessage_stylesSee Payment options for more information.
ButtonStyles object
The SmartButtonsConfig payment method configuration has a ButtonStyles object containing the following attributes:
colorheightlabellayoutshapetaglineuse_default_heightFalse, the value of height is usedMessageStyles object
The SmartButtonsConfig payment method configuration has a MessageStyles object containing the following attributes:
layoutlogoSDKParams attributes
The SDKParams object provides details about the SDK parameters:
namevalueThese values come from PayPal JavaScript SDK.