새 REST API를 사용하여 다른 클라이언트를 대신하여 추적 정보 필드를 추가하는 방법이 있습니까? 그렇지 않은 경우에도 이전 API를 사용하는 페이팔 앱을 만들 수 있습니까?
내가하려는 일을 보여주는 오래된 질문 이 있습니다.
이 문서 페이지 를 따라 다음 C # 코드를 사용하여 샌드 박스 계정의 정보를 업데이트 할 수있었습니다.
private static string SendRequest()
{
var client = new HttpClient();
var end_point = "https://api.sandbox.paypal.com/v1/shipping/trackers-batch";
try
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var requestMessage = new HttpRequestMessage
{
RequestUri = new Uri(end_point),
Method = HttpMethod.Post,
};
string clientId = "";
string secret = "";
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Basic",
Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes($"{clientId}:{secret}")));
string body = File.ReadAllText("data.json");
requestMessage.Content = new StringContent(body, Encoding.UTF8, "application/json");
var x = client.SendAsync(requestMessage).Result;
string responseStr = x.Content.ReadAsStringAsync().Result;
return responseStr;
}
catch (Exception exp)
{
Debug.Print(exp.Message);
return null;
}
finally
{
client.Dispose();
}
}
data.json
{
"trackers": [
{
"transaction_id": "04YE27.....",
"tracking_number": "443844....",
"status": "SHIPPED",
"carrier": "FEDEX"
}
]
}
하지만 해당 계정 설정에서 내 앱에 권한을 부여한 경우에도 다른 SandBox 계정 데이터를 업데이트하지 못합니다. 다음은 서버 응답입니다.
{
"tracker_identifiers":[
],
"errors":[
{
"name":"NOT_AUTHORIZED",
"message":"Authorization failed due to insufficient permissions",
"details":[
{
"field":"/trackers/1/transaction_id",
"value":"04YE27.....",
"location":"body",
"issue":"USER_NOT_AUTHORIZED",
"description":"You are not authorized to add or modify tracking number for this transaction"
}
],
"links":[
]
}
],
"links":[
{
"href":"https://api.sandbox.paypal.com/v1/shipping/trackers-batch",
"rel":"self",
"method":"POST",
"encType":"application/json"
}
]
}
사용자에게 내 앱에 필요한 권한을 부여하도록 요청할 수 있습니다. 하지만 모든 사람에게 앱을 만들고 클라이언트 ID와 암호를 알려달라고 요청할 수는 없습니다.
모든 사람에게 앱을 만들고 클라이언트 ID와 시크릿을 알려달라고 요청할 수는 없습니다.
이것이 바로 PayPal 계정의 거래 수준 정보에 대해 이러한 수준의 세부적인 제어를 갖기 위해 수행해야하는 작업입니다.
앱을 만들고 자격 증명을 공유하는 것 외에 권한을 부여하는 메커니즘은 없습니다.
그렇지 않은 경우에도 이전 API를 사용하는 페이팔 앱을 만들 수 있습니까?
이전 API 및 앱은 추적 정보를 업데이트하는 방법을 제공하지 않습니다. 또한 새로운 통합에 대해 지원되지 않으며 더 이상 사용해서는 안됩니다 (이전 버전과의 호환성 / 유지 관리 전용).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다