有贝宝权限的Rails和贝宝快捷结账

时间:2022-10-14 15:49:16

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.

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

I have the following codes

我有以下代码

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

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

@credential是我的对象存储在数据库中,它有来自Paypal权限SDK的标记。

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

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

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

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).

现在,我的问题是,这笔钱不是直接流向用户paypal账户,而是流向我们的账户(我们创建了一个账户,这样我们就可以在paypal的经典API部分创建一个应用程序)。

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

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

2 个解决方案

#1


2  

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.

当代表其他帐户调用API时,需要添加参数“subject”来指示正在调用API的帐户。“subject”的值可以是账户主电子邮件地址或payerID。然后钱就会转到科目的价值。

#2


0  

Yihui gave the right answer. But I wanted to explain/post here what I did to fix my problem (using Yihui's guidance).

Yihui给出了正确的答案。但是我想在这里解释/发布我为解决我的问题所做的事情(使用Yihui的指导)。

You need to get the Payer ID from the 3rd Party Permissions SDK of Paypal. So you will need to ask for the following "ACCESS_BASIC_PERSONAL_DATA", "EXPRESS_CHECKOUT", and "REFUND".

您需要从Paypal的第三方权限SDK中获取Payer ID。因此,您需要请求以下“ACCESS_BASIC_PERSONAL_DATA”、“EXPRESS_CHECKOUT”和“REFUND”。

Then you will need to use the NVP (Name Value Pair) SDK of paypal to perform Express Checkout on behalf of another party/merchant.

然后,您需要使用paypal的NVP(名称值对)SDK,代表另一方/商户执行快速结账。

For more information, we followed the following article of Paypal https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/

要了解更多信息,我们阅读了以下贝宝https://developer.paypal.com/docs/classic/express-checkout/ht_ec- singleitempay -curl-etc/的文章

#1


2  

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.

当代表其他帐户调用API时,需要添加参数“subject”来指示正在调用API的帐户。“subject”的值可以是账户主电子邮件地址或payerID。然后钱就会转到科目的价值。

#2


0  

Yihui gave the right answer. But I wanted to explain/post here what I did to fix my problem (using Yihui's guidance).

Yihui给出了正确的答案。但是我想在这里解释/发布我为解决我的问题所做的事情(使用Yihui的指导)。

You need to get the Payer ID from the 3rd Party Permissions SDK of Paypal. So you will need to ask for the following "ACCESS_BASIC_PERSONAL_DATA", "EXPRESS_CHECKOUT", and "REFUND".

您需要从Paypal的第三方权限SDK中获取Payer ID。因此,您需要请求以下“ACCESS_BASIC_PERSONAL_DATA”、“EXPRESS_CHECKOUT”和“REFUND”。

Then you will need to use the NVP (Name Value Pair) SDK of paypal to perform Express Checkout on behalf of another party/merchant.

然后,您需要使用paypal的NVP(名称值对)SDK,代表另一方/商户执行快速结账。

For more information, we followed the following article of Paypal https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/

要了解更多信息,我们阅读了以下贝宝https://developer.paypal.com/docs/classic/express-checkout/ht_ec- singleitempay -curl-etc/的文章