Skip to content

Payment Gateway Serializer

Payment Gateway Serializer


TransactionSerializer

The TransactionSerializer serializes transaction data and includes nested representations of related models.

Fields: - id: Unique transaction identifier. - transaction_id: A unique transaction string. - amount: Total amount for the transaction. - payment_method: Serialized field showing the method name. - status: Boolean field for transaction success or failure. - created_at: Timestamp of transaction creation. - updated_at: Timestamp of the last update. - product_purchased: Nested serialized data from ProductPurchasedSerializer.

ProductPurchasedSerializer

The ProductPurchasedSerializer provides details of the purchased items, including coupons and cart items.

Fields: - id: Unique identifier for the purchase. - applied_coupon: Nested serializer using ApplyCouponSerializer. - total_purchased: Total number of purchased items. - discounted_amount: Total discount applied to the purchase. - net_amount: Final purchase amount. - has_purchased_succeed: Indicates whether the purchase succeeded. - purchased_at: Timestamp of purchase completion. - purchased_cart_items: Nested list of purchased cart items.

PurchasedCartItemSerializer

This serializer provides information about individual cart items included in a purchase.

Fields: - id: Unique identifier for the purchased cart item. - order_id: Order identifier. - cart_item: Nested serialized data from CartItemSerializer. - status: Purchase status. - created_at: Creation timestamp. - updated_at: Update timestamp.

CartItemSerializer

The CartItemSerializer provides cart item details, including products and variants.

Fields: - id: Cart item identifier. - product: Nested product details using ProductSerializer. - variant: Serialized product variant details. - quantity: Quantity of the cart item. - has_purchased: Indicates if the item has been purchased. - created_at: Creation timestamp. - updated_at: Last update timestamp.

PaymentMethodSerializer

The PaymentMethodSerializer serializes payment methods for transactions.

Fields: - method_name: Name of the payment method.

ApplyCouponSerializer

The ApplyCouponSerializer includes details of the coupon applied to a purchase.

Fields: - applied_coupon: Nested coupon claim details using CouponClaimSerializer. - has_applied: Indicates if the coupon was applied. - applied_at: Timestamp of coupon application.

CouponClaimSerializer

This serializer provides details of claimed coupons.

Fields: - code: Nested CouponCodeSerializer with coupon details. - is_claimed: Indicates if the coupon has been claimed. - claimed_at: Timestamp of coupon claim.

CouponCodeSerializer

The CouponCodeSerializer provides details of available coupon codes.

Fields: - code: Unique coupon code string. - description: Description of the coupon. - discount_percent: Percentage of discount. - start_at: Start date of coupon validity. - end_at: End date of coupon validity. - min_purchase: Minimum purchase requirement for coupon use. - is_active: Indicates if the coupon is currently active.