我正在使用沙盒凭证在使用卡进行PayPal付款时获得回复.
{
"client": {
"environment": "sandbox",
"paypal_sdk_version": "2.14.6",
"platform": "Android",
"product_name": "PayPal-Android-SDK"
},
"response": {
"create_time": "2017-01-31T08:12:40Z",
"id": "PAY-*************",
"intent": "sale",
"state": "created"
},
"response_type": "payment"
}
Run Code Online (Sandbox Code Playgroud)
然后,我试图通过支付ID使用rest API调用获取完整详细信息,并在付款响应中获得"DEAD"状态.请检查以下回复
{
"id": "PAY-*************",
"create_time": "2017-01-31T08:12:40Z",
"update_time": "2017-01-31T08:13:22Z",
"state": "DEAD",
"intent": "sale",
"payer": {
"payment_method": "credit_card",
"funding_instruments": [
{
"credit_card": {
"type": "visa",
"number": "xxxxxxxxxxxx1111",
"expire_month": "11",
"expire_year": "2025"
}
}
]
},
"transactions": [
{
"amount": {
"total": "2.00",
"currency": "USD",
"details": {
"subtotal": "2.00"
}
},
"description": "New Product",
"related_resources": …Run Code Online (Sandbox Code Playgroud) 在我的网络应用程序(PHP)中,用户应该能够连接他的paypal帐户,每次他从我们的目录中销售产品时,我们都会向他收取价格.由于用户可能会销售很多产品,我想自动制作付款部分,因此他不必批准每笔交易.
不幸的是,我找不到使用Paypal SDK做到这一点的方法.
目前,该应用正在使用OAuth流程,因此用户被重定向到Paypal,我从那里获得了access_token.
问题:为用户提供access_token如何在没有Paypal重定向的情况下创建(后台)付款?
谢谢
我在我的项目中使用PayPal定期付款.而且我想在一段时间内给予一次免费试用,初始订单总数应该为零,一旦免费试用完成,实际的订单金额将从账户中扣除.
例如,用户购买一个产品(100美元)并应用折扣代码免费试用,然后第一个订单应该以0美元,一旦试用结束,100美元周期将运行.
对于我传递"0" setup_fee中MerchantPreferences:
merchant_preferences = new MerchantPreferences
{
return_url = url,
cancel_url = url,
auto_bill_amount = "YES",
setup_fee = new PayPal.Api.Currency
{
currency = currency != null ? currency.CurrencyCode : null,
value = "0.00"
}
}
Run Code Online (Sandbox Code Playgroud)
但它给了我一个错误:
付款错误:PayPal错误:请求无效.查看详细信息.(VALIDATION_ERROR)
付款错误:note请求中缺少注释或注释长度太长
付款错误:amount.currency必填字段缺失.
如果我传递一些值而不是0.00它正常工作,但我想发送零作为初始量.
谁能告诉我我的代码有什么问题?
c# paypal paypal-subscriptions paypal-sandbox paypal-rest-sdk
我们目前正在尝试使用 Paypal REST API 创建支付系统。因此我们需要使用Paypal指定的Payout API 。
有一个部分描述了付款项目可以具有的不同状态和返回代码:单击此处
我不清楚的是:
已阻止 - 该项目已被阻止。
问题是:
我尝试在进行简单付款时通过 webhooks 收到通知,但是我在指定的 URL 上没有收到来自 paypal 的任何请求。这是我所做的:
在开发人员仪表板中,如果我转到沙盒 -> 通知:“从测试买家收到付款通知”,则会收到付款,但不会调用我服务器上的 Webhook 页面。我知道这一点是因为每次调用页面时 php 脚本都会创建一个 txt 文件。另外,如果我转到开发者帐户 -> Webhook 通知并选择应用程序,我会收到以下消息:您没有所选应用程序的任何事件
注意:如果我在 webhook 模拟器中添加 URL,一切都会很好。
难道我做错了什么?我必须将应用程序与“立即购买”按钮连接起来吗?
谢谢
Windows 上的 ASP.Net Framework 4.5.2
\n\n我正在使用服务器端 REST配置与 paypal 的集成,我的代码与此https://github.com/paypal/PayPal-NET-SDK/blob/develop/Samples/Source/PaymentWithPayPal.aspx.cs相同,没有什么区别。
\n\n创建的支付模型是这样的:
\n\n{"intent":"sale","payer":{"payment_method":"paypal"},"transactions":[{"amount":{"currency":"USD","total":"100.00","details":{"subtotal":"75","shipping":"10","tax":"15"}},"description":"Transaction description.","invoice_number":"608961","item_list":{"items":[{"sku":"sku","name":"Item Name","quantity":"5","price":"15","currency":"USD"}]}}],"redirect_urls":{"return_url":"http://localhost:51379/PaymentWithPayPal.aspx?guid=60896","cancel_url":"http://localhost:51379/PaymentWithPayPal.aspx?guid=60896&cancel=true"}}\nRun Code Online (Sandbox Code Playgroud)\n\n我在这一行创建付款
\n\nvar createdPayment = payment.Create(apiContext);\nRun Code Online (Sandbox Code Playgroud)\n\n并且createdPayment变量等于:
\n\n{"id":"PAY-8TG15254J2564684XLFQUQHQ","intent":"sale","payer":{"payment_method":"paypal"},"transactions":[{"related_resources":[],"amount":{"currency":"USD","total":"100.00","details":{"subtotal":"75.00","shipping":"10.00","tax":"15.00"}},"description":"Transaction description.","invoice_number":"608961","item_list":{"items":[{"sku":"sku","name":"Item Name","quantity":"5","price":"15.00","currency":"USD"}]}}],"state":"created","create_time":"2017-07-08T21:01:18Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-8TG15254J2564684XLFQUQHQ","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-6PE445186E489192C","rel":"approval_url","method":"REDIRECT"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-8TG15254J2564684XLFQUQHQ/execute","rel":"execute","method":"POST"}]}\nRun Code Online (Sandbox Code Playgroud)\n\n之后,代码继续,没有任何错误,完成后,paypal 窗口关闭,我在 javascript 上收到下一个错误:\n 错误:没有值传递给付款
\n\nObject {stack: "Error: No value passed to payment\xe2\x86\xb5 at https://w\xe2\x80\xa6://www.paypalobjects.com/api/checkout.js:2390:13)", errtype: "[object Error]", timestamp: 1499547706746, windowID: "5148517b93", pageID: "510d0e1522"\xe2\x80\xa6} country:"US" env:"sandbox" errtype:"[object Error]" host:"www.sandbox.paypal.com" lang:"en" pageID:"510d0e1522" path:"/webapps/hermes/button" referer:"http://localhost:51379" stack:"Error: No value passed …Run Code Online (Sandbox Code Playgroud) 我对Node.js使用paypal-rest-sdk@1.8.1.我创建了付款并保存了他们的payerId,token和paymentId,但我从未执行过这些付款.
var paypal = require('paypal-rest-sdk');
paypal.configure({
'mode': 'live',
'client_id': '_CLIENT_ID_',
'client_secret': '_CLIENT_SECRET_'
});
.
.
let payment = {
"intent": "sale",
"transactions": [{
"item_list": {
"items": some_items_array,
"shipping_address": {
"recipient_name": "some_recipient_name",
"line1": "Fake street",
"city": "Fake city",
"country_code": "Fake country",
"postal_code": "123456",
"state": "Fake state",
"phone": "0000000"
}
},
"amount": {
"currency": "AUD",
"total": "15",
"details": {
"subtotal":"15",
"tax": "0",
"shipping": "0",
"handling_fee": "0",
"shipping_discount": "0",
"insurance": "0"
}
}
}],
"redirect_urls": {
"cancel_url": some_base_url + "/home/cart",
"return_url": some_base_url + …Run Code Online (Sandbox Code Playgroud) 其实我已经解决了这个问题,但是我花了一段时间才做到这一点,所以我决定花点时间写下这篇文章来帮助其他可能遇到同样问题的人。
我开始尝试通过 XMLHttpRequest 对象将 PayPal REST API 与 Firebase Functions 结合使用。根据PayPal 文档,这是我的代码(使用 XMLHttpRequest 对象模拟 cURL 命令):
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
// 1b. Point towards PayPal servers
const paypalOAuthAPI = 'https://api.sandbox.paypal.com/' +
'v1/oauth2/token/';
const paypalAuthAPI = 'https://api.sandbox.paypal.com/' +
'v2/payments/authorizations/';
// 1c. Get an access token from the PayPal API
const client = 'your-really-long-client-string-token';
const secret = 'your-really-long-client-secret-string-token';
const basicAuthString = client + ':' + secret;
const basicAuth = Base64.encode(basicAuthString);
const auth = new XMLHttpRequest();
auth.onload = () => { …Run Code Online (Sandbox Code Playgroud) javascript paypal xmlhttprequest paypal-rest-sdk google-cloud-functions
我按照有关如何使用 SDK API添加 PayPal ( https://developer.paypal.com/docs/checkout/integrate/ )的智能支付按钮的说明进行操作。一切工作正常,只是我无法在执行付款后重定向买家。
HTML页面中的JS代码如下所示:
paypal.Buttons({
createOrder: function (data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: price
}
}]
});
},
onApprove: async function (data, actions) {
return actions.order.capture().then(function (details) {
alert('success!');
return fetch('/paypal-transaction-complete', {
method: 'post',
headers: {
'content-type': 'application/json'
},
body: JSON.stringify({
orderID: data.orderID,
})
});
});
}
}).render('#paypal-button-container');
Run Code Online (Sandbox Code Playgroud)
在服务器端,我使用异步函数执行它,并使用箭头函数等待承诺:
app.post('/paypal-transaction-complete', function (req, res) {
paypalRequestHandler.handleRequest(req, res)
.then(() => {
res.redirect('/'); // not working
}).catch(err => {
console.log(err);
res.sendStatus(500);
});
});
Run Code Online (Sandbox Code Playgroud)
我想知道为什么它不重定向,我可以做像 console.log() …
我目前正在使用此代码通过 PayPal Express Checkout 在我的网站上接受付款。我使用“NO_SHIPPING”选项删除了运输字段。由于我销售数字商品,因此我还想删除帐单地址字段(名字、姓氏、邮政编码、电话、电子邮件)或至少删除其中任何字段。怎么做?
<script src="https://www.paypal.com/sdk/js?client-id={client-id}"></script>
<script>
render_paypal_button();
function render_paypal_button() {
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: 1.00
}
}],
application_context: {
shipping_preference: 'NO_SHIPPING'
}
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
});
}
}).render('#paypal-button-container');
</script>
Run Code Online (Sandbox Code Playgroud) paypal-rest-sdk ×10
paypal ×9
c# ×2
javascript ×2
node.js ×2
php ×2
android ×1
asp.net ×1
express ×1
payment ×1