Create Merchant Account Via REST API gives "Caller is not authorized to access this resource"

elitu
Contributor
Contributor

Hi,

I'm trying to create a merchant-acount as a part of the managed onboarding i'm trying to implement on my rails driven backend.

Sending (PaypalHelper::get_data is your sample data from the documentation) : 

app_data = RestClient.post "https://api.sandbox.paypal.com/v1/customer/partners/merchant-accounts",PaypalHelper::get_data,{'Content-Type'=>'application/json','Authorization' => "Bearer #{token.token}"}

Gives the following response:

{"name"=>"AUTHORIZATION_ERROR", "message"=>"Caller is not authorized to access this resource", "debug_id"=>"e99fb3863d586"}

My sandbox client_id that i'm using is : 

AYoNOFFlU-iUHH2_2uOOMOAOL_mCysHHQpkMu_TtgkekKq515Q32-qfuokWprr9sBfow1D_fsj4AuvBY

Please help.

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

MTS_Justin
Moderator
Moderator
If your receiving the message "account with this email address already exists", then there is already an account under that email address. This can be due to duplicate requests in quick succession.

I've tested the account creation process today and using a unique email address the account is created. If I submit a second request quickly after the first, I receive the same message that your seeing.

Was my post helpful? If so, please give me a kudos!

View solution in original post

Login to Me Too
13 REPLIES 13

MTS_Justin
Moderator
Moderator
Hi @elitu

I've made changes to your REST application.

Please re-attempt the API request and advise of any issues.

Was my post helpful? If so, please give me a kudos!
Login to Me Too

elitu
Contributor
Contributor

Thanks but now the response is:

{"partner_merchant_external_id"=>"abc123", "errors"=>[{"name"=>"FORBIDDEN", "message"=>"Access Forbidden Error", "debug_id"=>"b1a83332236f0", "details"=>[{"issue"=>"Partner account does not have account management permission"}]}], "links"=>[{"href"=>"https://api.sandbox.paypal.com/v1/customer/partners/merchant-accounts", "rel"=>"create", "method"=>"POST"}]}

 

Where should i setup the partner account permissions?

Login to Me Too

MTS_Justin
Moderator
Moderator
Please try it again now and let me know the outcome !

Was my post helpful? If so, please give me a kudos!
Login to Me Too

elitu
Contributor
Contributor

Hi,

i'm getting the exact same result:

{"partner_merchant_external_id"=>"abc123", "errors"=>[{"name"=>"FORBIDDEN", "message"=>"Access Forbidden Error", "debug_id"=>"d48c5ea654df", "details"=>[{"issue"=>"Partner account does not have account management permission"}]}], "links"=>[{"href"=>"https://api.sandbox.paypal.com/v1/customer/partners/merchant-accounts", "rel"=>"create", "method"=>"POST"}]} 
Login to Me Too

MTS_Justin
Moderator
Moderator
Hello,

Please try one more time.

If the issue persists, can you share the client secret that is associated with this sandbox client id so I can run some test requests from here ?

It goes without saying, we would of course never ask for production credentials, but in the interest of troubleshooting this sandbox issue it would be easier if I had the credentials and could submit requests whilst also being able to modify account settings as required.

Was my post helpful? If so, please give me a kudos!
Login to Me Too

elitu
Contributor
Contributor

Hi,

something is changed, but it still not working.

Using the following data:

 

data={}
      data[:account_status]="A"
      data[:account_currency]="USD"
      data[:account_relations]=[]
      data[:account_relations][0]={}
      data[:account_relations][0][:type]="PARTNER"
      data[:owner_info]={}
      data[:owner_info][:date_of_birth]="1990-01-01"
      data[:owner_info][:email]="bla23lfu - at - bla.com"
      data[:owner_info][:name]={}
      data[:owner_info][:name][:prefix]="Mr"
      data[:owner_info][:name][:given_name]="Eli"
      data[:owner_info][:name][:surname]="tu"
      data[:owner_info][:addresses]=[]
      data[:owner_info][:addresses][0]={}
      data[:owner_info][:addresses][0][:type]="HOME"
      data[:owner_info][:addresses][0][:line1]="200 Broadway Av"
      data[:owner_info][:addresses][0][:city]="Bestcity"
      data[:owner_info][:addresses][0][:state]="New York"
      data[:owner_info][:addresses][0][:country_code]="AU"
      data[:business_info]={}
      data[:business_info][:merchant_category_code]="3011"
      data[:business_info][:type]="ASSOCIATION"
      data[:business_info][:sub_type]="ASSO_TYPE_INCORPORATED"
      data[:business_info][:customer_service]={}
      data[:business_info][:customer_service][:email]="service -at- bla.com"
      data[:business_info][:phones]=[]
      data[:business_info][:phones][0]={}
      data[:business_info][:phones][0][:type]="WORK"
      data[:business_info][:phones][0][:country_code]="61"
      data[:business_info][:phones][0][:national_number]="0491570156"
      data[:business_info][:phones][0][:extension_number]="123"
      data[:business_info][:addresses]=[]
      data[:business_info][:addresses][0]={}
      data[:business_info][:addresses][0][:type]="WORK"
      data[:business_info][:addresses][0][:line1]="200 Broadway Av"
      data[:business_info][:addresses][0][:city]="Ashdod"
      data[:business_info][:addresses][0][:state]="Israel"
      data[:business_info][:addresses][0][:country_code]="AU"
      data[:business_info][:addresses][0][:postal_code]="5054"
      data[:business_info][:names]=[]
      data[:business_info][:names][0]={}
      data[:business_info][:names][0][:type]="LEGAL"
      data[:business_info][:names][0][:name]="Monkeytech LTD"

      data[:loginable]=false
      data[:partner_merchant_external_id]="mzz123"
      data[:timezone]="Australia/Adelaide"
      data[:partner_tax_reporting]=true

gives me (please notice the weired field identifier):

 

{"partner_merchant_external_id"=>"mzz123", "errors"=>[{"name"=>"VALIDATION_ERROR", "message"=>"Input Validation Error", "debug_id"=>"56b53d9fd3aa8", "details"=>[{"field"=>"#", "issue"=>"Invalid field value."}]}], "links"=>[{"href"=>"https://api.sandbox.paypal.com/v1/customer/partners/merchant-accounts", "rel"=>"create", "method"=>"POST"}]} 

going back to the hardcoded json from your documentation example gives me :

[{"field"=>"#/owner_info/email", "issue"=>"Account with this email address already exists. Please use the PATCH link to update the account information."}], "links"=>[{"href"=>"https://api.sandbox.paypal.com/v1/customer/partners/merchant-accounts/WHNNPDGCLLE86", "rel"=>"edit", "method"=>"PATCH"}, {"href"=>"https://api.sandbox.paypal.com/v1/customer/partners/merchant-accounts/WHNNPDGCLLE86", "rel"=>"replace", "method"=>"POST"}]}]} 

for every email address 😮

 

please help...

Login to Me Too
Solved

MTS_Justin
Moderator
Moderator
If your receiving the message "account with this email address already exists", then there is already an account under that email address. This can be due to duplicate requests in quick succession.

I've tested the account creation process today and using a unique email address the account is created. If I submit a second request quickly after the first, I receive the same message that your seeing.

Was my post helpful? If so, please give me a kudos!
Login to Me Too

elitu
Contributor
Contributor

Thanks alot!

I'm getting 201 now 🙂

Login to Me Too

carlosbakery123
New Community Member

Can you please let me know, how is the issue fixed. I am also facing same issue. thanks in advance.

 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.