Skip to content

Stripe

Online payment platform for developers

Stripe Products

Productคำอธิบายเหมาะสำหรับ
stripe.com faviconPaymentsระบบชำระเงินออนไลน์ธุรกิจทุกประเภท
stripe.com faviconBillingระบบจัดการสมาชิกและการสมัครสมาชิกSaaS, บริการสมาชิก
stripe.com faviconConnectแพลตฟอร์มสำหรับผู้ขายหลายรายตลาดซื้อขายสินค้า
stripe.com faviconTerminalระบบชำระเงินหน้าร้านร้านค้าปลีก
stripe.com faviconSigmaระบบรายงานขั้นสูงธุรกิจขนาดใหญ่
stripe.com faviconRadarระบบตรวจจับการฉ้อโกงธุรกิจทุกประเภท

Get Started

  1. รับ API Keys จาก Stripe Dashboard

    • เข้าสู่ระบบ dashboard.stripe.com faviconStripe Dashboard
    • ไปที่ "Developers" > "API Keys"
    • คัดลอก Publishable key และ Secret key
  2. ติดตั้งแพคเกจที่จำเป็น

bash
npm install stripe @stripe/stripe-js
bash
yarn add stripe @stripe/stripe-js
bash
pnpm add stripe @stripe/stripe-js
bash
bun add stripe @stripe/stripe-js
  1. ตั้งค่า API Keys
.env
env
STRIPE_PUBLIC_KEY=pk_test_51...
STRIPE_SECRET_KEY=sk_test_51...
  1. ตั้งค่า Stripe Client
tsx
import { loadStripe } from '@stripe/stripe-js';

const stripeClient = loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY);

function CheckoutButton() {
  const handleClick = async () => {
    const stripe = await stripeClient;
    await stripe.redirectToCheckout({
      lineItems: [{ price: 'price_123', quantity: 1 }],
      mode: 'payment'
    });
  };

  return <button onClick={handleClick}>Checkout</button>;
}
vue
<script setup lang="ts">
import { loadStripe } from '@stripe/stripe-js';

const stripeClient = loadStripe(import.meta.env.VITE_STRIPE_PUBLIC_KEY);

const handleCheckout = async () => {
  const stripe = await stripeClient;
  await stripe.redirectToCheckout({
    lineItems: [{ price: 'price_123', quantity: 1 }],
    mode: 'payment'
  });
};
</script>

<template>
  <button @click="handleCheckout">Checkout</button>
</template>
  1. ทดสอบการเชื่อมต่อ
terminal
bash
curl https://api.stripe.com/v1/charges -u sk_test_51...:
  1. เริ่มพัฒนา

ก่อนเริ่มพัฒนา ควรศึกษาเอกสาร API ให้เข้าใจ:

Developer Tools

CLI Commands

CommandDescription
npm install -g stripe-cliติดตั้ง Stripe CLI
stripe loginล็อกอินเข้าสู่ระบบ Stripe
stripe listen --forward-to localhost:3000/webhookฟอร์เวิร์ด webhook ไปยังเซิร์ฟเวอร์

API Commands

CommandDescription
stripe payment_intents createสร้าง Payment Intent
stripe checkout_sessions createสร้าง Checkout Session
stripe subscriptions createสร้าง Subscription
LinkDescription
dashboard.stripe.com faviconTest Modeหน้าจอทดสอบ Stripe
dashboard.stripe.com faviconAPI Logsดูประวัติการเรียกใช้ API
dashboard.stripe.com faviconWebhook Testerทดสอบ webhook

APIs

Payments

APIคำอธิบายการใช้งานทั่วไป
stripe.com faviconPaymentIntentsระบบจัดการการชำระเงินการชำระเงินออนไลน์
stripe.com faviconPaymentMethodsระบบจัดการวิธีการชำระเงินบันทึกบัตรเครดิต
stripe.com faviconChargesระบบจัดการการชำระเงินแบบครั้งเดียวสินค้าทั่วไป
stripe.com faviconCheckoutระบบชำระเงินแบบครบวงจรชำระเงินในหน้าเดียว
stripe.com faviconTerminalระบบชำระเงินหน้าร้านจุดขายหน้าร้าน

Subscriptions

APIคำอธิบายการใช้งานทั่วไป
stripe.com faviconCustomersระบบจัดการข้อมูลลูกค้าจัดการสมาชิก
stripe.com faviconSubscriptionsระบบจัดการสมาชิกบริการรายเดือน
stripe.com faviconInvoicesระบบจัดการใบแจ้งหนี้สร้างใบแจ้งหนี้

Products & Pricing

APIคำอธิบายการใช้งานทั่วไป
stripe.com faviconProductsระบบจัดการสินค้ารายการสินค้า
stripe.com faviconPricesระบบจัดการราคากำหนดราคาสินค้า

Management

APIคำอธิบายการใช้งานทั่วไป
stripe.com faviconRefundsระบบจัดการการคืนเงินคืนเงินให้ลูกค้า
stripe.com faviconDisputesระบบจัดการข้อพิพาทกรณีเรียกคืนเงิน
stripe.com faviconTaxระบบจัดการภาษีคำนวณภาษี

Last updated: