Documentation
Everything you need to integrate Paystream into your application
Quick Start Guide
1. Install the SDK
# npm
npm install @paystream/sdk
# yarn
yarn add @paystream/sdk
2. Initialize
import Paystream from '@paystream/sdk';
const paystream = new Paystream({
apiKey: process.env.PAYSTREAM_API_KEY
});
3. Create a payment
const payment = await paystream.payments.create({
amount: 2000,
currency: 'usd',
description: 'Order #1234',
customer: 'cus_abc123'
});
console.log(payment.status); // 'succeeded'
Key Concepts
Payments
The core object representing a customer payment. Contains amount, currency, status, and metadata.
Customers
Store customer information for recurring payments and better analytics.
Webhooks
Receive real-time notifications when events occur in your account.
Refunds
Process full or partial refunds programmatically through the API.
API Endpoints
POST /v1/payments
Create a new payment
curl https://api.paystream.com/v1/payments \
-H "Authorization: Bearer sk_test_..." \
-d "amount=2000" \
-d "currency=usd"
GET /v1/payments/:id
Retrieve a payment
curl https://api.paystream.com/v1/payments/pay_abc123 \
-H "Authorization: Bearer sk_test_..."
POST /v1/refunds
Refund a payment
curl https://api.paystream.com/v1/refunds \
-H "Authorization: Bearer sk_test_..." \
-d "payment=pay_abc123"
Available SDKs
Node.js
npm install @paystream/node
Python
pip install paystream
Ruby
gem install paystream
PHP
composer require paystream/sdk
Go
go get paystream.com/sdk
Java
Maven: paystream-java