Lesson 68 Implementation: Building a Secure Buyer Purchase Details Page in Flipnzee Auctions
In the previous lesson, buyers gained access to a My Purchases dashboard where they could see every website they had won through Flipnzee Auctions. While that was a major improvement, buyers still had no way to inspect an individual transaction.
Lesson 68 addresses this by introducing a dedicated Purchase Details page. Buyers can now click a transaction from their purchase history and securely view its complete details.
What We Built
During this lesson, a new frontend component was created specifically for buyers.
The new class:
Flipnzee_My_Purchase_Details
is responsible for displaying the details of a single purchase.
The page is powered by a new shortcode:
[flipnzee_purchase_details]
Creating the Purchase Details Class
A new file was added to the plugin:
includes/class-my-purchase-details.php
Initially, the class simply:
- Prevented direct access.
- Checked whether the visitor was logged in.
- Displayed a placeholder heading.
Building the page incrementally allowed each stage to be tested before adding more functionality.
Loading the Class
The new class was loaded inside the main plugin file.
require_once FLIPNZEE_AUCTION_PATH .
'includes/class-my-purchase-details.php';
After every modification, syntax was verified using:
php -l flipnzee-auctions.php
Registering the Shortcode
Next, the shortcode was registered inside the shortcode manager.
[flipnzee_purchase_details]
This allows the purchase details page to be inserted on any WordPress page using a shortcode, keeping the implementation flexible and reusable.
Reading the Transaction ID
Unlike the purchase history page, the details page must know which transaction to display.
The transaction ID is retrieved from the URL.
Example:
https://flipnzee.com/purchase-details/?transaction_id=2
The value is sanitised using:
absint()
If no transaction ID is supplied, a friendly error message is shown instead of attempting a database query.
Secure Database Lookup
One of the most important parts of this lesson was securing access to transaction data.
Instead of loading a transaction using only its ID, the query verifies both:
- Transaction ID
- Logged-in Buyer ID
The SQL query therefore ensures buyers can only access their own purchases.
Even if someone manually changes:
?transaction_id=1
to
?transaction_id=50
they cannot view another user’s transaction unless they are the rightful buyer.
This is an essential security practice for any marketplace application.
Building the Purchase Details Page
Once the transaction is retrieved successfully, the page displays a professional summary.
Information shown includes:
- Transaction ID
- Auction Title
- Winning Bid
- Transaction Status
- Purchase Date
Instead of returning plain HTML strings, PHP output buffering was used.
ob_start();
...
return ob_get_clean();
This keeps the template much easier to read and maintain.
Adding Navigation from My Purchases
The purchase history table was then enhanced with a brand new Details column.
Each purchase now contains a View Details link.
Clicking the link automatically opens the Purchase Details page for the selected transaction.
The navigation flow now becomes:
My Purchases
│
▼
View Details
│
▼
Purchase Details
This creates a far more natural user experience than requiring buyers to manually edit URLs.
Testing
Several scenarios were tested during implementation.
Missing Transaction ID
Without a transaction ID:
/testing/
the page correctly displayed:
Invalid transaction.
Valid Transaction
When a valid transaction was supplied:
/testing/?transaction_id=2
the page successfully displayed the transaction details.
Invalid Transaction
Using an invalid transaction ID correctly returned:
Transaction not found.
This confirms the validation logic is working correctly.
Final Result
The completed Purchase Details page now displays information similar to:
| Field | Value |
|---|---|
| Transaction ID | 2 |
| Auction | Wpnzee.com |
| Winning Bid | ₹55,555,609.00 |
| Status | Paid |
| Purchased | 2026-07-06 05:42:05 |
The page is accessible directly from the buyer’s purchase history through the View Details link.
Lessons Learned
This lesson reinforced several important WordPress development concepts.
- Building reusable shortcode-based pages.
- Reading and sanitising URL parameters.
- Using
$wpdb->prepare()for secure database queries. - Verifying ownership before displaying private information.
- Using output buffering to generate HTML templates.
- Creating navigation between frontend pages.
- Improving usability through contextual links.
Download Source Code
Download the starting version of the plugin before the lesson:
⬇ Download Plugin (After Lesson 67) (0 downloads )Download the completed version after this lesson:
⬇ Download Plugin (After Lesson 68) (0 downloads )Why This Feature Matters
Lesson 68 completes the buyer transaction workflow within Flipnzee Auctions.
Previously, buyers could only see a list of purchases. They can now drill down into individual transactions and review important information without needing administrator assistance.
Combined with the My Purchases dashboard introduced in Lesson 67, buyers now have a professional frontend experience that mirrors the functionality commonly found in commercial marketplace platforms.
As Flipnzee evolves, this page can be expanded further with payment confirmations, downloadable invoices, escrow status, support requests, digital asset delivery, and other post-purchase features. It provides a strong and secure foundation for the buyer experience while bringing the Flipnzee Auctions plugin another significant step closer to a production-ready Version 1 release.
