🛒

payments

Payment transaction record for an order. Tracks payment details, transaction ID, amount, payment method, status, and card information (last 4 digits and brand for card payments).

🎯 Request Builder

https://api.mockly.codes/payments?page=1&limit=10&count=10
📡

Configure your request and click Send Request to see the response here.

Endpoints

GET/payments

Get a collection of payments

Alternative: /commerce/payments
GET/payments/:id

Get a single payment by ID

Alternative: /commerce/payments/:id
GET/payments/meta

Get resource metadata and schema

Alternative: /commerce/payments/meta
🔍

How to Use Search

The search feature allows you to filter results by searching for text across all or specific fields. Choose between ?q= or ?search= parameter names.

1. Basic Search

Search across all text fields:

Basic Search
GET https://api.mockly.codes/payments?q=laptop

2. Search Specific Fields

Field-Specific Search
GET https://api.mockly.codes/payments?q=laptop&search_fields=name,description

💡 Pro Tips

  • Search is case-insensitive and performs partial matching
  • Without search_fields, all text fields are searched
  • Combine with pagination to handle large result sets efficiently

Code Examples

JavaScript

Fetch Collection
// Get 10 payments
fetch('https://api.mockly.codes/payments?count=10')
  .then(res => res.json())
  .then(data => console.log(data));

Python

Fetch with Requests
import requests

response = requests.get(
    'https://api.mockly.codes/payments?count=10'
)
data = response.json()

cURL

Command Line
curl "https://api.mockly.codes/payments?count=10"

Bypass Cache

Get Fresh Data
fetch('https://api.mockly.codes/payments?nocache=true')

Schema Properties

idinteger

Unique identifier for the payment record

Gen:random_int
transaction_idstring

Unique transaction identifier from the payment processor or gateway

Gen:transaction_id
order_idinteger

Foreign key reference to the order this payment is for

Gen:random_int
customer_idinteger

Foreign key reference to the customer who made the payment

Gen:random_int
amountnumber

Payment amount charged to the customer

Gen:price
currencystring

ISO currency code for the payment amount (e.g., USD, EUR, GBP)

Gen:currency
methodstring

Payment method used (e.g., credit_card, debit_card, paypal, bank_transfer, apple_pay)

Gen:payment_method
statusstring

Payment processing status (e.g., pending, processing, completed, failed, refunded)

Gen:payment_status
card_last4string

Last 4 digits of the credit/debit card used for payment (if applicable)

Gen:card_last4
card_brandstring

Card brand or network (e.g., Visa, Mastercard, American Express, Discover) if card payment

Gen:card_brand
created_atstring

Timestamp when the payment was initiated

Gen:past_datedate-time
processed_atstring

Timestamp when the payment was successfully processed and completed

Gen:past_datedate-time

Query Parameters

countinteger

Number of items to return (default: 10, max: 100)

seedinteger

Seed for reproducible data generation

nocacheboolean

Bypass cache and generate fresh data on every request