1

以下来自 PayPal 的服务器端示例代码生成一个预批准密钥:

public string GetPreApprovalKey() {
    RequestEnvelope requestEnvelope = new RequestEnvelope("en_US");

    string returnUrl = "https://devtools-paypal.com/guide/ap_preapprove_payment/dotnet?success=true";
    string cancelUrl = "https://devtools-paypal.com/guide/ap_preapprove_payment/dotnet?cancel=true";

    string currencyCode = "USD";
    string startingDate = "2013-10-30";
    PreapprovalRequest preapproveRequest = new PreapprovalRequest(requestEnvelope, cancelUrl, currencyCode, returnUrl, startingDate);

    preapproveRequest.endingDate = "2014-10-30";


    Dictionary<string, string> sdkConfig = new Dictionary<string, string>();
    sdkConfig.Add("mode", "sandbox");
    sdkConfig.Add("account1.apiUsername", "jb-us-seller_api1.paypal.com");
    sdkConfig.Add("account1.apiPassword", "WX4WTU3S8MY44S7F");
    sdkConfig.Add("account1.apiSignature", "AFcWxV21C7fd0v3bYYYRCpSSRl31A7yDhhsPUU2XhtMoZXsWHFxu-RWy");
    sdkConfig.Add("account1.applicationId", "APP-80W284485P519543T");

    AdaptivePaymentsService adaptivePaymentsService = new AdaptivePaymentsService(sdkConfig);
    PreapprovalResponse preapprovalResponse = adaptivePaymentsService.Preapproval(preapproveRequest);

    return preapprovalResponse.preapprovalKey;
}

首先,从哪里得到"account1.apiUsername", "account1.apiPassword", "account1.apiSignature", "account1.applicationId"

其次,更重要的是,PayPal 告诉您将用户重定向到:

https://www.sandbox.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey={preapproval.preapprovalKey}

我想在 PhoneGap 应用程序中设置预先批准功能,但不要太显眼。您是否可以完全在自己的 UI 中设置 PayPal 预先批准,而不是通过 PayPal UI?

非常感谢

4

1 回答 1

0

您可以使用此工具获取您的 API 用户名、密码和签名。您还可以在您的 PayPal 帐户资料中找到/生成它们。

要生成 Preapproval,您需要通过重定向。不幸的是,没有办法避免这种情况。

于 2013-10-31T08:38:45.217 回答