具有 Paypal 权限和 Paypal Express Checkout 的 Rails [英] Rails with Paypal Permissions and Paypal Express Checkout

查看:16
本文介绍了具有 Paypal 权限和 Paypal Express Checkout 的 Rails的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个应用程序,用户可以在其中通过 Paypal Permissions SDK (https://github.com/paypal/permissions-sdk-ruby).我能够成功获得用户的许可,并且能够存储从 Paypal Permissions SDK 返回的令牌.现在,我使用以下 gem 进行快速结账(https://github.com/nov/paypal-express).但是代表用户的 Paypal Express Checkout 文档并不清楚我们应该如何使用令牌来调用 Express Checkout.

I'm building an application where a user can connect their own Paypal account through Paypal Permissions SDK (https://github.com/paypal/permissions-sdk-ruby). I was able to successfully get permission from the user and was able to store the tokens that were returned from the Paypal Permissions SDK. Now, I am using the following gem for Express Checkout (https://github.com/nov/paypal-express). But the documentation for Paypal Express Checkout on behalf of a user is not clear on how we should use the tokens to invoke a call for Express Checkout.

我有以下代码

@api = PayPal::SDK::Permissions::API.new({
  token: @credential.paypal_access_token,
  token_secret: @credential.paypal_secret_token
})

@credential 是我存储在数据库中的对象,该数据库具有来自 Paypal 权限 SDK 的令牌.

Where @credential is my object stored in the database that has the tokens from the Paypal Permissions SDK.

现在获取后,我可以使用@api 对象获取Paypal 用户名、密码和签名

Now after getting, I can use the @api object to get Paypal Username, Password, and Signature

request = Paypal::Express::Request.new(
  :username   => @api.config.username,
  :password   => @api.config.password,
  :signature  => @api.config.signature
)

现在,我的问题是钱不会直接转到用户的贝宝帐户,而是会转到我们的帐户(我们创建了一个帐户,以便我们可以在贝宝的经典 API 部分创建应用程序).

Now, my problem is that the money isn't going directly to the users paypal account but it is going to our account (we made an account so that we can create a Application in the Classic API part of Paypal).

有谁能帮帮我吗?或者指出我正确的方向?

Is there anyone who can help me? or point me to the right direction?

推荐答案

当代表其他账号调用API时,需要添加参数subject"来指明你调用API的账号.主题"的值可以是帐户主电子邮件地址或付款人 ID.然后这笔钱会转到作为主题价值的帐户.

When calling API on behalf of other account, you need to add parameter "subject" to indicate the account that you are calling API for. The value of "subject" could be the account primary email address or payerID. Then the money will go to the account which was the value of subject.

这篇关于具有 Paypal 权限和 Paypal Express Checkout 的 Rails的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆