Reputation: 1
Is it possible to change Razorpay Status from Flutter?
I am using razorpay for my app and after getting success status the the status of Razorpay payment is "Authorized". I need to change this status to "Captured".
Upvotes: 0
Views: 509
Reputation: 777
Yes, you can use capture
API /payments/:id/capture
for converting the status. source
import 'package:http/http.dart' as http;
import 'dart:convert';
final paymentId = 'your_payment_id';
final apiKey = 'your_razorpay_api_key';
final url = 'https://api.razorpay.com/v1/payments/$paymentId/capture';
final response = await http.post(
Uri.parse(url),
headers: {
'Authorization': 'Basic ' + base64Encode(utf8.encode('$apiKey:')),
'Content-Type': 'application/json',
},
);
if (response.statusCode == 200) {
// Payment captured successfully
} else {
// Error occurred while capturing payment
}
Upvotes: 0