Display stored PayPal account details to customers in your Android app.
The PayPal receiver component is a read-only display component that shows the customer's stored PayPal email address. It automatically retrieves the email from the SDK configuration's payout wallet data and provides optional masking functionality for privacy.
Use the PayPal receiver component when:
- You're implementing the withdrawal flow for returning customers.
- You have the customer's PayPal email and payer ID stored.
- You want to display which PayPal account will receive the payout.
- You want to provide privacy with email masking options.
Create the receiver component using the SDK's factory method:
import com.pxp.checkout.components.paypalpayoutreceiver.PaypalPayoutReceiverComponentConfig
import com.pxp.checkout.types.ComponentType
val receiverComponent = pxpCheckout.createComponent(
type = ComponentType.PAYPAL_PAYOUT_RECEIVER,
config = PaypalPayoutReceiverComponentConfig(
label = "PayPal Account",
showMaskToggle = true,
applyMask = true
)
)Configure the receiver display with these properties:
| Property | Description |
|---|---|
labelString | The label displayed above the email. Customise it to match your app's terminology. Defaults to "Receiver". |
showMaskToggleBoolean | Whether to show a toggle button so the customer can mask or unmask the email. Displays an eye icon button. Defaults to true. When true, the email always starts masked regardless of applyMask. |
applyMaskBoolean | Whether the email stays masked when showMaskToggle is false. When the toggle is hidden and this is true, the email displays masked. For example, j***@****.com for john@example.com). When the toggle is hidden and this is false, the full email is shown. When showMaskToggle is true, this property does not control the initial display. Defaults to true. |
placeholderString | The placeholder text. Not used in read-only display mode. Included for configuration completeness. Defaults to "". |
visibilityOnIconInt | The resource ID for the visibility on icon, which is shown when the email is visible. Used when showMaskToggle is true. Defaults to R.drawable.ic_visibility. |
visibilityOffIconInt | The resource ID for the visibility off icon, which is shown when the email is masked. Used when showMaskToggle is true. Defaults to R.drawable.ic_visibility_off. |
validationMessagesPaypalPayoutReceiverValidationMessages | The custom validation messages. Customise the error messages for an invalid email format. Defaults to PaypalPayoutReceiverValidationMessages(). |
stylePaypalPayoutReceiverStyle? | The custom styling configuration. Customise colours, typography, and spacing. Uses default PayPal styling if not provided. Defaults to null. |
The PayPal email is automatically retrieved from PxpSdkConfig.paypalConfig.payout.paypalWallet.email. You don't need to pass the email to the component.
Override the default validation copy with this property:
| Property | Description |
|---|---|
invalidEmailFormatString | The error message for an invalid email format. Defaults to "Please enter a valid email address". |
Render the component using Jetpack Compose:
@Composable
fun PayoutScreen() {
val receiverComponent = remember {
pxpCheckout.createComponent(
type = ComponentType.PAYPAL_PAYOUT_RECEIVER,
config = PaypalPayoutReceiverComponentConfig(
label = "Sending to",
showMaskToggle = true,
applyMask = true
)
)
}
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
receiverComponent.Content(Modifier.fillMaxWidth())
}
}Here's a complete example showing the receiver component in a withdrawal flow:
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.pxp.PxpCheckout
import com.pxp.checkout.components.payoutamount.PayoutAmountComponentConfig
import com.pxp.checkout.components.paypalpayoutreceiver.PaypalPayoutReceiverComponentConfig
import com.pxp.checkout.components.payoutsubmission.PayoutSubmissionComponentConfig
import com.pxp.checkout.models.*
import com.pxp.checkout.models.payout.PrePayoutSubmitResult
import com.pxp.checkout.types.ComponentType
import java.util.UUID
class PayPalReceiverActivity : ComponentActivity() {
private lateinit var pxpCheckout: PxpCheckout
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Get stored customer wallet
val customerWallet = getStoredCustomerWallet()
// Initialise SDK with stored wallet details
pxpCheckout = PxpCheckout.builder()
.withConfig(
PxpSdkConfig(
environment = Environment.TEST,
session = sessionData,
ownerId = "Unity",
ownerType = "MerchantGroup",
clientId = "your-client-id",
transactionData = TransactionData(
amount = 150.0,
currency = "USD",
merchant = "your-merchant-id",
entryType = EntryType.Ecom,
intent = TransactionIntentData(paypal = PayPalIntentType.Payout),
merchantTransactionId = UUID.randomUUID().toString(),
merchantTransactionDate = { java.time.Instant.now().toString() }
),
paypalConfig = PaypalConfig(
payout = PayoutConfig(
proceedPayoutWithSdk = true,
paypalWallet = PayPalPayOutWalletConfig(
email = customerWallet.email, // Retrieved from storage
payerId = customerWallet.payerId
)
)
)
)
)
.withContext(this)
.build()
setContent {
MaterialTheme {
WithdrawalScreen()
}
}
}
@Composable
fun WithdrawalScreen() {
// Create components
val amountComponent = remember {
pxpCheckout.createComponent(
type = ComponentType.PAYOUT_AMOUNT,
config = PayoutAmountComponentConfig(
label = "Withdrawal Amount"
)
)
}
val receiverComponent = remember {
pxpCheckout.createComponent(
type = ComponentType.PAYPAL_PAYOUT_RECEIVER,
config = PaypalPayoutReceiverComponentConfig(
label = "Sending to",
showMaskToggle = true,
applyMask = true // Ignored for initial display when the toggle is on; email still starts masked
)
)
}
val submitConfig = remember {
PayoutSubmissionComponentConfig(
recipientWallet = "Paypal",
onPrePayoutSubmit = {
val confirmed = showConfirmationDialog()
PrePayoutSubmitResult(isApproved = confirmed)
},
onPostPayout = { result ->
navigateToSuccessScreen(result.merchantTransactionId)
}
)
}
val submitComponent = remember {
pxpCheckout.createComponent(
type = ComponentType.PAYOUT_SUBMISSION,
config = submitConfig
)
}
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
Text(
text = "Withdraw funds",
style = MaterialTheme.typography.headlineMedium
)
Text(
text = "Review your withdrawal details below",
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Card(
modifier = Modifier.fillMaxWidth(),
colors = CardDefaults.cardColors(
containerColor = MaterialTheme.colorScheme.surfaceVariant
)
) {
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
// Amount
amountComponent.Content(Modifier.fillMaxWidth())
Divider()
// PayPal receiver with masking
receiverComponent.Content(Modifier.fillMaxWidth())
Divider()
// Submit button
submitComponent.Content(Modifier.fillMaxWidth())
}
}
TextButton(
onClick = { navigateToChangePayoutMethod() }
) {
Text("Use a different PayPal account?")
}
}
}
}
}The receiver component provides built-in email masking for privacy. Masked emails use the first local character plus a masked domain. For example john@example.com displays as j***@****.com.
Use these configurations to control whether the customer can reveal the email and whether it stays masked when the toggle is hidden:
// Toggle enabled: email always starts masked; customer can reveal it
PaypalPayoutReceiverComponentConfig(
showMaskToggle = true,
applyMask = true // applyMask does not change the initial masked state when the toggle is on
)
// Toggle enabled: still starts masked (applyMask is ignored for the initial state)
PaypalPayoutReceiverComponentConfig(
showMaskToggle = true,
applyMask = false
)
// Toggle hidden: email stays masked
PaypalPayoutReceiverComponentConfig(
showMaskToggle = false,
applyMask = true
)
// Toggle hidden: full email shown
PaypalPayoutReceiverComponentConfig(
showMaskToggle = false,
applyMask = false
)Customise the component appearance using the style property:
val receiverConfig = PaypalPayoutReceiverComponentConfig(
label = "PayPal Account",
showMaskToggle = true,
applyMask = true,
style = PaypalPayoutReceiverStyle(
// Add custom styling properties
)
)Start with the email masked for customer privacy. With showMaskToggle = true, the component always starts masked; keep the toggle available so customers can reveal their address if needed:
// Good: privacy-first approach with a reveal toggle
PaypalPayoutReceiverComponentConfig(
showMaskToggle = true
)
// Also privacy-first without a toggle (email stays masked)
PaypalPayoutReceiverComponentConfig(
showMaskToggle = false,
applyMask = true
)Use descriptive labels that indicate the purpose:
// Good examples
PaypalPayoutReceiverComponentConfig(label = "Sending to")
PaypalPayoutReceiverComponentConfig(label = "PayPal Account")
PaypalPayoutReceiverComponentConfig(label = "Recipient")
// Avoid vague labels
PaypalPayoutReceiverComponentConfig(label = "Email") // Too genericEnsure your SDK is initialised with valid PayPal wallet details:
// Correct initialisation for the withdrawal flow
paypalConfig = PaypalConfig(
payout = PayoutConfig(
proceedPayoutWithSdk = true,
paypalWallet = PayPalPayOutWalletConfig(
email = "customer@example.com", // Required
payerId = "PAYER_ID_XXX" // Required for PayPal payouts
)
)
)Place the amount, receiver, and submission components in a single review column:
@Composable
fun StandardWithdrawal() {
Column(
modifier = Modifier.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
// Amount
amountComponent.Content(Modifier.fillMaxWidth())
Divider()
// Receiver with masking
receiverComponent.Content(Modifier.fillMaxWidth())
Divider()
// Submit
submitComponent.Content(Modifier.fillMaxWidth())
}
}