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
Reference
The getHostedProUrl
reference provides detailed information about the types and fields defined in this query.
Example usage
The following query returns the secure URL generated by PayPal:
Request:
Copied to your clipboardquery {getHostedProUrl(input: { cart_id: "mwqoyxgbibvgkr3udszfzomxpoj2gmj6" }) {secure_form_url}}
Response:
Copied to your clipboard{"data": {"getHostedProUrl": {"secure_form_url": "https://securepayments.sandbox.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess?hosted_button_id=HSSS-iKGrv2XMlHcGGj8u.hlOHA2AeoQHcIQOvoqTEbvgBlKTLXcS8tAg0BRg1AklvfIhU5ip0g"}}}
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. |