makePayment method
Implementation
Future<Map<String, dynamic>> makePayment({
required String amount,
required String phone,
required String externalId,
}) async {
final token = await getAccessToken();
final url = OMConfig.isSandbox
? "https://api.orange.com/orange-money-webpay/sandbox/v1/webpayment"
: "https://api.orange.com/orange-money-webpay/ci/v1/webpayment";
final response = await http.post(
Uri.parse(url),
headers: {
"Authorization": "Bearer $token",
"Content-Type": "application/json",
"X-Callback-Url": OMConfig.callbackUrl,
"X-Reference-Id": externalId,
"X-Target-Environment": OMConfig.isSandbox ? "sandbox" : "production",
},
body: jsonEncode({
"amount": amount,
"currency": "XOF",
"externalId": externalId,
"payer": {
"partyIdType": "MSISDN",
"partyId": phone
},
"payerMessage": "Paiement via SDK",
"payeeNote": "OM SDK"
}),
);
return jsonDecode(response.body);
}