Skip to Content
Docs

Checkout and core types (pay-core)

Reference for PayCheckout's members and the types every module shares, from the session and its payment methods to results and errors.

pay-core is plain Kotlin/JVM. It holds PayCheckout and the types every other module shares, in these packages:

PackageTypes
com.pay.sdk.corePayCheckout, PaySession, PayPaymentMethod, PaySavedPaymentMethod, PayPaymentRequest, PayResult, PaymentIds, PayError, PayApiError, PayDecline, PayCardField, PayEnvironment, PaySdk, ClientSecret
com.pay.sdk.core.cardPayCardBrand, PayFieldStatus, PayCardFieldsState, CardValidation

PayCheckout

PayCheckout is the checkout for one session. PayCheckout.create() creates one.

MemberDescription
sessionThe session, as a PaySession.
configurationThe PayCheckout.Configuration the checkout was created with. See PayCheckout.Configuration.
PayCheckout.create()Checks a client_secret, loads the session, and returns its checkout.
paymentMethods(), acceptedCardBrandsThe payment methods and card brands the session accepts.
pay()Pays, showing 3DS and redirects over an activity. An extension from pay-threeds.
refreshSession()Reads the amount and currency again, after your server changed them.
PayCheckout.handleReturn()Passes a URL your app was opened with to the payment waiting for it.
savedPaymentMethods()The customer's saved methods this session can use.
requiresCvc()Whether paying with a saved card needs its CVV.
removeSavedPaymentMethod()Deletes one of the customer's saved methods.
payWithGooglePay()Pays with Google Pay. An extension from pay-googlepay.
supportsGooglePay, googlePayIsReadyToPayRequest(), googlePayPaymentDataRequest()Whether the session takes Google Pay, and its Google Pay requests as JSON.

PaySession

checkout.session describes the session the checkout is for, with the amount and currency the SDK last read.

PropertyTypeDescription
idStringThe session's ID.
kindPaySession.KindSALE (charge now), AUTHORIZATION (authorize now, capture later from your server), SETUP (save a payment method without paying), or UNKNOWN, a flow this SDK doesn't recognize. An UNKNOWN session may charge, so its total is checked as a sale's is.
amountString?The amount as the client API sends it, a decimal string in major units, for example "10.00". This differs from the minor units you send when you create the session.
currencyString?The currency code.
isLiveBooleanWhether the session is live.
expiresAtEpochSecondsLong?When the client_secret stops working, in epoch seconds.
setupFutureUsageString?The session's setup_future_usage, on_session or off_session, when it's set.
isRecurringBooleantrue for a recurring session, whose card is always kept for later charges.
isPayoutBooleantrue for a payout setup session, created with payout: true, where the customer picks the method they get paid to. See Let customers choose a payout method.

PayPaymentMethod

A payment method the session accepts, from checkout.paymentMethods().

PropertyTypeDescription
typeStringThe API's payment method type, for example card, googlepay, or paypal.
kindPayPaymentMethod.KindCARD for card, WALLET for googlepay and applepay, and ALTERNATIVE for every other type.

PaySavedPaymentMethod

A method saved for the customer, from checkout.savedPaymentMethods(). Only the SDK makes them, and its vault token stays inside the SDK.

PropertyTypeDescription
idStringThe saved method's ID.
typeStringIts payment method type, for example card, paypal, or cashapp.
isDefaultBooleantrue for the customer's default method.
cardPaySavedPaymentMethod.Card?A card's details (brand, last4, expiryMonth, expiryYear, and issuerName, the issuing bank's name when Pay.com has it). Each is a String?. Set a PayCvcController's brand to its brand.
bankAccountPaySavedPaymentMethod.BankAccount?A bank account's details (bankName, last4, country, and currency). Each is a String?.
emailString?The account's email, for example a PayPal account's.
detailsMap<String, String>The method's details, with the API's keys (snake_case).

PayPaymentRequest

What to pay with, passed to checkout.pay(). That page describes each request.

RequestPays with
PayPaymentRequest.Card(source, saveForFutureUse, termsAccepted)The card in the SDK's card fields.
PayPaymentRequest.Alternative(type, data)A redirect payment method.
PayPaymentRequest.SavedPaymentMethod(method, cvc)A saved method, charged in a sale or authorization session, or made the customer's default in a setup session. cvc is a CvcSource, such as a PayCvcController.
PayPaymentRequest.GooglePay(paymentData, termsAccepted)A Google Pay token.

PayResult

PayResult reflects only the client-side state of a payment. checkout.pay(), checkout.payWithGooglePay(), and dropIn.present() return it, and each method's page documents when it returns each result.

ResultDescription
PayResult.Succeeded(ids)Paid, or authorized for a session created with capture: false.
PayResult.Processing(ids)The SDK didn't receive a final outcome. Your server decides.
PayResult.CanceledThe customer closed a required payment screen and no payment was seen.
PayResult.Failed(error)The payment failed with a PayError.

PayResult is a hint for your UI. Fulfill an order only after your server retrieves the session with Retrieve a payment session or receives the signed payment_session.completed webhook. For a setup session, it uses Retrieve a setup session or the setup_session.completed webhook.

PaymentIds

The IDs in Succeeded and Processing, for your server to look the payment up.

PropertyTypeDescription
sessionIdStringThe session's ID.
transactionString?The charge (chrg_…) or hold (hld_…) ID, when the API returned one.
customerString?The Pay.com customer ID, when the API returned one.
paymentMethodString?The payment method's ID, when the API returned one.
statusString?The raw status the API reported, for example succeeded.

PayError

PayError is a sealed Exception. PayCheckout.create(), refreshSession(), and removeSavedPaymentMethod() throw it. Payment methods such as pay() throw it only when a call fails before sending a request, and PayResult.Failed carries every failure after that. Each method's page lists the cases it produces and when.

CaseCarriesWhat it means
InvalidClientSecretThe client_secret is malformed.
InvalidCardInputfields: List<PayCardField>The card fields, or a saved card's CVV, are incomplete or invalid. PayCardField is NUMBER, EXPIRY, CVC, or NAME.
PaymentInProgressAnother payment or removal is running on the checkout.
SessionExpiredPay.com returned HTTP 401. The session expired, or Pay.com doesn't accept the client_secret.
SessionAlreadyCompletedstatus: StringPay.com returned HTTP 400 for an existing payment or setup attempt. The session was already paid, or it has no attempts left.
AmountChangedamount: String?, currency: String?The session's total changed, so this payment wasn't charged. These are the new amount and currency, and checkout.session has them too. Show them, then let the customer pay again. See When the amount changes.
Declineddecline: PayDeclineThe payment was declined.
PaymentEndedstatus: StringThe payment ended without being paid, with this status.
RequestRejectederror: PayApiErrorPay.com returned another status below 500 that isn't a success or a decline.
Servererror: PayApiErrorPay.com returned a 5xx status, or 408.
Networkdetail: StringA request didn't reach Pay.com, or its response didn't arrive.
UnexpectedResponsedetail: StringPay.com returned a response this SDK version doesn't understand.
Unsupporteddetail: StringThe call needs something the session or this SDK can't do.
EncryptionUnavailabledetail: StringClient-side encryption is on, and the card or a saved card's CVV couldn't be encrypted, for example with no usable key or no merchant ID on the session. The SDK never falls back to sending them unencrypted.

PayDecline

Declined carries a PayDecline:

PropertyTypeDescription
codeString?The error code, for example card_declined.
declineCodeString?The issuer's or processor's reason, when it was sent.
detailStringThe API's message, not localized.
maxAttemptsReachedBooleantrue when this was the session's last attempt. Your server needs a new session.
transactionString?The declined charge or hold ID, when it's known.

PayApiError

RequestRejected and Server carry a PayApiError:

PropertyTypeDescription
httpStatusIntThe HTTP status Pay.com returned.
typeString?The error's type.
codeString?The error's code.
detailStringThe API's message. It isn't localized, so don't show it to customers as is.
declineCodeString?A finer reason, for example cse_expired for a refused encrypted card.

PayEnvironment

The Pay.com environment the SDK connects to, in PayCheckout.Configuration.

EnvironmentDescription
PayEnvironment.ProductionThe default, for live and sandbox sessions alike.
PayEnvironment.Development, PayEnvironment.Custom(apiBaseUrl, scaBaseUrl)Other deployments.

Each one has apiBaseUrl, the client API's address, scaBaseUrl, the 3DS challenge's, and cseKeysUrl, the PayCSE key endpoint on the API's host.

Other types

pay-core also holds these types:

TypeDescription
PaySdk.VERSIONThe SDK's version, "0.1.0".
PaySdk.API_VERSION"2026-11-19", the client API version the SDK was built against.
ClientSecretA client_secret that prints as ClientSecret(<redacted>). ClientSecret.of(raw) checks it as PayCheckout.create() does. Apps don't need it, because create takes the string.
PayCardBrand, PayFieldStatus, PayCardFieldsStateThe card fields' state, in com.pay.sdk.core.card. See Card state.
CardValidationThe validation rules behind that state (brand detection, the Luhn check, formatting, and each field's status). See How the fields validate.
Was this page helpful?