palbaseDocs

Palbase Payments · API

POST/payments/intents/{intent_id}/confirm

Confirm payment intent

Creates a new PaymentAttempt for the PaymentIntent (saved card, Masterpass OTP, Stripe Elements, or hosted/embedded 3DS form) and returns the canonical NextAction. A card is charged once for a payment. One confirmation of a payment runs at a time (409 payment_busy to one that waited too long). Before a saved card is charged, every other attempt of the payment that could still take money is closed at the provider — a hosted page left open is expired, one whose buyer's card was declined on it too — and one found paid is the payment: its view is answered and no card is charged. When the provider does not say whether a card was charged, the answer is 503 payment_outcome_unknown and the payment reads processing: confirming again asks the provider first and charges nothing twice; left alone, the payment is settled paid or failed within minutes. A saved card that was removed on the provider's own pages is declined method_gone and listed no more. When the customer's record itself was deleted on the provider's pages, it is let go of here with the cards that went with it, and the answer is 409 provider_customer_gone (method_gone when a saved card was named): confirming again makes a new record. An answer is kept with its Idempotency-Key, a decline too: confirm under a new key to try again. One page per payment: the same confirmation sent again (the same terms) is answered with the hosted page that is open, and no new one is opened; other terms close the open page at its provider first and open another. A provider that cannot close its page (iyzico) is asked of it first instead: found paid, it is the payment; unpaid, it stays open there, and money taken on it after its payment was paid another way, canceled or expired is given back (payments.payment.charge_returned). A charge whose provider did not say how it stands is answered 503 payment_outcome_unknown (with intent_id): confirming again asks the provider first and charges nothing twice. A refusal's error_description is the provider's sentence for a card's own decline, and the module's own sentence for every other refusal.

Called by your app, with the publishable key; or a signed-in user of your app, with their token and the publishable key; or your server, with the project's secret key.

Path

intent_idstring · requiredPaymentIntent UUID.

Headers

Idempotency-Keystring · optionalUnique client-supplied idempotency key (1-255 chars) ensuring safe retries without duplicate charges, refunds, or ledger movements.

Request body

buyerobject · optionalCustomer billing/shipping details sealed at rest.
client_secretstring · optionalIntent client_secret (required for guest/publishable-key callers).
installmentsobject · optionalInstallment configuration for an intent.
method_idstring · optionalSaved payment method UUID for one-click payment.
off_sessionboolean · optionalCharge the saved card named by `method_id` with its holder away (secret key only; a Stripe channel — `off_session_unsupported` elsewhere). The card is charged with no step of the holder's, whatever the project's 3-D Secure threshold; a bank that asks the holder to authenticate declines the payment (`authentication_required`) instead of leaving it waiting.
phonestring · optionalPhone number for Masterpass OTP lookup.
provider_optionsobject · optionalOptional typed provider-specific escape-hatch parameters.
save_methodboolean · optionalKeep the card for the customer once the payment succeeds. The payment's `method_save` says what became of it.
use_masterpassboolean · optionalStart a Masterpass OTP payment attempt.
curl
curl -X POST "https://<your-ref>.palbase.studio/payments/intents/<intent_id>/confirm" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"buyer":{"billing_address":{"city":"string","contact_name":"string","country":"string","line1":"string","line2":"string","postal_code":"string","state":"string"},"email":"string","id":"string","ip":"string","name":"string","phone":"string","shipping_address":{"city":"string","contact_name":"string","country":"string","line1":"string","line2":"string","postal_code":"string","state":"string"},"surname":"string","tax_id":"string","tax_id_type":"string","tax_id_status":"string","validate_tax_location":false},"client_secret":"string","installments":{"allowed":[0],"count":0,"enabled":false,"max":0},"method_id":"string","off_session":false,"phone":"string","provider_options":{"iyzico":{"force_three_ds":false,"locale":"string","payment_group":"string"},"stripe":{"managed_payments":false,"tax_behavior":"inclusive","tax_code":"string"}},"save_method":false,"use_masterpass":false}'

Responses

200OK

defaultStandard Palbase JSON error envelope (`error` and `error_description`).

Operation ConfirmIntent of payments's contract.