Skip to main content

Create Checkout Intent

Endpoint

POST /api/v1/transactions/checkout-intent

Authentication and required headers

HeaderRequiredExample
Content-TypeYesapplication/json
x-api-keyYescp_live_partner_xxx
x-clive-hmacYes40f3...
idempotency-keyYescheckout-EZ12345-v1

Request body

{
"partner_id": "ECHEZONA001",
"client_id": "AIRPEACE001",
"amount": 750,
"currency": "USD",
"email": "buyer@example.com",
"echezona_reference": "EZ12345",
"statement_descriptor_suffix": "AIRPEACE",
"meta": {
"order_id": "ORD-1001",
"cart_id": "CART-2002"
}
}

Field details

FieldTypeRequiredDescription
partner_idstringYesPartner identifier provisioned by Clive
client_idstringYesMerchant/client identifier under the partner
amountnumberYesPositive transaction amount in major currency units
currencystring(3)YesISO-4217 currency code (for USD use USD)
emailstringYesBuyer email used for Stripe receipt/payment context
echezona_referencestringYesPartner-generated immutable transaction reference
statement_descriptor_suffixstringNoOptional card statement suffix (1-22 chars, letters/numbers/space/-/_/.)
metaobjectNoOptional JSON object stored on the transaction and replayed in Clive partner webhooks

Success response

201 Created

{
"clive_tx_id": "CLVTX_1739378102312_420",
"status": "pending",
"stripe_payment_intent_id": "pi_3QxYFh2eZvKYlo2CxA8Nt42p",
"client_secret": "pi_3Qx..._secret_...",
"stripe_publishable_key": "pk_test_..."
}

Common errors

HTTPCodeMeaning
400VALIDATION_ERRORInvalid body shape/fields
400IDEMPOTENCY_KEY_MISSINGMissing idempotency key
401API_KEY_INVALIDInvalid API key
401HMAC_INVALIDSignature mismatch
403PARTNER_NOT_ACTIVEPartner not active
404CLIENT_NOT_FOUNDUnknown client
500STRIPE_KEY_MISSINGClive Stripe secret key missing
500STRIPE_PUBLISHABLE_MISSINGClive Stripe publishable key missing

cURL example

BODY='{"partner_id":"ECHEZONA001","client_id":"AIRPEACE001","amount":750,"currency":"USD","email":"buyer@example.com","echezona_reference":"EZ12345","statement_descriptor_suffix":"AIRPEACE","meta":{"order_id":"ORD-1001","cart_id":"CART-2002"}}'
SIG='replace-with-sha256-hmac'

curl -X POST "$CLIVE_API_BASE_URL/transactions/checkout-intent" \
-H "Content-Type: application/json" \
-H "x-api-key: $CLIVE_API_KEY" \
-H "x-clive-hmac: $SIG" \
-H "idempotency-key: checkout-EZ12345-v1" \
-d "$BODY"

Notes

  • This is the recommended endpoint for new partner integrations.
  • Clive internally initializes the transaction and links the created PaymentIntent.
  • Use returned client_secret to render/confirm Stripe Payment Element on frontend.

Frontend checkout page usage (Stripe Elements)

After your backend calls this endpoint, return these fields to the page:

  • client_secret
  • stripe_publishable_key
  • clive_tx_id

Then implement checkout page flow:

  1. loadStripe(stripe_publishable_key)
  2. Render <Elements options={{ clientSecret }}>
  3. Render <PaymentElement />
  4. On submit: call elements.submit()
  5. Confirm: stripe.confirmPayment({ elements, confirmParams: { return_url }, redirect: "if_required" })
  6. Reconcile transaction state using clive_tx_id

Minimal example:

const stripePromise = loadStripe(stripePublishableKey);

<Elements stripe={stripePromise} options={{ clientSecret }}>
<form
onSubmit={async (e) => {
e.preventDefault();
const submitResult = await elements.submit();
if (submitResult.error) return;

await stripe.confirmPayment({
elements,
confirmParams: { return_url: window.location.href },
redirect: "if_required"
});
}}
>
<PaymentElement />
<button type="submit">Pay now</button>
</form>
</Elements>