Paypal recurring payments with variable amount 2 (in Spain)

感情迁移 提交于 2019-12-11 09:23:48

问题


some days ago, I wrote this post regarding Paypal recurring payments with variable amount Paypal recurring payments with variable amount

I marked it as fixed, however it is not.

First, I decided to develop approach 1 (by removing old profile and creating a new one). This worked. But, after that I realized, that I didn´t cover all my requirements. So finally, the right approach for me is number 2. This means, as @Andrew Angell suggested, I will develop a custom billing system that bills the customers. For that, I will create Billing Agreements and I will use the returned ids to execute Reference transactions with the amount I need and whenever I need. So far, it´s right?

According to Paypal docs, this is possible: https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/

So, I´m trying to follow the steps, so first a execute a 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

However, I get this error:

@LongMessage="Merchant not enabled for reference transactions", @ErrorCode="11452"

It´s quite clear, just need to contact Paypal support guys and ask them to enable Reference transactions in my Paypal sandbox account. Right? I already did it and I´m just waiting.

However, what really worries me, is that I called Paypal support and they told me that this approach will not work in Spain. Although it´s in the doc, it´s only working in UK. Is this true?

If it´s true, I´m really in a trouble, because as far as I know, Paypal doesn´t not support subscriptions with variable amount.


回答1:


Paypal technical support guy has enabled my sandbox account to reference transactions. I have developed the logic and it´s working. At least, in Sandbox and in Spain.

So, I will assume, it works.

Bad the Paypal guy on the phone that told me it wasn´t possible.



来源:https://stackoverflow.com/questions/21727458/paypal-recurring-payments-with-variable-amount-2-in-spain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!