createPayment method

Future<Map<String, dynamic>> createPayment(
  1. int amount,
  2. String description,
  3. String statusCallbackUrl
)

Implementation

Future<Map<String, dynamic>> createPayment(
    int amount, String description, String statusCallbackUrl) async {
  final token = await _getAccessToken();
  final response = await _dio.post(
    _paymentUrl,
    data: {
      'monetaryValue': {
        'amount': amount.toString(),
        'currency': 'IQD',
      },
      'statusCallbackUrl': statusCallbackUrl,
      'description': description,
      'expiresIn': 'PT12H',
      'refundableFor': '',
    },
    options: Options(
      headers: {'Authorization': 'Bearer $token'},
    ),
  );
  return response.data;
}