NYYU Logo
APIPresale Payment

Capture PayPal Order For Presale

Confirm and capture PayPal payments after user authorization

Capture PayPal Order

Finalize PayPal payments and update presale order status

Mutation

captureOrderForPresale
Confirm PayPal payment and update order

Schema

captureOrderForPresale(
  orderId: String!
): Boolean

Parameters

orderIdRequired
Type: String!
The PayPal order ID to capture (returned from paypalForPresale)

Return Value

📦
Returns Boolean

Returns true if capture successful, false otherwise

Example

💻
Usage Example
Capture PayPal order after user approval
mutation {
  captureOrderForPresale(
    orderId: "5O190127TN364715T"
  )
}

Response Example

📤
Sample Response
Successful capture
{
  "data": {
    "captureOrderForPresale": true
  }
}

How It Works

🔄
Capture Process
Backend verification and order update
1
Verify Order ID

Backend validates the PayPal order ID with PayPal's API

2
Check Payment Status

Confirms that the payment was approved and completed by the user

3
Capture Funds

Backend captures the authorized funds from PayPal

4
Update Presale Order

Updates the presale order status and triggers token delivery

Important Notes

⚠️
Call After Redirect

Only call this mutation after the user returns from PayPal checkout

🔐
Backend Verification

The backend verifies payment with PayPal before updating the order

Idempotent Operation

Safe to call multiple times - subsequent calls will return the same result

💡
Error Handling

Returns false if payment wasn't completed or if the order ID is invalid

💡
Best Practice

Extract the order ID from the return URL query parameters when PayPal redirects users back to your site. Call this mutation immediately to capture the payment. Display appropriate success or error messages to users based on the response. Consider implementing webhook handlers for more reliable payment confirmation.