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:
| Package | Types |
|---|---|
com.pay.sdk.core | PayCheckout, PaySession, PayPaymentMethod, PaySavedPaymentMethod, PayPaymentRequest, PayResult, PaymentIds, PayError, PayApiError, PayDecline, PayCardField, PayEnvironment, PaySdk, ClientSecret |
com.pay.sdk.core.card | PayCardBrand, PayFieldStatus, PayCardFieldsState, CardValidation |
PayCheckout
PayCheckout is the checkout for one session. PayCheckout.create() creates one.
| Member | Description |
|---|---|
session | The session, as a PaySession. |
configuration | The PayCheckout.Configuration the checkout was created with. See PayCheckout.Configuration. |
PayCheckout.create() | Checks a client_secret, loads the session, and returns its checkout. |
paymentMethods(), acceptedCardBrands | The 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.
| Property | Type | Description |
|---|---|---|
id | String | The session's ID. |
kind | PaySession.Kind | SALE (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. |
amount | String? | 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. |
currency | String? | The currency code. |
isLive | Boolean | Whether the session is live. |
expiresAtEpochSeconds | Long? | When the client_secret stops working, in epoch seconds. |
setupFutureUsage | String? | The session's setup_future_usage, on_session or off_session, when it's set. |
isRecurring | Boolean | true for a recurring session, whose card is always kept for later charges. |
isPayout | Boolean | true 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().
| Property | Type | Description |
|---|---|---|
type | String | The API's payment method type, for example card, googlepay, or paypal. |
kind | PayPaymentMethod.Kind | CARD 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.
| Property | Type | Description |
|---|---|---|
id | String | The saved method's ID. |
type | String | Its payment method type, for example card, paypal, or cashapp. |
isDefault | Boolean | true for the customer's default method. |
card | PaySavedPaymentMethod.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. |
bankAccount | PaySavedPaymentMethod.BankAccount? | A bank account's details (bankName, last4, country, and currency). Each is a String?. |
email | String? | The account's email, for example a PayPal account's. |
details | Map<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.
| Request | Pays 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.
| Result | Description |
|---|---|
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.Canceled | The customer closed a required payment screen and no payment was seen. |
PayResult.Failed(error) | The payment failed with a PayError. |
PaymentIds
The IDs in Succeeded and Processing, for your server to look the payment up.
| Property | Type | Description |
|---|---|---|
sessionId | String | The session's ID. |
transaction | String? | The charge (chrg_…) or hold (hld_…) ID, when the API returned one. |
customer | String? | The Pay.com customer ID, when the API returned one. |
paymentMethod | String? | The payment method's ID, when the API returned one. |
status | String? | 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.
| Case | Carries | What it means |
|---|---|---|
InvalidClientSecret | The client_secret is malformed. | |
InvalidCardInput | fields: List<PayCardField> | The card fields, or a saved card's CVV, are incomplete or invalid. PayCardField is NUMBER, EXPIRY, CVC, or NAME. |
PaymentInProgress | Another payment or removal is running on the checkout. | |
SessionExpired | Pay.com returned HTTP 401. The session expired, or Pay.com doesn't accept the client_secret. | |
SessionAlreadyCompleted | status: String | Pay.com returned HTTP 400 for an existing payment or setup attempt. The session was already paid, or it has no attempts left. |
AmountChanged | amount: 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. |
Declined | decline: PayDecline | The payment was declined. |
PaymentEnded | status: String | The payment ended without being paid, with this status. |
RequestRejected | error: PayApiError | Pay.com returned another status below 500 that isn't a success or a decline. |
Server | error: PayApiError | Pay.com returned a 5xx status, or 408. |
Network | detail: String | A request didn't reach Pay.com, or its response didn't arrive. |
UnexpectedResponse | detail: String | Pay.com returned a response this SDK version doesn't understand. |
Unsupported | detail: String | The call needs something the session or this SDK can't do. |
EncryptionUnavailable | detail: String | Client-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:
| Property | Type | Description |
|---|---|---|
code | String? | The error code, for example card_declined. |
declineCode | String? | The issuer's or processor's reason, when it was sent. |
detail | String | The API's message, not localized. |
maxAttemptsReached | Boolean | true when this was the session's last attempt. Your server needs a new session. |
transaction | String? | The declined charge or hold ID, when it's known. |
PayApiError
RequestRejected and Server carry a PayApiError:
| Property | Type | Description |
|---|---|---|
httpStatus | Int | The HTTP status Pay.com returned. |
type | String? | The error's type. |
code | String? | The error's code. |
detail | String | The API's message. It isn't localized, so don't show it to customers as is. |
declineCode | String? | A finer reason, for example cse_expired for a refused encrypted card. |
PayEnvironment
The Pay.com environment the SDK connects to, in PayCheckout.Configuration.
| Environment | Description |
|---|---|
PayEnvironment.Production | The 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:
| Type | Description |
|---|---|
PaySdk.VERSION | The SDK's version, "0.1.0". |
PaySdk.API_VERSION | "2026-11-19", the client API version the SDK was built against. |
ClientSecret | A 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, PayCardFieldsState | The card fields' state, in com.pay.sdk.core.card. See Card state. |
CardValidation | The validation rules behind that state (brand detection, the Luhn check, formatting, and each field's status). See How the fields validate. |