Payment Intent

نية الدفع

GLS-000140

Intermediatepayments1 min read
paymentintentstripe payment intentpayment flowconfirm payment

Definition

Stripe's object that tracks the lifecycle of a payment — from initiated to completed or failed.

كائن Stripe الذي يتتبع دورة حياة الدفع — من البدء إلى الاكتمال أو الفشل.

Why It Matters

Every payment in a 404Fault project (food delivery, booking, marketplace) flows through a PaymentIntent. Understanding it is required to build any paid feature.

كل دفع في مشروع 404Fault (توصيل طعام وحجز وسوق) يمر عبر PaymentIntent. فهمه مطلوب لبناء أي ميزة مدفوعة.

Full Definition

A PaymentIntent is the Stripe API object at the center of every payment. You create it on the server with the amount and currency, then pass its client_secret to the frontend. The customer completes payment using Stripe's UI (Card Element, Payment Element), and Stripe updates the PaymentIntent status. This server-first approach prevents payment tampering from the client side.
PaymentIntent هو كائن Stripe API في مركز كل دفع. تُنشئه على الخادم بالمبلغ والعملة، ثم تمرّر client_secret إلى الواجهة الأمامية. يُكمل العميل الدفع باستخدام واجهة Stripe (Card Element وPayment Element)، وStripe يُحدِّث حالة PaymentIntent. يمنع هذا النهج المعتمد على الخادم أولًا التلاعب بالدفع من جانب العميل.

Example Usage

Server creates PaymentIntent (amount: 5000, currency: 'usd'), returns client_secret. Client uses stripe.confirmPayment(client_secret) to complete the charge.

الخادم يُنشئ PaymentIntent (amount: 5000, currency: 'usd')، يُعيد client_secret. العميل يستخدم stripe.confirmPayment(client_secret) لإتمام التحصيل.

Knowledge Graph

Avoid these mistakes when using Payment Intent:

1

Creating PaymentIntent on the client side (amount can be tampered)

2

Not listening to payment_intent.succeeded webhook (payment can succeed after the user closes the page)

Sign in to unlock guided AI explanations from AI Teacher.

Generate a Prompt

Copy this prompt and use it directly with any AI model — no setup needed.

Ready-to-Use Prompt
Help me build a project using Payment Intent.

Explain:
1. What is Payment Intent and why it matters
2. The core architecture and required tools
3. Step-by-step implementation plan
4. Common mistakes to avoid: Creating PaymentIntent on the client side (amount can be tampered), Not listening to payment_intent.succeeded webhook (payment can succeed after the user closes the page)
5. Best practices and production tips

Official Resources