PayPal实施应用费(平台费)

时间:2019-06-27 06:06:54

标签: paypal

我们正在使用PayPal sdk(运行时版本-2.0.50727)
为了实施“应用费”的概念,在完成买方与商家之间的交易(即将金额记入商户的款项)后,我们尝试从关联的商户帐户中扣除“应用费”并转移至平台帐户。 这样做时,我们得到的是状态码-PayPalPaymentStatusCode.CREATED而不是PayPalPaymentStatusCode.COMPLETED。 请参考所附的屏幕截图。

此外,我们在平台帐户控制台和关联帐户控制台中均未看到任何平台费用交易。

此外,我们在哪里可以查看API日志并查看自身错误(如果有)? (如条纹和wepay)。在商家帐户或平台帐户中都可以显示屏幕。

我们在Web应用程序中集成了Paypal。

公共布尔PreApprovalPayment(十进制appFee)         {             字符串receiverEmail = ConfigurationManager.AppSettings [“ Paypal.Receiver.EmailId”]。ToString();

        //PAY – Use this option if you are not using the Pay request in combination with ExecutePayment.
        //CREATE – Use this option to set up the payment instructions with SetPaymentOptions 
        //and then execute the payment at a later time with the ExecutePayment.
        //PAY_PRIMARY – For chained payments only, specify this value to delay payments to the secondary receivers; 
        //only the payment to the primary receiver is processed.
        string actionType = "PAY";
        string fundingType = "BALANCE";//ECHECK,BALANSE,CREDITCARD 
        string returnUrl = this.ReturnUrl;
        //cancel url to redirect to Payment integration app for Set Express check out Payment
        string cancelUrl = this.ReturnUrl;

        ReceiverList receiverList = new ReceiverList();
        receiverList.receiver = new List<Receiver>();
        Receiver rec = new Receiver(appFee);
        rec.email = receiverEmail;
        receiverList.receiver.Add(rec);
        PayRequest request = new PayRequest(new RequestEnvelope("en_US"), actionType,
                            cancelUrl, this.CurrencyCode,
                            receiverList, returnUrl);
        if (!string.IsNullOrWhiteSpace(this.PreApprovalKey))
        {
            request.preapprovalKey = this.PreApprovalKey;
        }

        if (!string.IsNullOrWhiteSpace(this.SenderEmail))
            request.senderEmail = this.SenderEmail;

        if (!string.IsNullOrWhiteSpace(fundingType))
        {
            request.fundingConstraint = new FundingConstraint();
            request.fundingConstraint.allowedFundingType = new FundingTypeList();
            request.fundingConstraint.allowedFundingType.fundingTypeInfo.Add(
                new FundingTypeInfo(fundingType));
        }
        AdaptivePaymentsService service = null;
        PayResponse response = null;
        try
        {
            // Configuration map containing signature credentials and other required configuration.
            Dictionary<string, string> configurationMap = PayPalConfiguration.GetAcctAndConfig();

            // Creating service wrapper object to make an API call and loading
            // configuration map for your credentials and endpoint
            service = new AdaptivePaymentsService(configurationMap);

            if (service != null)
            {
                response = service.Pay(request);
                if (response != null && !(response.responseEnvelope.ack == AckCode.FAILURE) &&
                    !(response.responseEnvelope.ack == AckCode.FAILUREWITHWARNING))
                {
                    if (!string.IsNullOrEmpty(response.payKey) && response.paymentExecStatus.Equals(PayPalPaymentStatusCode.COMPLETED.ToString()))
                    {
                        return true;
                    }
                }
            }
        }
        catch (Exception e)
        {
            return false;
        }
        return false;
    }

我们需要从与平台所有者帐户有关的客户交易中扣除应用程序费用,而剩余的金额应由商店组织者支付。

0 个答案:

没有答案