Skip to main content
The SinglePaymentRequest class contains the data required to initiate a single payment transaction using PayWithPayMaya.

Properties

totalAmount
TotalAmount
required
Transaction amount details including value, currency, and optional fee breakdown.
requestReferenceNumber
String
required
Reference number assigned by the merchant to identify a transaction.
redirectUrl
RedirectUrl
required
Set of redirect URLs upon process completion (success, failure, cancel).
metadata
JSONObject
Additional metadata about the payment transaction.

TotalAmount

Contains information about transaction amount.
value
BigDecimal
required
Payment amount to be charged.
currency
String
required
Currency code (e.g., “PHP”, “USD”).
details
AmountDetails
Breakdown of fees.

AmountDetails

Optional breakdown of fees.
discount
BigDecimal
Discount amount.
serviceCharge
BigDecimal
Service charge amount.
shippingFee
BigDecimal
Shipping fee amount.
tax
BigDecimal
Tax amount.
subtotal
BigDecimal
Subtotal amount.

RedirectUrl

Redirect URL model defining URLs used to redirect to specific pages once the payment process is done.
success
String
required
Success URL.
failure
String
required
Failure URL.
cancel
String
required
Cancel URL.

Example

val paymentRequest = SinglePaymentRequest(
    totalAmount = TotalAmount(
        value = BigDecimal("100.00"),
        currency = "PHP",
        details = AmountDetails(
            subtotal = BigDecimal("100.00")
        )
    ),
    requestReferenceNumber = "REF-123456",
    redirectUrl = RedirectUrl(
        success = "https://example.com/success",
        failure = "https://example.com/failure",
        cancel = "https://example.com/cancel"
    ),
    metadata = JSONObject().apply {
        put("orderId", "ORDER-123")
        put("customerId", "CUST-456")
    }
)

Build docs developers (and LLMs) love