ฉันกำลังทำงานกับการรวมเกตเวย์ Square Payment ใน ASp.Net ฉันต้องการขอ card_nonce โดยใช้ข้อมูลที่เก็บไว้ในฐานข้อมูล ฉันสามารถขอ card_nonce โดยตรงโดยไม่ต้องใช้ SqPaymentForm ได้หรือไม่
ฉันพยายามส่งคำขอโดยใช้คำขอ Restsharp แต่ได้รับข้อผิดพลาดในการตอบสนอง ด้านล่างนี้คือโค้ดและการตอบกลับของฉันจาก Square Up
ต้องการรหัส:
RestSharp.RestClient ClientNonce = new RestSharp.RestClient("https://connect.squareup.com");
RestSharp.RestRequest RequestNonce = new RestSharp.RestRequest("v2/card_nonce", RestSharp.Method.POST);
RequestNonce.RequestFormat = RestSharp.DataFormat.Json;
RequestNonce.AddHeader("Accept", "application/json");
string jsonBodyNone = "{\"client_id\":\""+sandboxId+"\",\"card_data\":{\"billing_postal_code\":\"73001\",\"cvv\":\"564\",\"exp_month\":\"1\",\"exp_year\":\"2021\",\"number\":\"4532759734545858\"},\"website_url\":\"http://localhost:24584/\"}";
RequestNonce.AddParameter("application/json", jsonBodyNone, RestSharp.ParameterType.RequestBody);
RestSharp.IRestResponse responseNonce = ClientNonce.Execute(RequestNonce);
System.Net.HttpStatusCode getresponseNonce = responseNonce.StatusCode;
ResponseFromSquare: {"errors":[{"category":INVALID_REQUEST_ERROR", "code": "BAD_REQUEST", "detail": "คำขอของคุณไม่สามารถประมวลผลได้"}]}