Reward Redemption API Documentation
Complete API documentation for BigCity Reward Redemption Platform integration. This documentation covers the integration flow, API endpoints, security features, and implementation details.
By: BigCity
Version: 1.0
Authentication
All API requests require Bearer Token authentication. Include the token in the Authorization header for all API calls.
Authorization: Bearer YOUR_TOKEN_HERE
Security Features
The platform implements multiple layers of security to protect data and transactions.
Security Measures
| Feature | Description |
|---|---|
| Data in Transit | Encrypted using SSL V3 |
| Data at Rest | Encrypted using PG CRYPTO Based AES256 algorithm |
| Server Whitelisting | Client server is whitelisted on BigCity server. Requests from non-whitelisted servers are automatically blocked |
| Bearer Token | All API calls use Bearer Token authentication |
| HTTPS Only | All communication occurs over HTTPS |
1. Client Redirect to Redemption Portal
Client redirects users to the BigCity redemption portal with token and uid parameters. The portal can be opened in an iframe, in-app browser, or new web page.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token |
string | Required | User authentication token |
uid |
string | Required | User unique identifier |
Example URL
https://bigcity-redemption.com/signin?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...&uid=UP011527
System Architecture
High-level architecture of the reward integration platform showing the interaction between Client System, BigCity Platform, and Vendor Systems.
graph TB
subgraph Client["Client System (Source of Truth)"]
CS[Client Server]
CDB[(Client Database
Points Master)]
end
subgraph BigCity["BigCity Platform"]
Portal[Redemption Portal
Web/Mobile]
BCAPI[BigCity API Server]
BCDB[(BigCity Database
Orders & Catalog)]
end
subgraph Vendor["Vendor Systems"]
V1[Vendor 1
E-Gift Cards]
V2[Vendor 2
Physical Products]
V3[Vendor 3
Services]
end
User[Customer] -->|1. Redirect with Token| Portal
Portal -->|2. Validate Token| CS
CS -->|3. Profile + Points| Portal
Portal -->|4. Browse Catalog| BCAPI
Portal -->|5. Place Order| BCAPI
BCAPI -->|6. Deduct Points| CS
CS -->|7. Confirm Deduction| BCAPI
BCAPI -->|8. Fulfill Order| V1
BCAPI -->|8. Fulfill Order| V2
BCAPI -->|8. Fulfill Order| V3
V1 -->|9. Voucher/Product| BCAPI
BCAPI -->|10. Update Status| CS
CS -->|11. Points Reversal
if Rejected| CDB
BCAPI -->|12. Voucher Details| CS
CS -->|13. SMS/WhatsApp| User
CS -.->|Points Balance| CDB
BCAPI -.->|Store Orders| BCDB
style Client fill:#e3f2fd
style BigCity fill:#fff3e0
style Vendor fill:#f3e5f5
style User fill:#c8e6c9
• Client System: Source of truth for points, handles authentication and point balance
• BigCity Platform: Redemption portal, catalog management, and order processing
• Vendor Systems: Third-party fulfillment for products and services
• All communication secured via HTTPS with Bearer Token authentication
Sequence Flow Diagram
Complete flow of payment, points credit, redemption, and order processing.
sequenceDiagram
autonumber
participant Customer
participant ClientApp as Client App
participant ClientAPI as Client API
participant Portal as BigCity Portal
participant BigCityAPI as BigCity API
participant Vendor
Note over Customer,Vendor: Payment & Points Credit Flow
Customer->>ClientApp: Makes Digital Payment
ClientApp->>ClientAPI: Trigger Payment Event
ClientAPI->>BigCityAPI: Credit Points API
BigCityAPI-->>ClientAPI: Points Credited
ClientAPI-->>Customer: Payment Confirmed
Note over Customer,Vendor: Redemption Flow
Customer->>ClientApp: Opens Reward Portal
ClientApp->>Portal: Redirect (token, uid)
Portal->>ClientAPI: POST /getProfileAndPoints?uid=
ClientAPI-->>Portal: Profile + Points Data
Portal-->>Customer: Display Catalog
Note over Customer,Vendor: Order Placement Flow
Customer->>Portal: Select Product & Place Order
Portal->>BigCityAPI: Create Order
BigCityAPI->>ClientAPI: POST /saveRedeemDetails
ClientAPI->>ClientAPI: Validate & Deduct Points
ClientAPI-->>BigCityAPI: Success (200)
BigCityAPI-->>Portal: Order Confirmed
Portal-->>Customer: Order Confirmation
Note over Customer,Vendor: Fulfillment Flow
BigCityAPI->>Vendor: Fulfill Order
Vendor-->>BigCityAPI: Voucher/Product Details
BigCityAPI->>ClientAPI: POST /updateRedeemStatus (Delivered)
ClientAPI-->>BigCityAPI: Status Updated (200)
Note over Customer,Vendor: Voucher Delivery Flow
ClientAPI->>ClientAPI: GET /getwalletdetail?uid=
ClientAPI->>ClientAPI: SMS/WhatsApp Gateway
ClientAPI-->>Customer: Voucher via SMS/WhatsApp
Note over Customer,Vendor: Failure & Reversal Flow
alt Order Rejected
Vendor-->>BigCityAPI: Order Failed
BigCityAPI->>ClientAPI: POST /updateRedeemStatus (Rejected)
ClientAPI->>ClientAPI: Reverse Points
ClientAPI-->>BigCityAPI: Status Updated (200)
end
Integration Flow Steps
- Customer performs digital payment
- Client triggers payment event to BigCity
- BigCity calculates reward points
- BigCity calls Credit Points API to credit points to customer wallet
- Customer opens reward portal
- BigCity calls getProfileAndPoints API to fetch available points
- Customer redeems reward product
- BigCity calls saveRedeemDetails API to deduct points
- BigCity fulfills order via vendor
- BigCity updates order status using updateRedeemStatus API
Reward Points Flow
Detailed explanation of how reward points are earned, stored, redeemed, and reversed in the system.
flowchart TD
Start([Customer Action]) --> Payment{Digital Payment?}
Payment -->|Yes| CalcPoints[Calculate Reward Points]
CalcPoints --> CreditAPI[Credit Points API Call]
CreditAPI --> UpdateBalance[(Update Points Balance
in Client DB)]
UpdateBalance --> Earned[Points Earned ✓]
Payment -->|No| Portal[Open Redemption Portal]
Earned --> Portal
Portal --> Validate[Validate Token & Fetch
Profile + Points]
Validate --> ShowCatalog[Display Reward Catalog]
ShowCatalog --> CustomerSelect{Customer
Selects Product?}
CustomerSelect -->|No| End1([Exit])
CustomerSelect -->|Yes| CheckBalance{Sufficient
Balance?}
CheckBalance -->|No| InsufficientMsg[Show Insufficient Balance]
InsufficientMsg --> End1
CheckBalance -->|Yes| PlaceOrder[Place Order]
PlaceOrder --> SaveRedeem[saveRedeemDetails API]
SaveRedeem --> DeductPoints[Deduct Points from Balance]
DeductPoints --> OrderPending[Order Status: Pending]
OrderPending --> ProcessOrder[BigCity Processes Order]
ProcessOrder --> VendorFulfill{Vendor
Fulfillment}
VendorFulfill -->|Success| Delivered[Status: Delivered]
Delivered --> NotifyCustomer[Send Voucher via
SMS/WhatsApp]
NotifyCustomer --> Complete[Points Deducted ✓]
Complete --> End2([Transaction Complete])
VendorFulfill -->|Failed| Rejected[Status: Rejected]
Rejected --> ReversePoints[Reverse Points
Credit Back to Customer]
ReversePoints --> LogReversal[(Log Reversal
in Client DB)]
LogReversal --> NotifyFail[Notify Customer
Order Failed]
NotifyFail --> PointsRestored[Points Restored ✓]
PointsRestored --> End3([Transaction Reversed])
style Start fill:#c8e6c9
style Payment fill:#fff9c4
style Earned fill:#81c784
style Complete fill:#81c784
style PointsRestored fill:#81c784
style Rejected fill:#ef5350
style ReversePoints fill:#ffb74d
style End2 fill:#66bb6a
style End3 fill:#ffa726
Points Lifecycle States
| State | Description | Action |
|---|---|---|
| Earned | Points credited after payment | Available for redemption |
| Pending | Points deducted, order processing | Wait for fulfillment |
| Redeemed | Order delivered successfully | Points permanently deducted |
| Reversed | Order rejected/failed | Points credited back |
2. Get Profile and Points API
Once the user lands on the redemption portal, this validation API is called with the user token. On valid token, user's basic information and points are shared with BigCity.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uid |
string | Required | User unique identifier |
Headers
| Header | Value |
|---|---|
Authorization |
Bearer {token} |
Success Response (200)
{
"profile": {
"pincode": 600118,
"cus_type": "2",
"address2": "Address",
"city": "Chennai",
"address1": "Address",
"mobileNo": "9999999999",
"panVerifiedStatus": "verified",
"uid": "XYZ",
"mdate": "",
"projectCode": "P",
"dob": "05/09/2022",
"name": "Jhon Snow",
"state": 17,
"partnerType": "D",
"pan": "ABCDEF1234H",
"projectName": "REWARD",
"projectId": 1,
"email": ""
},
"points": {
"totalEarned": 20682,
"balance": 20572,
"totalRedeemed": 110
}
}
Error Response (422)
{
"success": false,
"status": 422,
"data": {
"name": "Unprocessable entity",
"message": "Token Invalid",
"code": 0,
"status": 422,
"type": "yii\\web\\HttpException"
}
}
Valid Token: User's basic information and points are shared, and a fully functional rewards catalogue is populated.
Credit Points API
Credits reward points to customer wallet after a digital payment event.
Request Body
{
"uid": "UP011527",
"eventType": "DIGITAL_PAYMENT",
"transactionId": "TXN12345",
"paymentAmount": "5000",
"points": "50"
}
Request Fields
| Field | Type | Description |
|---|---|---|
uid |
string | User unique identifier |
eventType |
string | Type of event (e.g., DIGITAL_PAYMENT) |
transactionId |
string | Unique transaction identifier |
paymentAmount |
string | Payment amount |
points |
string | Reward points to be credited |
3. Save Redeem Details API
Once an order is placed in the redemption portal, order details are stored in BigCity database. A redemption code is generated and order details are sent to Client API along with points to be deducted.
Headers
| Header | Value |
|---|---|
Authorization |
Bearer {token} |
Request Body
{
"uid": "UP011527",
"scheme": "P",
"redeemCode": "PUP011527110032026299",
"redeemPoints": "5000",
"shippingAddress": "Bangalore",
"processingFee": "20",
"productCode": "EGCGBAMZAPCP001",
"productName": "Amazon Pay E-Gift Card-API Reseller-Premier Sales Promotion Pvt Ltd",
"quantity": "1",
"redeemStatus": "pending",
"email": "xyz@bigcity.in",
"mobileNo": "9999999999",
"totalpoints": "5000",
"totalPointWithProcessingFee": "5242",
"tdsSingleItem": "222"
}
Request Fields
| Field | Type | Description |
|---|---|---|
uid |
string | User unique identifier |
scheme |
string | Project/Program code |
redeemCode |
string | Unique redemption code generated by BigCity |
redeemPoints |
string | Points to be deducted for this redemption |
shippingAddress |
string | Delivery address for physical products |
processingFee |
string | Processing fee applicable |
productCode |
string | Unique product identifier |
productName |
string | Product name/description |
quantity |
string | Quantity ordered |
redeemStatus |
string | Initial status (pending) |
totalPointWithProcessingFee |
string | Total points including all fees |
tdsSingleItem |
string | TDS amount for single item |
Success Response (200)
{
"success": true,
"status": 200
}
Error Response (422)
{
"success": false,
"status": 422,
"data": {
"name": "Unprocessable entity",
"message": "Please enter the mandatory details to proceed further.",
"code": 0,
"status": 422,
"type": "yii\\web\\HttpException"
}
}
4. Update Redeem Status API
Once BigCity processes the order, the order status is updated in Client's system. Status can be: Pending, Delivered, or Rejected.
Headers
| Header | Value |
|---|---|
Authorization |
Bearer {token} |
Pending Order Status
{
"redeemCode": "ABCDEFGH12345677",
"status": "Pending",
"orderStatus": "Pending",
"remark": "",
"projectCode": "P"
}
Success Order Status (Delivered)
{
"redeemCode": "ABCDEFGH12345677",
"status": "Delivered",
"orderStatus": "Delivered",
"remark": "",
"projectCode": "P"
}
Failed Order Status (Rejected)
{
"redeemCode": "ABCDEFGH12345677",
"status": "Rejected",
"orderStatus": "Rejected",
"remark": "",
"projectCode": "P"
}
Success Response (200)
{
"success": true,
"status": 200
}
Error Response (422)
{
"success": false,
"status": 422,
"data": {
"name": "Unprocessable entity",
"message": "Please enter the mandatory details to proceed further.",
"code": 0,
"status": 422,
"type": "yii\\web\\HttpException"
}
}
• Successful Order: Status updated as "Delivered" in Client's system
• Failed Order: Status updated as "Rejected". Client must reverse the points to the customer.
Rejection reasons: Product not in stock, Rejected from Client's end, etc.
5. Wallet API (Webhook)
Retrieves voucher codes associated with a user. Client calls this API to fetch voucher codes, then delivers them via their SMS and WhatsApp gateway.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
uid |
string | Required | User unique identifier |
Headers
| Header | Value |
|---|---|
Authorization |
Bearer {token} |
Success Response (200)
{
"success": true,
"status": 200,
"data": [
{
"voucherCode": "TESTKFC12325466",
"redemptionCode": "RRSTN010027520022024403",
"projectCode": "R",
"partnerCode": "S",
"productCode": "ERBCJ053",
"productName": "KFC",
"denomination": 100,
"validityStartDate": "2024-02-20 00:00:00",
"validityEndDate": "2024-08-20 00:00:00",
"faceValue": 100,
"GCID": null,
"pin": null,
"remark": "REWARD Program"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
voucherCode |
string | Unique voucher code |
redemptionCode |
string | Redemption transaction code |
productCode |
string | Product identifier |
productName |
string | Product/Brand name |
denomination |
integer | Voucher denomination/value |
validityStartDate |
datetime | Voucher validity start date |
validityEndDate |
datetime | Voucher validity end date |
pin |
string | Voucher PIN (if applicable) |
Voucher Delivery
Client is responsible for delivering voucher codes to customers using their SMS and WhatsApp gateway.
Delivery Process
- BigCity provides Wallet API to fetch voucher codes
- Client calls the Wallet API with user's UID
- Client receives voucher details in the response
- Client calls their own SMS gateway to send voucher code via SMS
- Client calls their own WhatsApp gateway to send voucher code via WhatsApp
Points Reversal Logic
When a redemption fails or is rejected, the client system must restore the deducted points to the customer's account.
Reversal Process
| Scenario | Action Required |
|---|---|
| Status: Delivered | No action needed. Points remain deducted. |
| Status: Rejected | Client must reverse/credit points back to customer based on the redeemCode transaction. |
| Status: Pending (Timeout) | If order remains pending beyond threshold, client may choose to reverse points. |
totalPointWithProcessingFee
amount to maintain accurate point balance.
Reversal Implementation
// When receiving updateRedeemStatus with status "Rejected"
if (orderStatus === "Rejected") {
// 1. Find the original redemption transaction
transaction = findTransactionByRedeemCode(redeemCode);
// 2. Credit back the total points
creditPoints(
uid: transaction.uid,
points: transaction.totalPointWithProcessingFee,
reason: "Order rejected - " + remark,
referenceCode: transaction.redeemCode
);
// 3. Log the reversal for audit
logPointsReversal(transaction, orderStatus, remark);
}