1

Paypal API に addressverify 操作があることは知っていますが、ドキュメントによると、ユーザーの住所と郵便番号を電子メールと共に送信する必要があるとも書かれています。

ユーザーのアドレスを収集する必要はありません。そのメールアドレスに支払いを行っても失敗しないことを確認したいだけです。そして、トランザクションとは独立してこれを実行できる必要があります。3 週間以内に取引を送信する予定の電子メールが有効なペイパル アカウントであることを今日知る必要があります。

それは可能ですか?

4

2 に答える 2

0

私の最初の試みは、アダプティブ ペイメント API GetUserLimits でしたが、うまくいきませんでした。私の理解では、それは制限された API です。

私は、トランザクションの送信者と受信者として有効な電子メールが使用されている場合、アダプティブ ペイメントAPI がエラーをスローするという事実に基づいて、ソリューションをハッキングすることになりました。このケースを探して、電子メールが有効かどうかをテストします。(ルビーコードはこちら)

 def getApi()
  PayPal::SDK.configure(
  :mode      => "sandbox",  # Set "live" for production
  :app_id    => "yourAppId",
  :username  => "yourUsername",
  :password  => "yourPassword",
  :signature => "yourSignature" )

  api = PayPal::SDK::AdaptivePayments.new
 end

 def pay(senderEmail, receiverEmail, amount, trackingId)
  @api = getApi

  # Build request object
  @pay = @api.build_pay({
    :actionType => "PAY",
    :cancelUrl =>  "https://yourwebsite.com/cancel/" + trackingId,
    :currencyCode => "USD",
    :feesPayer => "SENDER",
    :ipnNotificationUrl => "https://yourwebsite.com/ipn_notify/" + trackingId,
    :receiverList => {
      :receiver => [{
        :amount => amount,      :email => receiverEmail }] },
    :returnUrl =>  http://www.yourwebsite.com/completed/" + trackingId})

  @pay.sender.email = senderEmail
  #@pay.sender.accountId = 23434
  # Make API call & get response
  puts @pay.inspect
  @response = @api.pay(@pay)

  if @response.success?
    @response.payKey
    completeUrl = @api.payment_url(@response)
    return {url: completeUrl, payKey: @response.payKey}
  else
    raise AccountException.new(@response.error[0])
  end
 end

 def isValidAccount(email)
  begin
    result = pay(email, email, 1.0)
  rescue AccountException
    puts 'in rescue'
    senderAndReceiverCantbeTheSameErrorCode = 579033
    if $!.innerError.errorId == senderAndReceiverCantbeTheSameErrorCode
      return true
    end
  end
  return false
 end
于 2014-04-06T20:50:02.517 に答える