Skip to main content
Direct API lets your checkout collect card details and send them from your server to ecomm. Every new Direct Payment goes through server-side authentication. Your integration handles the initial request, a browser action only when the Payment requires one, and retrieval of the authoritative result.
Raw card number, expiry, and CVC enter your systems on this path. Use Direct API only from an approved PCI-compliant card-data environment. Never log or persist the request body.

Prerequisites

  • Complete Authentication.
  • Use only test card data in Sandbox; never a real card.
  • Collect the shopper’s literal IP address and an HTTPS return_url.
  • Resolve the shopper to a stable opaque merchant_customer_id.

Card expiry input

For ordinary cards and decrypted Apple Pay or Google Pay, send exp_month as an integer from 1 through 12 and exp_year as a numeric integer from 2000 through 2099. Send the full year, such as 2028; a short year such as 28 is rejected and is never expanded to a century. Numeric 2028.0 and 2028e0 represent the same integer; strings, fractions, and null are invalid. An out-of-range year returns 400 parameter_invalid before a Payment is registered or sent to the processor. Correct the value using the card or prepared wallet credential, then retry using the request-error guidance. This range check does not decide whether the card has expired; downstream payment systems may still reject it. The rule applies in Sandbox and Live.

Updating integrations that sent short years

Previously, numeric years below 2000 could pass request validation. They now fail with the branch-specific param described in Errors. Update ordinary card input to use the full year. For wallets, obtain the full year from the same prepared credential as the other card fields; do not guess a century or replace wallet expiry with a separate card-form value.

Wallet contract availability

Experimental: Apple Pay and Google Pay. Wallet support and this guidance are still being refined and are not final. The fields, validation, and supported wallet route described on this page can change. Confirm the supported route and provider setup with ecomm before enabling a new merchant. Ordinary type: card requests are not affected.
Apple Pay and Google Pay direct processing accepts the decrypted wallet inputs described below. For the source token semantics, see Apple’s payment token format reference and Google’s payment-data cryptography guide. The gateway forwards prepared wallet credentials to the PCI-scoped provider route; upstream wallet setup, decryption, and verification remain outside this public API. Encrypted wallet input is reserved for a later release and is rejected in this contract. Do not send real wallet credentials to test syntax or availability. Ordinary card processing remains available as described below. Wallet payments can be rejected by the existing antifraud checks before they are submitted to the processor. In that case the Payment is FAILED with failure_code: fraud_filter; no additional browser action is required. Handle this terminal result as described in Payment lifecycle. For Apple Pay and Google Pay CRYPTOGRAM_3DS, credential-based checks use the wallet’s stable token identity. Different wallet tokens for the same funding card have separate credential histories. Google Pay PAN_ONLY uses the same card identity as an ordinary card payment.

Wallet input reference

Use payment_method_data.type with exactly one matching apple_pay or google_pay object. type is the merchant-facing method and selects the wallet validation and provider execution path; it is not inferred from the card number or network. Each wallet object contains format and data. format: decrypted means that an enabled upstream wallet integration has already prepared the typed fields below. It does not mean that arbitrary card data is accepted, and it is not inferred from which fields happen to be present. Keep the same common request fields, authentication, and Idempotency-Key header as a card request. Ordinary type: card requests retain their existing card fields, including CVC, and do not gain a format field. For format: decrypted, wallet data.card requires number, exp_month, and exp_year; holder_name is optional. No wallet card accepts CVC. Google auth_method is required and case-sensitive: preserve the value from the prepared Google credential and send exactly PAN_ONLY or CRYPTOGRAM_3DS. It describes the credential variant, not the eventual 3DS result. Missing, null, or unknown values are invalid. Omitting a cryptogram never selects PAN_ONLY, and incomplete CRYPTOGRAM_3DS input is not processed as PAN_ONLY. cryptogram is required for Apple 3DSecure and Google CRYPTOGRAM_3DS. It is exactly 28 standard-Base64 characters from the prepared wallet credential, not a token you create from the card fields, not a private key, and not CVC. Submit it unchanged, without trimming or re-encoding it. ecomm may repeat an eligible provider call for the same payment order using the same credential; this does not authorize a new merchant payment attempt. Its presence supplies authentication context; it does not by itself make the Payment successful, and matching the input shape is not proof that the credential can authorize a payment. Only Apple 3DSecure and Google CRYPTOGRAM_3DS accept eci. Omit eci when the prepared credential does not supply it. When supplied, it must be exactly two decimal digits, such as "05"; preserve the value without normalization. ECI carries the network’s e-commerce authentication context to the provider and can affect authorization processing; it is not a success signal and must not be invented from auth_method, a redirect URL, or a Payment status. Do not trim, pad, default, or convert it to a number. Explicit null is invalid; empty and one-digit ECI values are invalid. These JSON fragments illustrate the three decrypted inputs. Add the common fields shown in the card request below. The card is synthetic test data and the Base64 value encodes a placeholder, not a usable wallet credential.
These are input examples only; the Base64 value is not a usable wallet credential. format: encrypted with an opaque data.token is reserved and rejected in this release. Do not mix encrypted and decrypted fields, add unknown properties, or send a provider vault reference, private key, Apple merchant ID, or Google merchant ID as a payment input. Supply the required customer_ip_address: the checkout payer’s literal IPv4 or IPv6 address, used for customer and risk context. Provider authentication can require a browser challenge. Follow the returned next_action to complete authentication.

1 Create a Payment

The card number illustrates payload shape only. It does not guarantee a successful, declined, or 3D Secure outcome. In Sandbox the outcome comes from the amount, not from the card: see Sandbox testing. amount, currency, payment_method_data, customer_ip_address, merchant_customer_id, and return_url are required. Billing details and the reconciliation reference are optional. Set currency to a supported payment currency for a new Direct Payment. A well-formed unsupported code returns 422 currency_not_supported with param: currency and creates no Payment. An amount below the highest payment fee of your agreement plus its rolling reserve returns 422 amount_below_minimum_fee with param: amount and creates no Payment. Reuse the exact merchant_customer_id for the same logical customer or recognized guest. It must be an opaque, non-PII value—not an email, phone, login, name, order/payment/attempt ID, or fresh per-payment UUID. Case and whitespace are significant; the allowed domain is 1–255 Unicode scalar values, nonblank, with no U+0000. See the complete request schema.

2 Inspect the create response

The API returns 201 Created with the current Payment state. Store its id before taking further action. Read safe card details from payment_method.card and the submitted method from payment_method.type; neither establishes payment success. Before launch, update response parsers that read the former top-level card. See Payment method and card details for the response change and handling of unknown methods. A card decline is a Payment result, not an HTTP request error. This response excerpt highlights the fields to inspect; the API reference shows full examples:

3 Complete a browser 3D Secure action when required

Server-side authentication is attempted for every new Direct Payment. A browser redirect is required only when the returned Payment has status: REQUIRES_ACTION and next_action.reason: three_d_secure.
  1. Redirect the browser to the exact opaque next_action.redirect_url.
  2. Retrieve the Payment while the browser action is in progress.
  3. If a later response supplies a different redirect URL, use the latest one.
  4. When the browser reaches return_url, retrieve the Payment again; do not treat the return itself as success.

4 Confirm the final status

Continue while the status is PENDING, REQUIRES_ACTION, or PROCESSING. Stop at SUCCEEDED, FAILED, or EXPIRED. Only SUCCEEDED authorizes order fulfilment.

Safe retries

ecomm makes bounded retries of eligible provider failures before returning. If preparation fails before authentication or wallet execution was sent, the Payment can end FAILED with processor_unavailable or processor_error; these technical failures are not proof of an issuer decline. A definitive processor credential refusal on preparation or the first authentication/wallet execution also ends the Direct Payment as FAILED / processor_unavailable. The same idempotency key replays that failure; contact support to resolve the processor configuration before attempting a new Payment. An earlier uncertain execution still requires reconciliation. Once execution may have reached the provider, ecomm reads the existing order to reconcile it. An unavailable read leaves the Payment nonterminal, not failed solely because of the outage. Store the returned ID and retrieve that Payment. These provider retries are bounded by the active request’s deadline. They do not extend the Payment’s lifetime or guarantee recovery from a provider outage. An unresolved Payment is not a reason to submit a replacement with a new key.
  • Persist the key and non-card fields, but never persist the raw card-data request body. Retry it only while the original body remains available inside your approved PCI handling boundary.
  • Card fields are excluded from Direct Payment idempotency. The same key and unchanged non-card fields replay the original Payment even if different card fields are supplied; they do not attempt the different card.
  • idempotency_key_in_use means wait briefly and retry with an equivalent effective request identity.
  • idempotency_key_reused means the key was paired with different non-card fields; resend the original request or use a new key for a genuinely new Payment.
  • A new card attempt always uses a new key.
  • A terminal failed Payment is never resubmitted. A customer retry creates a new Payment with a new key.
See Idempotency and Operation failures.

Next steps

Billing country

When billing_details.address is supplied, its country must be in the personal country list: 208 countries, including Russia (RU) and Belarus (BY). Iran (IR) and the other excluded countries return 400 parameter_invalid with param: billing_details.address.country before a new Payment is registered or sent to the processor. The generated Payments API reference lists every eligible code. See country eligibility for correction and retry behavior. Provider availability remains a separate requirement.