paypal / PayPal-node-SDK

node.js SDK for PayPal RESTful APIs
Other
1.28k stars 451 forks source link

AUTHORIZATION_ERROR #437

Closed techtic-harshad closed 4 years ago

techtic-harshad commented 4 years ago

I need to send money to other paypal account by email so, i have used payout.create method for this and its return

 { name: 'AUTHORIZATION_ERROR',
     message: 'Authorization error occurred.',
     debug_id: '8ce42890bcf30',
     information_link:
      'https://developer.paypal.com/docs/api/payments.payouts-batch/#errors',
     links: [],
     httpStatusCode: 403 }

so, can you please guide me how we can send amount to the other paypal account by email.

Is there any configuration that i need to apply on paypal for sandbox account(I'm created app using developer sandbox account).

prakash-gangadharan commented 4 years ago

Hi @techtic-harshad , can you give your code snippet and are you trying to integrate with payouts API. "sending amount to the other paypal account by email", is this your need?

techtic-harshad commented 4 years ago

@prakash-gangadharan

Yes(sending amount to the other paypal account by email), i have tried with below code and it returns AUTHORIZATION_ERROR

var sender_batch_id = Math.random().toString(36).substring(9);

            var create_payout_json = {
                "sender_batch_header": {
                    "sender_batch_id": sender_batch_id,
                    "email_subject": "About withdraw"
                },
                "items": [
                    {
                        "recipient_type": "EMAIL",
                        "amount": {
                            "value": 0.99,
                            "currency": "USD"
                        },
                        "receiver": ***@test.com,
                        "note": "Thank you."
                        // "sender_item_id": "item_3"
                    }
                ]
            };

            // var sync_mode = 'true';
            await this.paypal.payout.create(create_payout_json, function (error, payout) {
                if (error) {
                    console.log(error);
                    throw new ApolloError("something went wrong, please try after some time");
                } else {
                    //need to test with below function because not tested yet
                    return {
                        data : payout,
                        message: "Amount successfully sent to your PAYPAL account."
                    }
                }
            });
prakash-gangadharan commented 4 years ago

Prerequisite/basic requirements for a account to do Payouts.

To onboard a merchant to use Payouts, merchant must have

Hi @techtic-harshad, can you validate if the account which you used fulfill the above mentioned basic requirements?

Thanks! Prakash

techtic-harshad commented 4 years ago

@prakash-gangadharan currently i am using sandbox account so, its needed?

because we don't have actual account to work on.

prakash-gangadharan commented 4 years ago

@techtic-harshad yes, you can create create test accounts in sandbox.

techtic-harshad commented 4 years ago

@prakash-gangadharan

I have created APP for clientId and secretKey from sendbox account.

But, when i tried to call paypal.payout.create, it will return an error(mentioned in https://github.com/paypal/PayPal-node-SDK/issues/437#issuecomment-535013430).

techtic30naitik commented 4 years ago

How can we add the payout in sandbox paypal account, how we can we fill all the requirements to use payout in sandbox pay pal account.

prakash-gangadharan commented 4 years ago

Hi @techtic-harshad and @techtic30naitik , https://developer.paypal.com/docs/payouts/integrate/prerequisites/# -> this is the documentation on prerequisites. https://developer.paypal.com/docs/payouts/# -> this is for payouts.