Here is my code let me know where i am going wrong i am generating order request using sandbox url for create order
createOrder({accessToken})async{
var headers = {
'Content-Type': 'application/json',
'PayPal-Request-Id': '7b92603e-77ed-4896-8e78-5dea2050476a',
'Authorization': 'Bearer ${accessToken}',
};
var data = json.encode({
"intent": "CAPTURE",
"purchase_units": [
{
"items": [
{
"name": "T-Shirt",
"description": "Green XL",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "${amount}"
}
}
],
"amount": {
"currency_code": "USD",
"value": "${amount}",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "${amount}"
}
}
}
}
],
"application_context": {
"return_url": "https://example.com/return",
"cancel_url": "https://example.com/cancel"
}
});
var dio = Dio();
var response = await dio.request(
'https://api-m.sandbox.paypal.com/v2/checkout/orders',
options: Options(
method: 'POST',
headers: headers,
),
data: data,
);
if (response.statusCode == 200) {
showProgressDialog(false);
print(json.encode(response.data));
Map<String, dynamic> mapppedResponse = response.data;
payId = mapppedResponse['id'];
if (webViewController != null) {
webViewController.loadUrl((mapppedResponse['links'] as List)[1]['href']);
}
}
else {
print(response.statusMessage);
showProgressDialog(false);
}
}
How can i resolve this issue and from where i can get PayPal-Request-Id right now i am using dummy is this creating issue.
please do reply if you have any kind of info related to it