Skip to content

SDK Quick Start

MPAC provides SDKs in three languages for integrating with the Payment Gateway.

Installation

bash
npm install @mpac/pgw-sdk
bash
go get github.com/mp-solution-inc/mpac-pgw/sdks/sdk-go
bash
pip install mpac-pgw-sdk

Create a PaymentIntent

typescript
import { MpacPGW } from '@mpac/pgw-sdk'

const pgw = new MpacPGW({
  apiKey: 'your-api-key',
  secretKey: 'your-secret-key',
  baseURL: 'https://api.pgw.mpac-cloud-dev.com',
})

const paymentIntent = await pgw.paymentIntents.create({
  amount: 1000,
  currency: 'JPY',
  processing_type: 'pgw_processed',
  store_id: 'store_01ABCDEF',
})

console.log(paymentIntent.id) // pi_01...
console.log(paymentIntent.status) // 'requires_payment_method'
go
import pgw "github.com/mp-solution-inc/mpac-pgw/sdks/sdk-go"

client := pgw.NewClient(
    pgw.WithAPIKey("your-api-key"),
    pgw.WithSecretKey("your-secret-key"),
    pgw.WithBaseURL("https://api.pgw.mpac-cloud-dev.com"),
)

pi, err := client.PaymentIntents.Create(ctx, &pgw.CreatePaymentIntentParams{
    Amount:         1000,
    Currency:       "JPY",
    ProcessingType: "pgw_processed",
    StoreID:        "store_01ABCDEF",
})
if err != nil {
    log.Fatal(err)
}

fmt.Println(pi.ID)     // pi_01...
fmt.Println(pi.Status) // requires_payment_method
python
from mpac_pgw import MpacPGW

client = MpacPGW(
    api_key="your-api-key",
    secret_key="your-secret-key",
    base_url="https://api.pgw.mpac-cloud-dev.com",
)

payment_intent = client.payment_intents.create(
    amount=1000,
    currency="JPY",
    processing_type="pgw_processed",
    store_id="store_01ABCDEF",
)

print(payment_intent.id)      # pi_01...
print(payment_intent.status)  # requires_payment_method

Authentication

All SDKs handle HMAC-SHA256 authentication automatically. You need:

  1. API Key - Identifies your ClientPartner
  2. Secret Key - Used to sign requests (never expose client-side)

For client-side operations, use the payment_token returned when creating a PaymentIntent. See the API Authentication Guide for details.

PaymentIntent Lifecycle

See the PaymentIntent Guide for the full lifecycle documentation.

SDK References

MPAC — MP-Solution Advanced Cloud Service