Search code examples
node.jspaypalpaypal-sandbox

PayPal how to get merchant ID after seller onboarding?


I want to do paypal merchant onboarding for my users. I use following code. As you can see i provided return_url and i expected to get from this url merchantId to save it to my database but after onboarding process i only see page with message to confirm my email confirm email. After confirmation of email, i redirected to only dashboard sandbox account

const data = {
            'tracking_id': 'testenterprices123122',
            'partner_config_override': {
                'return_url': 'https://vtx.uk',
            },
            'operations': [
                {
                    'operation': 'API_INTEGRATION',
                    'api_integration_preference': {
                        'rest_api_integration': {
                            'integration_method': 'PAYPAL',
                            'integration_type': 'THIRD_PARTY',
                            'third_party_details': {
                                'features': [
                                    'PAYMENT',
                                    'REFUND'
                                ]
                            }
                        }
                    }
                }
            ],
            'products': [
                'EXPRESS_CHECKOUT'
            ],
            'legal_consents': [
                {
                    'type': 'SHARE_DATA_CONSENT',
                    'granted': true
                }
            ]
        };

        const options = {
            url: 'https://api-m.sandbox.paypal.com/v2/customer/partner-referrals',
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Accept-Language': 'en_US',
                'Content-Type': 'application/json',
                'Authorization': 'Bearer ' + token
            },
        };
  axios(options).then(res => console.log(res.data)).catch(err => console.log(err));

I tried to use trackingId field to get after that my merchant information. I used following code but it gives me error RESOURCE_NOT_FOUND. And i tried to get webhooks, for example event after merchant onboard but it is not working, just no response

const options = {
             url: 'https://api-m.sandbox.paypal.com/v1/customer/partners/partner_id/merchant-integrations?tracking_id={tracking_id}',
             method: 'GET',
             headers: {
                 'Accept': 'application/json',
                 'Accept-Language': 'en_US',
                 'Authorization': 'Bearer ' + token
             },
         };
axios(options).then(res => console.log(res.data)).catch(err => console.log(err));

Solution

  • Use the Show referral data GET API call, example from the documentation

    curl -v -X GET https://api-m.sandbox.paypal.com/v2/customer/partner-referrals/ZjcyODU4ZWYtYTA1OC00ODIwLTk2M2EtOTZkZWQ4NmQwYzI3RU12cE5xa0xMRmk1NWxFSVJIT1JlTFdSbElCbFU1Q3lhdGhESzVQcU9iRT0=
    -H "Content-Type: application/json"
    -H "Authorization: Bearer "