Pay For Presale With PayPal
Create PayPal checkout orders for presale payments with redirect flow
PayPal Checkout for Presale
Accept presale payments through PayPal's secure checkout flow
Mutation
Schema
paypalForPresale(
presaleId: Int!
orderId: Int!
currencyCode: String!
): OrderResponseDTO
Parameters
presaleId
RequiredInt!
orderId
RequiredInt!
currencyCode
RequiredString!
Return Value
Contains PayPal order ID and redirect URL for checkout
Example
mutation {
paypalForPresale(
presaleId: 1
orderId: 123
currencyCode: "USD"
) {
orderId
redirectUrl
}
}
Response Example
{
"data": {
"paypalForPresale": {
"orderId": "5O190127TN364715T",
"redirectUrl": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T"
}
}
}
Integration Flow
Call paypalForPresale mutation to create a PayPal checkout order
Redirect user to the PayPal checkout page using the redirectUrl from response
User logs into PayPal and approves the payment
PayPal redirects user back to your return URL with order details
Call captureOrderForPresale mutation to complete the payment and update order status
Use Cases
Allow users to pay directly from their PayPal account balance
Users can pay via bank accounts linked to their PayPal
Support for PayPal Credit and Buy Now Pay Later options
Accept payments from PayPal users worldwide in multiple currencies
Important Notes
PayPal payments require two steps: creating the order (this mutation) and capturing it after user approval.
Users must be redirected to PayPal's checkout page. This cannot be done in an iframe or popup.
Configure return and cancel URLs in your PayPal settings to handle post-payment redirects.
PayPal orders expire after 3 hours. Users must complete checkout within this timeframe.
Store the PayPal orderId in your database immediately after receiving it. Handle the return URL to capture the order using the captureOrderForPresale mutation. Implement timeout handling for expired orders and provide clear user feedback during the redirect flow.