Learn how to configure the payout amount component for Web.
The payout amount component requires no mandatory configuration to function. It displays the payout amount from the SDK initialisation configuration.
const amountComponent = pxpCheckoutSdk.create('payout-amount');
amountComponent.mount('payout-amount-container');For more control over the display, you can configure custom labels and styling:
const amountConfig = {
label: "Withdrawal Amount",
style: {
color: "#333333",
backgroundColor: "#f5f5f5",
borderColor: "#cccccc",
borderRadius: "4px",
padding: "12px 16px",
fontSize: "18px",
fontWeight: "600"
},
labelStyle: {
color: "#666666",
fontSize: "14px",
fontWeight: "500",
marginBottom: "8px"
}
};
const amountComponent = pxpCheckoutSdk.create('payout-amount', amountConfig);
amountComponent.mount('payout-amount-container');| Property | Description |
|---|---|
labelstring | The custom text for the amount label. Defaults to "Amount". |
styleCSSProperties | CSS styles applied to the amount value element. |
labelStyleCSSProperties | CSS styles applied to the label element. |
The payout amount is read from the transactionData.amount and transactionData.currency values provided during SDK initialisation. This component is display-only and does not accept user input.
The payout amount component renders with minimal default styling, allowing it to adapt to your page's existing styles.
You can customise both the label and the amount value display:
const amountConfig = {
label: "You will receive",
style: {
color: "#2e7d32",
backgroundColor: "#e8f5e9",
borderColor: "#a5d6a7",
borderWidth: "1px",
borderStyle: "solid",
borderRadius: "8px",
padding: "16px 20px",
fontSize: "24px",
fontWeight: "bold",
textAlign: "center"
},
labelStyle: {
color: "#1b5e20",
fontSize: "12px",
fontWeight: "600",
textTransform: "uppercase",
letterSpacing: "0.5px"
}
};| Property | Description |
|---|---|
styleCSSProperties | Styling for the amount value container. |
labelStyleCSSProperties | Styling for the label text above the amount. |
The style and labelStyle objects accept standard CSS properties:
| Property | Description | Example |
|---|---|---|
colorstring | The text colour. | "#333333" |
backgroundColorstring | The background colour. | "#f5f5f5" |
borderColorstring | The border colour. | "#cccccc" |
borderWidthstring | The border width. | "1px" |
borderStylestring | The border style. | "solid" |
borderRadiusstring | The corner radius. | "8px" |
paddingstring | The inner padding. | "16px 20px" |
fontSizestring | The font size. | "18px" |
fontWeightstring | number | The font weight. | "bold" or 600 |
textAlignstring | The text alignment. | "center" |
fontFamilystring | The font family. | "Arial, sans-serif" |
Renders the amount component in the specified container:
const amountComponent = pxpCheckoutSdk.create('payout-amount', amountConfig);
amountComponent.mount('payout-amount-container');Removes the component from the DOM:
amountComponent.unmount();A simple implementation showing the payout amount:
const amountComponent = pxpCheckoutSdk.create('payout-amount', {
label: "Amount"
});
amountComponent.mount('payout-amount-container');An implementation with prominent styling to highlight the payout amount:
const amountConfig = {
label: "Withdrawal Amount",
style: {
color: "#1a1a1a",
backgroundColor: "#ffffff",
borderColor: "#e0e0e0",
borderWidth: "1px",
borderStyle: "solid",
borderRadius: "12px",
padding: "20px 24px",
fontSize: "32px",
fontWeight: "700",
textAlign: "center",
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.08)"
},
labelStyle: {
color: "#757575",
fontSize: "14px",
fontWeight: "500",
textAlign: "center",
marginBottom: "12px"
}
};
const amountComponent = pxpCheckoutSdk.create('payout-amount', amountConfig);
amountComponent.mount('payout-amount-container');A minimal inline display for use in confirmation flows:
const amountConfig = {
label: "Payout:",
style: {
color: "#333333",
fontSize: "16px",
fontWeight: "600",
display: "inline"
},
labelStyle: {
color: "#666666",
fontSize: "14px",
fontWeight: "normal",
display: "inline",
marginRight: "8px"
}
};
const amountComponent = pxpCheckoutSdk.create('payout-amount', amountConfig);
amountComponent.mount('payout-amount-container');A full example showing the amount component in context with other payout components:
import { PxpCheckout, IntentType, CurrencyType } from "@pxpio/web-components-sdk";
async function initializePayoutPage() {
const sessionData = await getSessionDataFromBackend();
const pxpCheckoutSdk = PxpCheckout.initialize({
environment: "test",
session: sessionData,
ownerId: "Unity",
ownerType: "MerchantGroup",
transactionData: {
amount: 150.00,
currency: "USD" as CurrencyType,
entryType: "Ecom",
intent: { paypal: IntentType.Payout },
merchantTransactionId: crypto.randomUUID(),
merchantTransactionDate: () => new Date().toISOString()
},
paypalConfig: {
payoutConfig: {
proceedPayoutWithSdk: true,
paypalWallet: {
email: "customer@example.com"
}
}
}
});
// Create amount component with custom styling
const amountComponent = pxpCheckoutSdk.create('payout-amount', {
label: "You're withdrawing",
style: {
color: "#2e7d32",
fontSize: "28px",
fontWeight: "bold",
textAlign: "center",
padding: "16px"
},
labelStyle: {
color: "#666666",
fontSize: "14px",
textAlign: "center"
}
});
// Mount the component
amountComponent.mount('payout-amount-container');
// Cleanup on page unload
window.addEventListener('beforeunload', () => {
amountComponent.unmount();
});
}
initializePayoutPage();The corresponding HTML structure:
<div class="payout-page">
<h1>Withdraw funds</h1>
<div id="payout-amount-container"></div>
<div id="payout-receiver-container"></div>
<div id="payout-submit-container"></div>
</div>