
Project goals
01
Automate the distribution of cryptocurrency payments between buyers, sellers, and the marketplace owner.
02
Ensure transparent and secure transactions using smart contracts.
03
Implement a system to handle various payment scenarios, including underpayments, overpayments, and expired intents.
Delivery

Custom smart contract development and deployment on PaychainX

Backend service integration for real-time payment monitoring

Automated fund distribution and transaction recording
Solution

A Payment Factory smart contract was developed to create individual payment contracts for each transaction.

Buyers are provided with unique Custom Payment Addresses for each purchase.

A backend listener service monitors these addresses for incoming payments.

Upon receiving the correct amount, a "Payment" smart contract distributes funds automatically.

The system handles payment intent expiration, underpayments, and overpayments.
Key features & functionality

Custom payment addresses
Unique addresses are generated for each transaction.

Automated distribution
Smart contracts automatically distribute funds

Real-time monitoring
Backend service tracks incoming payments.

Intent management
Handles payment intent expiration and underpayments.

Overpayment handling
Automatically returns excess funds.
User roles
Buyer
⬝ Initiates purchases by selecting items and quantities.
⬝ Sends cryptocurrency payments to the generated custom payment address.
⬝ Receives any overpayments automatically.
Seller
Receives the item price minus the marketplace fee after a successful transaction.
Marketplace owner
Receives the marketplace fees from each transaction.
User flow
Purchase initiation
▪ The buyer accesses the marketplace platform.
▪ The buyer selects an item and enters the desired quantity.
Price calculation and intent creation
▪ The system calculates the total price.
▪ The total price is displayed to the buyer.
▪ A purchase intent is created.
▪ A unique "Custom Payment Address" (wallet address on PaychainX is generated for the transaction.
▪ The purchase intent is set to expire after 2 hours.
Payment transfer
The buyer funds the purchase by sending cryptocurrency from any PaychainX wallet to the generated custom payment address.
Payment monitoring
A backend listener service continuously monitors the custom payment address for incoming token transfers.
Payment processing and distribution
▪ Once the correct amount of tokens is received, the back-end operator, with appropriate contract privileges, initiates the deployment of the "Payment" smart contract.
▪ The "Payment" smart contract withdraws the tokens from the custom payment address.
▪ The "Payment" smart contract automatically distributes the funds:
-
Item price × quantity - marketplace fee is sent to the seller.
-
Marketplace fees are sent to the marketplace owner.
▪ All transactions are recorded on the PaychainX ledger.
Transaction confirmation and item delivery
▪ The backend service monitors for transaction confirmation on the PaychainX blockchain.
▪ Upon successful confirmation, the system initiates the item collection and delivery process to the buyer
Intent expiration
If the correct amount of tokens is not received within 2 hours, the purchase intent is deprecated.
Underpayment handling
▪ If tokens are received, but the amount is less than the required total, the purchase intent lifetime is extended to 8 hours.
▪ The buyer can send the remaining amount during this extended period.
▪ If the full payment is not received within the 8-hour window, the partial amount is returned to the buyer, and the intent is deprecated.
Overpayment handling
Any extra tokens sent by the buyer are automatically returned to the buyer's wallet.


Smart сontracts
The smart contract development team employed well-established design patterns, such as the factory pattern and the minimal proxy standard within the payment gateway, optimizing for efficiency and scalability.
Project features

Automated payment distribution

Unique payment addresses

Real-time payment monitoring

Handling of different payment scenarios