Test your payout integration end-to-end before going live.
- Complete PayPal payouts onboarding for sandbox.
- Implement the withdrawal flow.
- Review How it works so you understand flows and payout modes.
Use the test environment and sandbox credentials for both SDK and backend.
import { PxpCheckout, IntentType, CurrencyType } from "@pxpio/web-components-sdk";
const pxpCheckoutSdk = PxpCheckout.initialize({
environment: "test", // Use test environment
session: sessionData,
ownerId: "Unity",
ownerType: "MerchantGroup",
transactionData: {
amount: 100,
currency: "USD" as CurrencyType,
entryType: "Ecom",
intent: {
paypal: IntentType.Payout
},
merchantTransactionId: crypto.randomUUID(),
merchantTransactionDate: () => new Date().toISOString()
},
paypalConfig: {
payoutConfig: {
proceedPayoutWithSdk: true
// Add paypalWallet / venmoWallet for withdrawal flow tests
}
}
});const config = {
paypal: {
clientId: process.env.PAYPAL_SANDBOX_CLIENT_ID,
secret: process.env.PAYPAL_SANDBOX_SECRET,
apiBaseUrl: 'https://api-m.sandbox.paypal.com'
},
unity: {
apiBaseUrl: 'https://api-services-test.pxp.io',
clientId: process.env.UNITY_TEST_CLIENT_ID,
tokenId: process.env.UNITY_TEST_TOKEN_ID,
tokenValue: process.env.UNITY_TEST_TOKEN_VALUE
}
};Focus first on the main customer journeys.
- Initialise the SDK with a stored PayPal wallet (
paypalWallet.emailandpayerId— both required). - Render
payout-amount,paypal-payout-receiver, andpayout-submission. - Verify:
- Amount and receiver are correctly displayed (including masking behaviour).
- With
proceedPayoutWithSdk: true, clicking Withdraw with PayPal triggersonPrePayoutSubmit. - Successful approval results in
onPostPayoutbeing called and the sandbox recipient balance increasing.
- Initialise the SDK with a Venmo wallet (
venmoWallet.receiverandrecipientType). - Render
venmo-payout-receiverandpayout-submissionwithrecipientWallet: "Venmo". - Verify the Venmo receiver displays correctly and a payout in USD completes successfully.
- With
proceedPayoutWithSdk: true, confirm the SDK executes the payout afteronPrePayoutSubmitapproves and callsonPostPayoutwith a transaction ID. Confirm that omittingonPrePayoutSubmitmeans no payout runs. - With
proceedPayoutWithSdk: false, confirm:- The SDK calls
onClickwhen the customer clicks the button, then returns without runningonPrePayoutSubmit, executing the payout, or callingonPostPayout. - Your app or backend uses that signal to call the payout API.
- The SDK calls
Use this as a lightweight "must-have" list before going live:
| Area | Scenario | What to verify |
|---|---|---|
| Withdrawal flow (PayPal) | Returning customer payout | Stored PayPal wallet is shown (including masking), onPrePayoutSubmit and onPostPayout fire for SDK-initiated mode, and the sandbox balance increases. |
| Withdrawal flow (Venmo) | Returning customer Venmo payout (USD) | Venmo receiver displays correctly, payout in USD succeeds, and Venmo-specific validation works. |
| Validation & errors | Invalid amount / email / Venmo phone | Component create throws the expected error code; your UI shows a clear message. Runtime payout failures call onError. |
| Integration | SDK- vs merchant-initiated payouts | With proceedPayoutWithSdk: true, the SDK runs the payout after approval. With false, only onClick runs and your backend executes the payout. |
Use targeted negative tests rather than exhaustively covering every error code.
- Amounts
- Negative or zero amount → expect amount validation to throw at component create (see Data validation).
- PayPal receiver
- Invalid email format or missing payer ID → expect a create-time PayPal / submission error.
- Venmo
- Non-USD currency with Venmo wallet → expect Venmo currency error at create.
- Invalid phone format when
recipientType: "Phone"→ expect phone validation error at create.
- Configuration
- Missing
recipientWalletor wallet details → expect payout configuration errors at create.
- Missing
In each case, verify that:
- Create-time validation throws the appropriate
ErrorCode(not delivered throughonError). - For SDK-initiated runtime failures,
onErroris called with a clear message. - Your UI maps technical errors to clear, user-friendly messages.
Verify that core components render and behave as expected:
payout-amount: correct amount, currency, and custom label/styling.paypal-payout-receiver/venmo-payout-receiver: masking toggle, labels, and styles.payout-submission:- Button states (default, hover, disabled, loading).
- Event callbacks:
onClick,onPrePayoutSubmit,onPostPayout,onError.
For detailed callback payloads, see Events.
Once your sandbox tests pass:
Switch environments
const pxpCheckoutSdk = PxpCheckout.initialize({ environment: "production", // ... rest of config });Update backend credentials to use live PayPal and Unity endpoints and secrets.
Run a small live test such as a $1 payout to your own PayPal account and confirm funds, reporting, and reconciliation.
Enable monitoring (error tracking, alerts on payout failures, webhook monitoring) and roll out gradually if needed.
If you hit issues during testing, see Troubleshooting and Data validation for common problems and error codes.