Skip to content

komoju/komoju-node-sdk

Repository files navigation

@komoju/komoju-sdk @1.0.0-beta.1

TypeScript/JavaScript client for the KOMOJU API, using axios.

Installation

npm install @komoju/komoju-sdk@1.0.0-beta.1

Getting Started

Get your API keys from the KOMOJU Merchant Settings.

TypeScript

import { Configuration, PaymentsApi, SessionsApi } from '@komoju/komoju-sdk';

const config = new Configuration();
config.setApiKey('YOUR_SECRET_KEY');

// Create a payment
const paymentsApi = new PaymentsApi(config);
const payment = await paymentsApi.createPayment({
  createPaymentRequest: {
    amount: 1000,
    currency: 'JPY',
    paymentDetails: {
      type: 'credit_card',
      number: '4111111111111111',
      month: 12,
      year: 2025,
      verificationValue: '123',
    },
  },
});
console.log('Payment created:', payment.data.id);

// Create a hosted payment page session
const sessionsApi = new SessionsApi(config);
const session = await sessionsApi.createSession({
  createSessionRequest: {
    amount: 5000,
    currency: 'JPY',
    returnUrl: 'https://example.com/thank-you',
    defaultLocale: 'ja',
  },
});
console.log('Redirect customer to:', session.data.sessionUrl);

JavaScript (CommonJS)

const { Configuration, PaymentsApi, SessionsApi } = require('@komoju/komoju-sdk');

const config = new Configuration();
config.setApiKey('YOUR_SECRET_KEY');

const paymentsApi = new PaymentsApi(config);

paymentsApi
  .createPayment({
    createPaymentRequest: {
      amount: 1000,
      currency: 'JPY',
      paymentDetails: {
        type: 'credit_card',
        number: '4111111111111111',
        month: 12,
        year: 2025,
        verificationValue: '123',
      },
    },
  })
  .then((payment) => console.log('Payment created:', payment.data.id))
  .catch((error) => console.error('Error:', error));

API Endpoints

All URIs are relative to https://komoju.com/api/v1

Class Method HTTP request Description
BarcodesApi showBarcode GET /barcodes/{payment_id} Barcode: Show
DisbursementsApi cancelDisbursement POST /disbursements/{id}/cancel Disbursement: Cancel
DisbursementsApi createDisbursement POST /disbursements Disbursement: Create
DisbursementsApi disbursementReport GET /disbursements/report Disbursement: Report
DisbursementsApi listDisbursements GET /disbursements Disbursement: List
DisbursementsApi showDisbursement GET /disbursements/{id} Disbursement: Show
EventsApi listEvents GET /events Event: List
EventsApi showEvent GET /events/{id} Event Show
OneClickApi deleteExternalCustomer DELETE /external_customers/{id} External Customer: Destroy
PaymentsApi cancelPayment POST /payments/{id}/cancel Payment: Cancel
PaymentsApi capturePayment POST /payments/{id}/capture Payment: Capture
PaymentsApi createPayment POST /payments Payment: Create
PaymentsApi createRefundRequest POST /payments/{id}/refund_request Payment: Refund Request
PaymentsApi finalizePayment POST /payments/{id}/finalize Payment: Finalize
PaymentsApi listPaymentMethods GET /payment_methods Payment Method: List
PaymentsApi listPayments GET /payments Payment: List
PaymentsApi refundPayment POST /payments/{id}/refund Payment: Refund
PaymentsApi showPayment GET /payments/{id} Payment: Show
PaymentsApi updatePayment PATCH /payments/{id} Payment: Update
PlatformModelApi balanceTransfer POST /balances/{currency}/transfer Balance: Transfer
PlatformModelApi createFile POST /merchants/{merchant_id}/files File: Create
PlatformModelApi createMerchant POST /merchants Merchant: Create
PlatformModelApi createMerchantBalanceTransfer POST /merchants/{merchant_id}/balances/{currency}/transfer Balance: Transfer
PlatformModelApi editMerchantBalanceSettings PATCH /merchants/{merchant_id}/balances/{currency}/settings Balances: Edit Settings
PlatformModelApi listLiveApplicationPaymentMethods GET /live_application/{merchant_id}/payment_methods Live Application: Payment Methods
PlatformModelApi listMerchants GET /merchants Merchant: List
PlatformModelApi listSubmerchantPayments GET /merchants/{merchant_id}/payments Payment: List for Merchant
PlatformModelApi listSubmerchantSettlements GET /merchants/{merchant_id}/settlements Settlement: List
PlatformModelApi merchantBalanceTransactions GET /merchants/{merchant_id}/balances/{currency}/transactions Balance: Transactions
PlatformModelApi showFile GET /merchants/{merchant_id}/files/{id} File: Show
PlatformModelApi showLiveApplication GET /live_application/{merchant_id} Live Application: Show
PlatformModelApi showLiveApplicationPaymentMethod GET /live_application/{merchant_id}/payment_methods/{payment_method} Live Application: Show Payment Method
PlatformModelApi showMerchant GET /merchants/{id} Merchant: Show
PlatformModelApi showMerchantBalance GET /merchants/{merchant_id}/balances/{currency} Balance: Show
PlatformModelApi showMerchantBalanceSettings GET /merchants/{merchant_id}/balances/{currency}/settings Balance: Show Settings
PlatformModelApi showMerchantBalanceTransaction GET /merchants/{merchant_id}/balances/{currency}/transactions/{transaction_uuid} Balance: Transaction
PlatformModelApi showSubmerchantSettlement GET /merchants/{merchant_id}/settlements/{id} Settlement: Show
PlatformModelApi simulateLiveApplicationPaymentMethodStatus PATCH /live_application/{merchant_id}/payment_methods/{payment_method}/simulate_status Live Application: Simulate Payment Method Status
PlatformModelApi simulateLiveApplicationStatus PATCH /live_application/{merchant_id}/simulate_status Live Application: Simulate Status
PlatformModelApi submerchantSettlementCSV GET /merchants/{merchant_id}/settlements/{id}/csv Settlement: CSV
PlatformModelApi submerchantSettlementPDF GET /merchants/{merchant_id}/settlements/{id}/pdf Settlement: PDF
PlatformModelApi submerchantSettlementXLS GET /merchants/{merchant_id}/settlements/{id}/xls Settlement: XLS
PlatformModelApi updateLiveApplication PATCH /live_application/{merchant_id} Live Application: Update
PlatformModelApi updateLiveApplicationPaymentMethod PATCH /live_application/{merchant_id}/payment_methods/{payment_method} Live Application: Update Payment Method
PlatformModelApi updateMerchant PATCH /merchants/{id} Merchant: Update
SecureTokensApi createSecureToken POST /secure_tokens SecureToken: Create
SecureTokensApi showSecureToken GET /secure_tokens/{id} SecureToken: Show
SessionsApi cancelSession POST /sessions/{id}/cancel Session: Cancel
SessionsApi createSession POST /sessions Session: Create
SessionsApi paySession POST /sessions/{id}/pay Session: Pay
SessionsApi showSession GET /sessions/{id} Session: Show
SettlementsApi listSettlements GET /settlements Settlement: Index
SettlementsApi showSettlement GET /settlements/{id} Settlement: Show
SettlementsApi showSettlementCSV GET /settlements/{id}/csv Settlement: CSV
SettlementsApi showSettlementPDF GET /settlements/{id}/pdf Settlement: PDF
SettlementsApi showSettlementXLS GET /settlements/{id}/xls Settlement: XLS
SettlementsApi showTransaction GET /balances/{currency}/transactions/{transaction_uuid} Balance: Transaction
SubscriptionsApi createCustomer POST /customers Customer: Create
SubscriptionsApi createSubscription POST /subscriptions Subscription: Create
SubscriptionsApi deleteCustomer DELETE /customers/{id} Customer: Destroy
SubscriptionsApi deleteSubscription DELETE /subscriptions/{id} Subscription: Destroy
SubscriptionsApi listCustomers GET /customers Customer: List
SubscriptionsApi listSubscriptions GET /subscriptions Subscription: List
SubscriptionsApi showCustomer GET /customers/{id} Customer: Show
SubscriptionsApi showSubscription GET /subscriptions/{id} Subscription: Show
SubscriptionsApi updateCustomer PATCH /customers/{id} Customer: Update
TokensApi createToken POST /tokens Token: Create

Models

Authorization

KOMOJU uses HTTP Basic Auth. Use config.setApiKey('your_key') to authenticate — this sets the API key as the HTTP Basic username with an empty password.

Building from Source

npm install
npm run build

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors