On this page

Payment

A Payment in the Paylias network represents a transaction between two parties. It contains detailed information about the transaction participants, amounts, and contextual data to facilitate secure money movement.

Overview

Each Payment:

  • Has unique identifiers across organizations
  • Contains detailed information about transaction parties
  • Includes amount and currency details
  • Supports device and location tracking for security
  • Has built-in expiration handling

Payment Creation vs Submission

When creating a payment through the /api/v1/csp/payments endpoint, it's important to understand that this only stores the payment record and performs basic validations such as:

  • Authentication and authorization checks
  • Payment ID uniqueness verification
  • Required field presence and format validation

The payment is not automatically submitted to the network for processing.

To actually process the payment through the Paylias network, you must make a separate call to the Submit Payment endpoint. This endpoint performs deep validation checks and initiates the actual payment processing. Please refer to the Submit Payment API documentation for details on this process.

Payment Resource

Property Type Required Description Notes
payment_id string Yes Unique identifier for the payment UUID format recommended
organization_id string Yes Organization initiating the payment Auto-populated from auth
partner_id string Yes Partner under organization initiating payment Auto-populated from auth
reference string Yes External reference number e.g., Invoice number
initiated_at int64 Yes Transaction initiation timestamp Unix timestamp
expires_at int64 No Transaction expiration timestamp Unix timestamp
amount object Yes Transaction amount details See Amount Properties
debtor_party object Yes Information about the paying party See Entity Properties
beneficiary_party object Yes Information about the receiving party See Entity Properties
metadata array No Key-value pairs for additional data Max 5 entries
device object No Device information for risk assessment See Device Properties
location object No Location data for risk assessment See Location Properties

Amount Properties

Property Type Required Description
currency string Yes ISO 4217 currency code
total string Yes Amount in minor units

Entity Properties

Property Type Required Description
payment_address string Yes Unique payment address
first_name string Yes First name
last_name string Yes Last name
email string Yes Email address
phone string Yes Phone number with country code
type string Yes Entity type (Individual/Business)
category_code string Conditional Required for business entities
billing object Yes Billing address information

Billing Properties

Property Type Required Description Format/Constraints
street_1 string No Primary street address Max 60 characters
street_2 string No Secondary street address Max 60 characters
city string No City name Max 40 characters
province string No Province/State Max 40 characters
postal_code string No Postal/ZIP code Max 20 characters
country string Yes Country code ISO 3166 2-letter code

Metadata Properties

Property Type Required Description Format/Constraints
key string Yes Metadata identifier Alphanumeric, max 45 characters
value string Yes Metadata value Alphanumeric, max 45 characters

Device Properties

Property Type Required Description Format/Constraints
user_agent string No Browser/device user agent Max 500 characters
entity string No Entity associated with device
browser string No Browser name
browser_version string No Browser version
device string No Device model/name
device_type string No Type of device e.g., smartphone, tablet, desktop
platform string No Operating system
is_mobile boolean No Mobile device indicator
is_crawler boolean No Web crawler indicator

Location Properties

Property Type Required Description Format/Constraints
ip_address string No Client IP address Valid IPv4/IPv6 format
city string No City name derived from IP
country string No Country derived from IP
latitude float32 No Geographic latitude
longitude float32 No Geographic longitude
region string No Region/state derived from IP

Payment Record Type

{
    "ok": true,
    "data": {
        "payment_id": "cjes76vsemvj3obsnc52",
        "organization_id": "org_ct239n420or249k5bo90",
        "partner_id": "part_ct23b6420or249k5boag",
        "reference": "INV0001",
        "initiated_at": 1743270060,
        "expires_at": 1743273661,
        "amount": {
            "currency": "USD",
            "total": "10000"
        },
        "debtor_party": {
            "payment_address": "john@stripe-platinum",
            "first_name": "John",
            "last_name": "Collison",
            "email": "johnc@stripe.com",
            "phone": "+16462442945",
            "type": "Payee_Individual",
            "billing": {
                "country": "US"
            }
        },
        "beneficiary_party": {
            "payment_address": "ziyad@safepay-platinum",
            "first_name": "Ziyad",
            "last_name": "Parekh",
            "email": "ziyad.parekh@gmail.com",
            "phone": "+923008277879",
            "type": "Payee_Individual",
            "billing": {
                "country": "US"
            }
        },
        "device": {},
        "location": {}
    }
}

API Endpoints

Create Payment

Creates a new payment transaction.

Required Headers

Header Description
X-Org-ID Organization identifier
X-Partner-ID Partner identifier
X-Sfpy-Api-Key API key for authentication
Content-Type Must be application/json

POST /api/v1/csp/payments

curl --location 'http://localhost:9001/api/v1/csp/payments' \
--header 'X-Org-ID: org_ct239n420or249k5bo90' \
--header 'X-Partner-ID: part_ct23b6420or249k5boag' \
--header 'Content-Type: application/json' \
--header 'X-Sfpy-Api-Key: AA5B7256D7E228329F9A7D6E58880D48' \
--data '{
    "payment_id": "cjes76vsemvj3obsnc52",
    "reference": "INV0001",
    "initiated_at": 1743270454,
    "amount": {
        "currency": "USD",
        "total": "10000"
    },
    "beneficiary_party": {
        "payment_address": "ziyad@safepay-platinum",
        "first_name": "Ziyad",
        "last_name": "Parekh",
        "email": "ziyad.parekh@gmail.com",
        "phone": "+923008277879",
        "type": "Payee_Individual",
        "billing": {
            "street_1": "",
            "country": "US"
        }
    },
    "debtor_party": {
        "payment_address": "john@stripe-platinum",
        "first_name": "John",
        "last_name": "Collison",
        "email": "johnc@stripe.com",
        "phone": "+16462442945",
        "type": "Payee_Individual",
        "billing": {
            "street_1": "",
            "country": "US"
        }
    }
}'

Find Payment

Retrieves details of a specific payment.

Path Parameters

Parameter Type Required Description
paymentId string Yes Payment ID to retrieve

Required Headers

Header Description
X-Org-ID Organization identifier
X-Partner-ID Partner identifier
X-Sfpy-Api-Key API key for authentication

GET /api/v1/csp/payments/{paymentId}

curl --location 'http://localhost:9001/api/v1/csp/payments/cjes76vsemvj3obsnc53' \
--header 'X-Org-ID: org_ct239n420or249k5bo90' \
--header 'X-Partner-ID: part_ct23b6420or249k5boag' \
--header 'X-Sfpy-Api-Key: AA5B7256D7E228329F9A7D6E58880D48'

Error Codes

Error Code Description
error.bad_request Invalid or missing required parameters
error.resource_not_found Payment not found
error.unauthorized_access Invalid or missing authentication
500, 502, 503, 504 Server-side errors

Validation Rules

  1. Timestamps

    • initiated_at must not be in the future
    • expires_at must be after initiated_at
    • expires_at must not be expired
  2. Amount

    • Currency must be valid ISO 4217 code
    • Amount must be positive
    • Amount must be numeric
  3. Entities

    • Payment addresses must be valid format
    • Email addresses must be valid format
    • Phone numbers must include country code
    • Business entities must include category code
  4. Metadata

    • Maximum 5 key-value pairs
    • Keys and values limited to 45 characters
  5. Billing

    • Country must be valid ISO 3166 code
    • All string fields must not exceed maximum lengths
    • Country is the only required field
  6. Metadata

    • Both key and value must be alphanumeric
    • Both key and value must not exceed 45 characters
    • Maximum of 5 metadata entries per payment
  7. Device

    • User agent must be valid format if provided
    • User agent must not exceed 500 characters
    • Boolean fields default to false if not provided
  8. Location

    • IP address must be valid IPv4/IPv6 format if provided
    • Latitude and longitude must be valid geographic coordinates
    • All location fields are optional but must be valid if provided

Best Practices

  1. Billing Information

    • Always provide as much billing information as available
    • Ensure country codes are uppercase
    • Validate addresses when possible
  2. Metadata Usage

    • Use consistent key naming conventions
    • Keep values concise and meaningful
    • Don't store sensitive information in metadata
  3. Device Information

    • Always send user agent when available
    • Include mobile/crawler flags for better tracking
    • Keep device information current
  4. Location Data

    • Respect privacy laws when collecting location data
    • Validate IP addresses before sending
    • Use standardized formats for geographic coordinates
Docs and examples licensed under MIT