Payment Services
Orbitus provides flexible payment solutions by offering multi-payment gateway integration.
Supported Gateways
PayTR
A payment gateway optimized for the Turkish market.
Features:
- 3D Secure support
- Single payment and installment options
- Turkish Lira support
- Instant confirmation
Integration:
// 1. Singleton/Façade kullanımı (Varsayılan)
import { paytr } from '@orbitusdev/core/services/payment';
const payment = await paytr.createPayment({
amount: 100,
currency: 'TRY',
orderId: 'ORDER-123',
customer: {
name: 'John Doe',
email: 'john@example.com',
phone: '+905551234567',
},
});
// 2. Manuel Örnekleme (Advanced)
import { PaymentService } from '@orbitusdev/core/services/payment';
import { PayTRProvider } from '@orbitusdev/core/services/payment/providers/paytr';
const paymentService = new PaymentService(new PayTRProvider());
const result = await paymentService.createPayment({
orderId: 'ORD-123',
amount: 10000, // 100.00 TL
// ... diğer parametreler
});Environment Variables:
PAYTR_MERCHANT_ID=your_merchant_id
PAYTR_MERCHANT_KEY=your_merchant_key
PAYTR_MERCHANT_SALT=your_merchant_saltStripe
A global payment infrastructure.
Features:
- 135+ currencies
- Recurring payments (subscription)
- Webhook integration
- Dashboard and reporting
Integration:
import { stripe } from '@orbitusdev/core/services/payment';
const paymentIntent = await stripe.createPaymentIntent({
amount: 1000, // cents
currency: 'usd',
customer: 'cus_xxx',
});Environment Variables:
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_PUBLISHABLE_KEY=pk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxxCommon API
A standard API for both gateways:
interface PaymentGateway {
createPayment(params: PaymentParams): Promise<Payment>;
verifyPayment(id: string): Promise<PaymentStatus>;
refund(id: string, amount?: number): Promise<Refund>;
}Webhook Handling
For listening to payment status updates:
// apps/website/src/app/api/webhooks/payment/route.ts
export async function POST(request: Request) {
const signature = request.headers.get('stripe-signature');
// Verify and process webhook
}Test Cards
PayTR Test
- Card: 5400010000000004
- CVV: 123
- Date: Any future date
Stripe Test
- Card: 4242 4242 4242 4242
- CVV: Any 3 digits
- Date: Any future date
Last updated on