This is a beta release of documentation for Magento 2.4, published for previewing soon-to-be-released functionality. Content in this version is subject to change. Links to the v2.4 code base may not properly resolve until the code is officially released.

getHostedProUrl query

The getHostedProUrl query is required to complete a transaction when the PayPal Website Payments Pro Hosted Solution payment method is selected. The query retrieves a PayPal-generated URL that the PWA client connects to, enabling the customer to enter their PayPal credentials and complete the transaction. Run this query after you set the payment method and place the order.

Syntax

getHostedProUrl(input: HostedProUrlInput!): HostedProUrl

Example usage

The following query returns the customer’s wish list:

Request:

1
2
3
4
5
query {
  getHostedProUrl(input: { cart_id: "mwqoyxgbibvgkr3udszfzomxpoj2gmj6" }) {
    secure_form_url
  }
}

Response:

1
2
3
4
5
6
7
{
  "data": {
    "getHostedProUrl": {
      "secure_form_url": "https://securepayments.sandbox.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess?hosted_button_id=HSSS-iKGrv2XMlHcGGj8u.hlOHA2AeoQHcIQOvoqTEbvgBlKTLXcS8tAg0BRg1AklvfIhU5ip0g"
    }
  }
}

Input attributes

The getHostedProUrl query must contain the following attribute:

Attribute Data type Description
cart_id String! The unique ID that identifies the customer’s cart

Output attributes

The query returns the PayPal URL that enables the customer to sign in to PayPal and complete the transaction.

Attribute Data type Description
secure_form_url String Secure URL generated by PayPal