Skip to content

Commit bca7573

Browse files
committed
feat: show live commission estimate on escrow create form + prominent commission on success page
- Create form: live breakdown as you type (commission amount + beneficiary receives) - Success page: amber highlighted commission box with percentage + net amount - Bump to 0.4.10
1 parent f290d3a commit bca7573

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coinpayportal",
3-
"version": "0.4.9",
3+
"version": "0.4.10",
44
"private": true,
55
"type": "module",
66
"bin": {

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@profullstack/coinpay",
3-
"version": "0.4.9",
3+
"version": "0.4.10",
44
"description": "CoinPay SDK & CLI — Accept cryptocurrency payments (BTC, ETH, SOL, POL, BCH, USDC) with wallet and swap support",
55
"type": "module",
66
"main": "./src/index.js",

src/app/escrow/create/page.tsx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,16 @@ export default function CreateEscrowPage() {
451451
{new Date(createdEscrow.expires_at).toLocaleString()}
452452
</span>
453453
</div>
454-
{createdEscrow.fee_amount && (
455-
<div>
456-
<span className="text-gray-500 dark:text-gray-400">Platform Fee:</span>
457-
<span className="ml-2 text-gray-900 dark:text-white">
458-
{createdEscrow.fee_amount} {createdEscrow.chain}
459-
{createdEscrow.business_id && <span className="text-green-600 ml-1">(paid tier rate)</span>}
454+
{createdEscrow.fee_amount != null && createdEscrow.fee_amount > 0 && (
455+
<div className="bg-amber-50 dark:bg-amber-900/10 border border-amber-200 dark:border-amber-800 rounded-lg p-3">
456+
<span className="text-sm font-medium text-amber-800 dark:text-amber-300">Platform Commission:</span>
457+
<span className="ml-2 text-sm font-semibold text-amber-700 dark:text-amber-400">
458+
{createdEscrow.fee_amount} {createdEscrow.chain} ({((createdEscrow.fee_amount / createdEscrow.amount) * 100).toFixed(1)}%)
460459
</span>
460+
{createdEscrow.business_id && <span className="text-green-600 dark:text-green-400 ml-1 text-xs">(paid tier rate)</span>}
461+
<p className="text-xs text-amber-600 dark:text-amber-500 mt-1">
462+
Beneficiary will receive: {(createdEscrow.amount - createdEscrow.fee_amount).toFixed(6)} {createdEscrow.chain}
463+
</p>
461464
</div>
462465
)}
463466
{createdEscrow.business_id && (
@@ -677,6 +680,24 @@ export default function CreateEscrowPage() {
677680
<p className="mt-1 text-xs text-gray-500 dark:text-gray-400">
678681
The depositor sends exactly <strong>{cryptoAmount || '0'} {formData.chain}</strong> to fund the escrow.
679682
</p>
683+
684+
{/* Live commission estimate */}
685+
{parseFloat(cryptoAmount) > 0 && (
686+
<div className="mt-2 bg-amber-50 dark:bg-amber-900/10 border border-amber-200 dark:border-amber-800 rounded-lg p-2 text-xs">
687+
<div className="flex justify-between text-amber-800 dark:text-amber-300">
688+
<span>Platform commission ({isLoggedIn && formData.business_id ? '0.5%' : '1%'}):</span>
689+
<span className="font-medium">
690+
{(parseFloat(cryptoAmount) * (isLoggedIn && formData.business_id ? 0.005 : 0.01)).toFixed(6)} {formData.chain}
691+
</span>
692+
</div>
693+
<div className="flex justify-between text-green-700 dark:text-green-400 mt-1">
694+
<span>Beneficiary receives:</span>
695+
<span className="font-medium">
696+
{(parseFloat(cryptoAmount) * (isLoggedIn && formData.business_id ? 0.995 : 0.99)).toFixed(6)} {formData.chain}
697+
</span>
698+
</div>
699+
</div>
700+
)}
680701
</div>
681702

682703
{/* Depositor Address */}

0 commit comments

Comments
 (0)