ruby - 如何制作一个 Ruby 应用程序来向特定用户汇款?

标签 ruby paypal

我是一名 Ruby 用户,正在尝试制作一个允许我向 friend 付款的 Ruby 应用程序。我的 friend 有个人的 Paypal 帐户(即 sungpahfriend@hello.com)。我有一定数额的钱要付给我的 friend 。 我有一个企业帐户。 ( sungpah@hello.com )。 但是我找不到如何向我的 friend 付款。

我必须输入我的信用卡信息还是只输入我的电子邮件地址和金额?另外,我应该把 friend 的电子邮件地址放在哪里?

我真的很想知道如何有效地做到这一点。我期待得到反馈!

最佳

require 'paypal-sdk-rest'
    PayPal::SDK::Core::Config.load('config/paypal.yml',  ENV['RACK_ENV'] || 'development')
    PayPal::SDK.logger = Logger.new(STDERR)

    PayPal::SDK.logger.level = Logger::INFO


    PayPal::SDK.configure({
      :mode => "sandbox",
      :client_id => "xxx-xx",
      :client_secret => "xx-xx"
    })


    @payment = PayPal::SDK::REST::Payment.new({
      :intent => "sale",
      :payer => {
        :payment_method => "credit_card",
        :funding_instruments => [{
          :credit_card => {
            :type => "visa",
            :number => "4567516310777851",
            :expire_month => "11",
            :expire_year => "2018",
            :cvv2 => "874",
            :first_name => "Joe",
            :last_name => "Shopper",
            :billing_address => {
              :line1 => "52 N Main ST",
              :city => "Johnstown",
              :state => "OH",
              :postal_code => "43210",
              :country_code => "US" }}}]},
      :transactions => [{
        :item_list => {
          :items => [{
            :name => "item",
            :sku => "item",
            :price => "1",
            :currency => "USD",
            :quantity => 1 }]},
        :amount => {
          :total => "1.00",
          :currency => "USD" },
        :description => "This is the payment transaction description." }]})

    # Create Payment and return the status(true or false)
    if @payment.create
      @payment.id     # Payment Id
    else
      @payment.error  # Error Hash
    end

enter image description here

最佳答案

这可能是 Payouts API 的一个好案例,Ruby SDK 也支持.

要以最少的费用为付款提供资金,您需要在您的 PayPal 帐户中已有付款金额或链接到您的银行帐户。

关于ruby - 如何制作一个 Ruby 应用程序来向特定用户汇款?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33136568/

相关文章:

ruby - Rails 5 渲染部分并传递数据

ruby-on-rails - 识别重复的电子邮件。在里面

ruby-on-rails - ActiveRecord::StatementInvalid。 SQLite3::SQLException: 没有这样的表

paypal - paypal如何识别连接的设备?

ruby-on-rails - RoR - PayPal ActiveMerchant - 退款

ruby - Windows 上 Pow 的替代品?

ruby - 如何在 Padrino 应用程序中安装 Sinatra 应用程序?

php - Paypal 立即购买按钮如何在 ipn 监听器中捕获价格/选项下拉数据

javascript - 根据用户账户状态弹出

php - SpeckPaypal ZF2 如何编辑货币代码?