0

連鎖決済と連鎖決済の返金処理には PayPal.AdaptivePayments sdk を使用しています。

次のメソッドを使用します: 支払いの場合: pay() メソッドの払い戻し: sdk による払い戻し() メソッド。

payKey で返金しようとすると、「NO_API_ACCESS_TO_RECEIVER」というステータスの応答が返されます。

現在、私は開発中のサンドボックス アカウントです。

Paypal 開発者の api/sdk ドキュメントにも従いましたが、それでも同じ問題が発生します。

そのため、ステータスが「返金済み」の返金プロセスを手伝ってください。

これに関連する投稿をstack-overflowで既に確認しましたが、どの投稿でも適切な解決策を示していませんでした。

https://devtools-paypal.com/guide/ap_chained_pa​​yment?interactive=ON&env=sandbox

 private void Refund(HttpContext contextHttp)
    {
        NameValueCollection parameters = contextHttp.Request.Params;

        RefundRequest request = new RefundRequest(new RequestEnvelope("en_US"));

        // Set optional parameters
        if(parameters["receiverEmail"].Length > 0) 
        {
            //(Required) Amount to be paid to the receiver
            string[] amt = contextHttp.Request.Form.GetValues("receiverAmount");

            // Maximum length: 127 characters
            string[] receiverEmail = contextHttp.Request.Form.GetValues("receiverEmail");

            //Telephone country code 
            string[] phoneCountry = contextHttp.Request.Form.GetValues("phoneCountry");


            string[] phoneNumber = contextHttp.Request.Form.GetValues("phoneNumber");

            //Telephone extension
            string[] phoneExtn = contextHttp.Request.Form.GetValues("phoneExtn");


            string[] primaryReceiver = contextHttp.Request.Form.GetValues("primaryReceiver");

            string[] invoiceId = contextHttp.Request.Form.GetValues("invoiceId");

            string[] paymentType = contextHttp.Request.Form.GetValues("paymentType");
            //(Optional) The transaction subtype for the payment. 
            string[] paymentSubType = contextHttp.Request.Form.GetValues("paymentSubType");

            List<Receiver> receivers = new List<Receiver>();
            for(int i=0; i<amt.Length; i++) {
                Receiver r = new Receiver(Convert.ToDecimal(amt[i]));
                r.email = receiverEmail[i];
                r.primary = Convert.ToBoolean(primaryReceiver[i]);
                if(invoiceId[i] != string.Empty) {
                    r.invoiceId = invoiceId[i];
                }
                if(paymentType[i] != string.Empty) {
                    r.paymentType = paymentType[i];
                }
                if(paymentSubType[i] != string.Empty) {
                    r.paymentSubType = paymentSubType[i];
                }
                if(phoneCountry[i] != string.Empty && phoneNumber[i] != string.Empty) {
                    r.phone = new PhoneNumberType(phoneCountry[i], phoneNumber[i]);
                    if(phoneExtn[i] != string.Empty) {
                        r.phone.extension = phoneExtn[i];
                    }
                }
                receivers.Add(r);
            }
            request.receiverList = new ReceiverList(receivers);
        }

        if(parameters["currencyCode"] != string.Empty) {
            request.currencyCode = parameters["currencyCode"];
        }

        if(parameters["payKey"] != string.Empty) {
            request.payKey = parameters["payKey"];
        }

        if(parameters["transactionId"] != string.Empty) {
            request.transactionId = parameters["transactionId"];
        }

        if(parameters["trackingId"] != string.Empty) {
            request.trackingId = parameters["trackingId"];
        }            

        AdaptivePaymentsService service = null;
        RefundResponse response = null;
        try
        {
            Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();
            service = new AdaptivePaymentsService(configurationMap);
            response = service.Refund(request);
        }
        catch (System.Exception e)
        {
            contextHttp.Response.Write(e.Message);
            return;
        }

        Dictionary<string, string> responseValues = new Dictionary<string, string>();

       // string redirectUrl = null;

        string redirectUrl = null;

        if (!(response.responseEnvelope.ack == AckCode.FAILURE) &&
            !(response.responseEnvelope.ack == AckCode.FAILUREWITHWARNING))
        {
            responseValues.Add("Currency code", response.currencyCode);
            int idx = 1;
            foreach (RefundInfo refund in response.refundInfoList.refundInfo)
            {
                //Receiver's email address.Maximum length: 127 characters
                responseValues.Add("Refund receiver " + idx, refund.receiver.email);
                // Amount to be refunded to the receiver.
                responseValues.Add("Refund amount " + idx, refund.receiver.amount.ToString());

                responseValues.Add("Refund status " + idx, refund.refundStatus);


                responseValues.Add("Acknowledgement", response.responseEnvelope.ack.ToString());
            }
        }
        Display(contextHttp, "Refund", responseValues, service.getLastRequest(), service.getLastResponse(), response.error, redirectUrl);
    }
4

0 に答える 0