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 secure URL generated by PayPal:

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

Errors

Error Description
Could not find a cart with ID \"xxxxx\" The ID provided in the cart_id field is invalid or the cart does not exist for the customer.
The cart isn't active The cart with the specified cart ID is unavailable, because the items have been purchased and the cart ID becomes inactive.
Field HostedProUrlInput.cart_id of required type String! was not provided The value specified in the HostedProUrlInput.cart_id argument is empty.