Skip to Content
Docs

PayCore

Reference for the iOS SDK's payment results, errors, environments, and the other types every module shares.

PayCore holds the types every other module shares. PayCheckout doesn't re-export them. To name these types, link the PayCore product and import PayCore.

PayResult

PayResult reflects only the client-side state of a payment. pay, payWithApplePay, and the drop-in return it.

CaseDescription
.succeeded(PaymentIDs)Paid, or authorized for a session created with capture: false. In a setup session, the payment method was saved, or a saved one became the customer's default. For a tokenization session's token, transaction is the token's ID and status is "tokenized".
.processing(PaymentIDs)The device couldn't see a final outcome (an asynchronous method is still pending, the payment waits on a partial approval (requires_partial_approval_action), the status check reached its deadline, or the session's token was retired before the result could be read). Your server decides.
.canceledThe customer closed the 3DS, redirect, or Apple Pay screen, or the drop-in, and no payment was seen.
.failed(PayError)The payment attempt failed.

For how pay reaches each result, see Pay.

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, use Retrieve a setup session or the setup_session.completed webhook.

PaymentIDs

Identifiers of a payment, for your server to verify.

PropertyTypeDescription
sessionIDStringThe session's ID.
transactionString?The charge (chrg_…) or hold (hld_…) ID, when the API returned one.
customerString?The customer ID (cust_…), when known.
paymentMethodString?The payment method ID, when known. For a saved method in a setup session, the saved method's ID.
statusString?The raw status the API reported, for example succeeded, requires_capture, or pending.

PayError

Everything that can go wrong in the SDK. A call throws a PayError when it couldn't start, and a payment that fails after a request left the device returns .failed(PayError). Each method's page lists what it throws. PayError conforms to LocalizedError. Its descriptions are in English and not meant to be shown to customers as they are.

CaseWhen
invalidClientSecretThe client_secret is malformed. Start a checkout gives the rule.
invalidCardInput([PayCardFieldKind])The card fields are incomplete or invalid. Nothing was sent. PayCardFieldKind is .number, .expiry, .cvc, or .name.
paymentInProgressA payment or a removal was started while another one was running on the same checkout, or a drop-in that's already showing was presented again. Nothing was sent.
sessionExpiredThe API returned HTTP 401. The session expired, or Pay.com rejected the client_secret.
sessionAlreadyCompleted(status:)The session was already paid, or has no attempts left.
amountChanged(amount:currency:)The session's total changed, so this payment wasn't charged. amount and currency are the new ones, and checkout.session has them too. Show them, then let the customer pay again. See When the amount changes.
declined(PayDecline)The payment was declined.
paymentEnded(status:)The payment ended without being paid. status is the status the API reported, in lower case, for example expired, canceled, failed, or error.
requestRejected(PayAPIError)The API returned any other status below 500 that isn't a success or a decline.
server(PayAPIError)The API failed with a 5xx, or timed out (HTTP 408).
network(String)The request didn't reach the API, or the response didn't arrive. A 3DS challenge or a redirect that couldn't open ends with it too.
unexpectedResponse(String)The API returned a response this SDK version can't read.
unsupported(String)The flow needs something this SDK can't do or doesn't fit the session, for example Apple Pay in a session that can't take it, a saved method this session didn't list, or a drop-in with nothing to show. Inspect the associated message for the reason.
encryptionUnavailable(String)Client-side encryption is on but the card couldn't be encrypted. The SDK never falls back to sending raw card fields. Nothing was sent.

PayDecline

declined(PayDecline) carries a PayDecline.

PropertyTypeDescription
codeString?The API code, usually card_declined.
declineCodeString?The issuer or processor decline code, when the API sends one.
messageStringThe API's message. Not localized.
maxAttemptsReachedBooltrue when this was the session's last attempt. The session can't be paid again, and your server needs a new session.
transactionString?The charge or hold ID of the declined attempt, when known.

PayAPIError

requestRejected and server carry a PayAPIError.

PropertyTypeDescription
httpStatusIntThe HTTP status of the response.
typeString?The error category, for example invalid_request_error.
codeString?A machine-readable code, for example transaction_in_flight or source_not_usable.
messageStringA human-readable message. It isn't localized, so don't show it to customers as it is.
declineCodeString?A finer reason, for example cse_expired for a refused encrypted card.

PayEnvironment

The Pay.com environment the SDK connects to, set in the checkout's configuration. Use .production, the default, for both live and sandbox sessions.

Other environments use .development or .custom(apiBaseURL:scaBaseURL:).

PropertyTypeFor .production
apiBaseURLURLhttps://js.pay.com/api, where the SDK's API calls go.
scaBaseURLURLhttps://sca.pay.com, which serves the 3DS challenge page.
cseKeysURLURL?https://js.pay.com/cse/keys, where the checkout fetches its encryption keys when clientSideEncryption is on.

ClientSecret

A session's client_secret, which the SDK treats as opaque and never logs. Printing a ClientSecret, or reflecting it, shows a redacted placeholder. PayCheckout takes the secret as a String and checks it with ClientSecret, so you don't need to create one. ClientSecret(_:) throws invalidClientSecret by the same rule.

PaySDK

PaySDK reports the SDK's version and the API version it was built against.

PropertyValueDescription
PaySDK.version"0.1.0"The SDK's semantic version.
PaySDK.apiVersion"2026-11-19"The client API version the SDK was built against. It's sent with every request.
Was this page helpful?