flutter list payment paypal

Issue

i am trying to get a paypal payment list in flutter, but i can’t get it.
This is the documentation:
doc paypal api

but I don’t know where I’m wrong.
This is my code:

var response = await http.post(
      Uri.parse(
          "https://api-m.sandbox.paypal.com/v1/payments/payment?count=10&start_index=0&sort_by=create_time&sort_order=desc"),
      headers: {
        "content-type": "application/json",
        'Authorization': 'Bearer ' + accessToken
      });

I’m getting a 400’s error: INVALID_REQUEST
a help? thank you

Solution

sorry for the nonsense I realized now that it is of type get and not post.
Correct code:

var response = await http.get(
      Uri.parse(
          "https://api-m.sandbox.paypal.com/v1/payments/payment?count=10&start_index=0&sort_by=create_time&sort_order=desc"),
      headers: {
        "content-type": "application/json",
        'Authorization': 'Bearer ' + accessToken
      });

Answered By – Maurizio Mancini

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published