Skip to main content

PayPal Approve Payment API

POST /paypalApprovePayment

Description

This API endpoint allows users to approve a payment through PayPal by providing the PayPal order ID. The endpoint finalizes the payment process and returns the result of the approval.

Request Body

The request utilizes GraphQL to perform the paypalApprovePayment mutation.

Mutation:

mutation paypalApprovePayment ($orderId: String) {
paypalApprovePayment (orderId: $orderId) {
success
errorMessage
}
}

Variables:

{
"orderId": "<PayPal_Order_ID>"
}
  • orderId (String): The PayPal order ID that was generated during the payment creation process.

Response:

  • Success (200 OK):

    • If the payment approval is successful, the response will return:
      • success (Boolean): Indicates whether the payment approval was successful.
      • errorMessage (String): Any error message encountered during the approval process (if applicable).
    {
    "data": {
    "paypalApprovePayment": {
    "success": true,
    "errorMessage": null
    }
    }
    }
  • Error (4XX/5XX):

    • If the payment approval fails, the response will include an appropriate error message and status code.

Note:

Ensure that the orderId corresponds to a valid PayPal order that was created during the initial payment process. This API should be used to finalize and approve PayPal payments within the platform.