Sessions and transactions
Understand the difference between SDK-driven sessions and API-driven transactions in Pay.com.
Pay.com separates sessions (checkout interactions that Pay.com.js runs) from transactions (the payment objects that move money). The two show up separately in the dashboard's activity views and in the webhooks you receive.
Sessions
A session represents a customer's checkout interaction managed by Pay.com.js. When you embed Pay.com.js on your frontend, every customer interaction goes through a session. There are three types:
| Session type | Purpose | Endpoint |
|---|---|---|
| Payment session | Collect a payment from the customer | POST /v1/sessions/payment |
| Setup session | Verify and save a payment method without charging | POST /v1/sessions/setup |
| Tokenization session | Collect card details and turn them into a card token (tok_card_), without charging | POST /v1/sessions/tokenization |
Your server creates a session via the API and receives a client_secret. You pass the
client_secret to Pay.com.js on your frontend, and Pay.com.js renders the checkout UI,
handles payment method collection, manages 3D Secure challenges, and processes the payment. On
success, a payment session creates an underlying transaction: a charge or a hold.
To update a session after creation, use PATCH /v1/sessions/payment/{id}. When updating
amount, you must include currency in the same request body. Omitting currency returns a
400 error. Use GET /v1/sessions/payment/{id} to check the session status, linked charge,
and amount. This endpoint doesn't return client_secret.
Sessions support multiple payment attempts. If a customer's first attempt fails (wrong
card, insufficient funds, and so on), the session stays open and the customer can try again
with a different payment method. Each failed attempt is recorded as a payment attempt object,
but no charge is created until a payment succeeds.
| Status | Meaning |
|---|---|
open | The session is active. The customer can still attempt to pay. |
completed | Payment succeeded. The session contains a reference to the created charge or hold. |
completed_partially | The payment was approved for less than the requested amount. |
requires_partial_approval_action | A server-to-server partial approval is waiting for you to confirm or cancel it. See handle partial approvals. |
failed | The session reached max_attempts (default 5) declined attempts, or its duration elapsed without a successful payment. |
- Session created
- Payment attempt 1
- Charge or hold created, Succeeded
- Session completed
- Payment attempt 2, Declined
- Charge or hold created, Succeeded
- Session completed
- More attempts, up to max_attempts, Declined
- failed, Attempts used up or session expired
In this example, the dashboard shows one completed session, one failed payment attempt, and one successful charge.
For step-by-step instructions on taking a payment with Pay.com.js, see Universal checkout and Headless checkout.
Transactions
Transactions are the actual payment objects that move money. They exist whether you use Pay.com.js or the API:
| Transaction type | What it represents | Created by |
|---|---|---|
| Charge | A payment that captures funds | SDK session (on success) or direct API call |
| Hold | An authorization that reserves funds | SDK session with capture: false or direct API call |
| Refund | A return of funds from a charge | API call or dashboard action |
| Payout | A transfer of funds to a customer | API call or dashboard action |
When you work directly with the Pay.com API (server-to-server), there are no sessions involved.
You create transactions directly via endpoints like POST /v1/charges or POST /v1/holds. In
this flow, both successful and failed transactions appear as charge or hold objects in your
activity log. There's no session wrapper, and there are no payment attempt objects.
For step-by-step instructions on creating a charge via the API, see the Create a charge guide.
Side-by-side comparison
A declined payment ends differently on each path. In a session, the attempt is recorded and the session stays open. With the API, the charge or hold itself fails.
- Session created
- Payment attempted
- Charge or hold created, Succeeded
- Session completed
- Attempt recorded, session stays open, Declined
| Aspect | SDK path (sessions) | API path (direct) |
|---|---|---|
| Failed payments | Recorded as payment attempts. No charge is created. | Recorded as failed charges or holds |
| Multiple retries | Handled automatically within the session | You manage retry logic yourself |
| 3D Secure | Managed by Pay.com.js automatically | You handle the authentication flow via linked authentication sessions |
| PCI requirements | SAQ-A (Universal checkout) or SAQ-A-EP (Headless checkout, tokenization) | Full PCI DSS (SAQ-D) only if sending raw card details |
| Dashboard view | Sessions and Transactions tabs | Transactions tab only |
| Customer experience | Pay.com manages the UI, error handling, and retries | You build and control the entire experience |
Dashboard activity
When you open the Activity tab in the Pay.com dashboard, you'll see two sub-tabs for merchants using Pay.com.js: Sessions (showing all payment sessions and setup sessions with their statuses) and Transactions (showing all charges, holds, refunds, and payouts). For API-only merchants, only the Transactions tab is visible, since there are no sessions.
Combining SDK and API
You aren't limited to one integration path. Many merchants use both. For example, they use Pay.com.js for the first payment, to collect card details securely and create a stored payment method, then the API with that stored payment method for later or recurring payments.
Both paths share the same token vault, payment methods, and settlement accounts. A payment method created through Pay.com.js can be used in API calls, and the other way around. For more on recurring payment flows, see save a payment method and create recurring charges.