← トップに戻る
USE CASE 1 · EC・物販

🛍️ Demo Shop - ECサイトデモ

商品をカートに入れ、決済方法を選んで購入するフルカスタムECサイト。
導入パターン: Client SDK + Server API(フルカスタム)

商品一覧

🛒 カート

カートは空です

Visa / Mastercard / JCB / PayPay / 楽天ペイ / Apple Pay 他

⚙️ サーバー側コード例(Charge作成)

商品合計と注文情報を渡してChargeを作成。resource: "web" は必須。

// Node.js (Express)
const response = await axios.post('https://api.elepay.io/charges', {
  amount: cartTotal,           // 例: 12980
  currency: 'JPY',
  resource: 'web',             // 必須: web/ios/android/liff/mini/cpm/mpm/reader/posapp
  orderNo: 'EC_' + Date.now(),  // 一意なID(最大20桁)
  description: '商品購入',
  extra: { frontUrl: 'https://shop.example.com/callback' }
}, {
  auth: { username: 'sk_test_xxx', password: '' }
});

// chargeObject をクライアントへ返す → elepay.handleCharge() に渡す
res.json(response.data);