【发布时间】:2014-03-10 18:00:44
【问题描述】:
几天前,我写了一篇关于贝宝定期付款的帖子Paypal recurring payments with variable amount
我将其标记为已修复,但事实并非如此。
首先,我决定开发方法 1(通过删除旧配置文件并创建一个新配置文件)。这行得通。但是,在那之后我意识到,我并没有满足我的所有要求。所以最后,对我来说正确的方法是第二个。这意味着,正如@Andrew Angell 建议的那样,我将开发一个自定义计费系统来向客户计费。为此,我将创建计费协议,并使用返回的 id 以我需要的金额以及在我需要的时候执行参考交易。到目前为止,对吗?
根据 Paypal 文档,这是可能的:https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/
所以,我正在尝试按照步骤操作,所以首先执行 setExpressCheckout:
# Paypal setExpressCheckout
def setExpressCheckout(billingType, returnURL, cancelURL, price, description)
@api = PayPal::SDK::Merchant::API.new
if billingType == "credit-card"
billingType = "Billing"
else
billingType = "Login"
end
@set_express_checkout = @api.build_set_express_checkout({
SetExpressCheckoutRequestDetails: {
ReturnURL: returnURL,
CancelURL: cancelURL,
LocaleCode: "US",
LandingPage: billingType,
PaymentDetails: [{
NotifyURL: returnURL,
OrderTotal: {
currencyID: "EUR",
value: price
},
ShippingTotal: {
currencyID: "EUR",
value: "0"
},
TaxTotal: {
currencyID: "EUR",
value: "0"
},
PaymentDetailsItem: [{
Name: description,
Quantity: 1,
Amount: {
currencyID: "EUR",
value: price
},
}],
PaymentAction: "Authorization" # To authorize and retain the funds, and when booking is confirmed capture them.
}],
BillingAgreementDetails: [{
BillingType: "MerchantInitiatedBillingSingleAgreement",
BillingAgreementDescription: description
}]
}
})
# Make API call & get response
@express_checkout_response = @api.set_express_checkout(@set_express_checkout)
# Access Response
if @express_checkout_response.success?
@token = @express_checkout_response.Token
puts "setExpressCheckout completed OK :)"
@paypal_url = @api.express_checkout_url(@express_checkout_response)
else
puts "setExpressCheckout KO :("
@express_checkout_response.Errors
puts "@express_checkout_response=" + @express_checkout_response.inspect
end
@express_checkout_response
end
但是,我得到了这个错误:
@LongMessage="Merchant not enabled for reference transactions", @ErrorCode="11452"
很清楚,只需要联系 Paypal 支持人员并要求他们在我的 Paypal 沙盒帐户中启用参考交易。正确的?我已经做到了,我只是在等待。
但是,真正让我担心的是,我打电话给 Paypal 支持,他们告诉我这种方法在西班牙行不通。虽然它在文档中,但它只在英国工作。这是真的?
如果这是真的,我真的有麻烦了,因为据我所知,Paypal 不支持可变金额的订阅。
【问题讨论】:
标签: ruby-on-rails paypal express-checkout