Confirm PayPal Checkout Order
Complete and verify PayPal payment orders to credit deposited funds into user wallets
Confirm PayPal Checkout Order
Complete and verify PayPal payment orders to credit deposited funds into user wallets
Overview
The captureOrderForDeposit mutation allows users to confirm and finalize a PayPal payment for their wallet deposit. After creating a PayPal order using paypalForDeposit and completing the checkout on PayPal's platform, this endpoint verifies the payment with PayPal and credits the corresponding funds to the user's internal wallet balance.
🔧 Mutation Schema
captureOrderForDeposit(
  orderId: String!
): BooleanParameters
orderIdRequiredType: String
The PayPal checkout order ID that was returned from the paypalForDeposit mutation. This ID is used to verify and capture the payment from PayPal.
Return Value
Boolean
The mutation returns a boolean value indicating the success or failure of the operation:
Example Usage
Example Mutation
The following example demonstrates how to confirm a PayPal payment order after the user completes checkout:
mutation {
  captureOrderForDeposit(
    orderId: "8VH12345ABC67890"
  )
}Example Responses
Successful Capture:
{
  "data": {
    "captureOrderForDeposit": true
  }
}Failed Capture:
{
  "data": {
    "captureOrderForDeposit": false
  }
}Payment Flow
Complete PayPal Deposit Process
Call paypalForDeposit to initiate a deposit and receive the order ID and redirect URL
Send the user to PayPal's checkout page using the provided redirect URL
User logs into PayPal and authorizes the payment
PayPal redirects the user back to your application with the order ID
Call captureOrderForDeposit with the order ID to verify and complete the transaction
If successful, the deposit amount is immediately added to the user's wallet balance
Use Cases
Payment Verification
Verify that PayPal payments were successfully completed before crediting user wallets.
Instant Deposits
Enable real-time wallet funding with immediate balance updates upon successful payment capture.
Transaction Reconciliation
Match PayPal transactions with internal deposit records for accurate financial tracking.
Fraud Prevention
Validate payment authenticity through PayPal's verification system before updating balances.
Important Notes
Order Capture Timing
PayPal orders should be captured within 3 hours of creation. Orders that are not captured within this timeframe may expire and require the user to create a new payment order.
Idempotency
This mutation is idempotent - calling it multiple times with the same order ID will not result in duplicate credits. PayPal ensures each order can only be captured once.
Error Handling
If the mutation returns false, check the following potential issues:
- The order ID is invalid or doesn't exist
 - The PayPal order has already been captured
 - The user cancelled the payment on PayPal
 - The payment was declined by PayPal or the user's payment method
 - Network connectivity issues with PayPal's API
 
Response Handling
Recommended Implementation
- • Show success message to the user
 - • Update the wallet balance display
 - • Redirect to wallet or dashboard page
 - • Send confirmation email/notification
 
- • Display error message explaining the issue
 - • Offer to retry or create a new payment
 - • Log the error for support investigation
 - • Provide contact information for support
 
💡 Best Practices
- •Call this mutation immediately after the user returns from PayPal to provide instant feedback
 - •Implement a loading state while the capture is being processed to improve UX
 - •Store the order ID in session storage to handle page refreshes during the payment flow
 - •Provide clear error messages and recovery options if the capture fails
 - •Log all capture attempts for auditing and troubleshooting purposes
 
Related Endpoints
Create PayPal Payment
Initiate a PayPal deposit and obtain the order ID
paypalForDepositView PayPal Transactions
Query PayPal deposit transaction history
getPaypalDepositTxnsByUser