createPaymentUrl method
Create a payment session and return the payment URL
Implementation
@override
Future<PaymentUrlResponse> createPaymentUrl(PaymentRequest request) async {
final response = await makeBackendRequest(
endpoint: '/api/payments/create',
method: 'POST',
body: {
'provider': 'razorpay',
'amount': (request.amount * 100).round(), // Convert to paise
'currency': request.currency.toUpperCase(),
'description': request.description,
'order_id': request.orderId,
'customer_email': request.customerEmail,
'customer_name': request.customerName,
'customer_contact': request.customerPhone,
'callback_url':
request.successUrl ?? '${config.backendUrl}/api/payments/success',
'cancel_url':
request.cancelUrl ?? '${config.backendUrl}/api/payments/cancel',
'notes': request.metadata,
'key_id': config.apiKey,
'environment': config.environment.name,
},
);
final data = handleResponse(response);
return PaymentUrlResponse.fromJson(data);
}