Ich versuche, eine Batch-Auszahlung mit einem Test Sandbox-Konto zu erstellen. Die ‚create Zahlung‘ Funktion arbeitet absolut in Ordnung mit der richtigen Antwort:Paypal Batch-Auszahlung funktioniert nicht in Knoten js api
var paypal_sdk = require('paypal-rest-sdk');
var config_opts = {
'host': host, //host defined
'port':'',
'mode':'sandbox',
'client_id': client_id, //clientID defined
'client_secret': client_secret, //clientSecret defined
};
var makePayment = function (req, res, next) {
var create_payment_json = {
"intent": "sale",
"payer": {
"payment_method": "paypal"
},
"redirect_urls": {
"return_url": "http://mystore.in",
"cancel_url": "http://mystore.in/contact"
},
"transactions": [
{
"amount": {
"currency": "USD",
"total": "1.00"
},
"description": "This is the payment description."
}
]
};
paypal_sdk.payment.create(create_payment_json,config_opts, function (err, data) {
if (err) console.log("ERRRRR", err);
console.log("Create Payment Response");
console.log(data);
//res.send('201');
});
}
makePayment(); //CALLING THE FUNCTION
Aber, wenn ich versuche, eine neue Auszahlung zu erstellen, und bearbeite create_payment_json als:
var create_payment_json = {
"sender_batch_header": {
"email_subject": "You have a Payout!",
"recipient_type": "EMAIL"
},
"items": [
{
"recipient_type": "EMAIL",
"amount": {
"value": "1.0",
"currency": "USD"
},
"note": "Thanks for your patronage!",
"sender_item_id": "201403140001",
"receiver": "[email protected]"
}
]
};
Und Hauptfunktion als :
paypal_sdk.payout.create(create_payment_json,config_opts, function (err, data) {
if (err) console.log("ERRRRR", err);
console.log("Create Payment Response");
console.log(data);
//res.send('201');
});
ich einen Fehler erhalte wie folgt:
{ [Error: Response Status : 401]
response:
{ error: 'invalid_client',
error_description: 'Client Authentication failed',
httpStatusCode: 401 },
httpStatusCode: 401 }
Ich bin jedoch sicher, dass die Anmeldeinformationen korrekt sind und sie funktionieren perfekt im Falle der Zahlungserstellung. Ich mache das alles für die Prüfung zuerst. Außerdem ist die Auszahlungsfunktion für dieses Test-Paypal-Entwicklerkonto aktiviert.
Gibt es eine mögliche Lösung?