{"id":854,"date":"2021-06-18T18:28:07","date_gmt":"2021-06-18T17:28:07","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=854"},"modified":"2021-06-18T22:05:17","modified_gmt":"2021-06-18T21:05:17","slug":"paypal-rest-api-get-token","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/paypal-rest-api-get-token\/","title":{"rendered":"Paypal REST API get token"},"content":{"rendered":"<p><strong>Request URL<br \/>\n<\/strong>https:\/\/api-m.paypal.com\/v1\/oauth2\/token<\/p>\n<p><strong>Method<br \/>\n<\/strong>Post<\/p>\n<p><strong>Headers<br \/>\n<\/strong><span style=\"color: #0000ff;\">Authorization:<\/span> Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u00a0 <span style=\"color: #99cc00;\"><em>\/\/ xxxxxxxxxxxxxxxx\u00a0 is base64 encoded <strong>Client ID:Secret\u00a0 <\/strong> \/\/ base64_encode(client_id_string:client_secret_string) &#8211; note the colon in between<br \/>\n<\/em><\/span><\/p>\n<p><strong>Body<br \/>\n<\/strong><span style=\"color: #0000ff;\">grant_type:<\/span>client_credentials<\/p>\n<p><strong>Return<\/strong><\/p>\n<pre class='wp-code-highlight prettyprint'>\r\n{\r\n\r\n\"scope\": \"https:\/\/uri.paypal.com\/services\/invoicing https:\/\/uri.paypal.com\/services\/disputes\/read-buyer https:\/\/uri.paypal.com\/services\/payments\/realtimepayment https:\/\/uri.paypal.com\/services\/disputes\/update-seller https:\/\/uri.paypal.com\/services\/payments\/payment\/authcapture openid https:\/\/uri.paypal.com\/services\/disputes\/read-seller https:\/\/uri.paypal.com\/services\/payments\/refund https:\/\/api.paypal.com\/v1\/vault\/credit-card https:\/\/api.paypal.com\/v1\/payments\/.* https:\/\/uri.paypal.com\/payments\/payouts https:\/\/api.paypal.com\/v1\/vault\/credit-card\/.* https:\/\/uri.paypal.com\/services\/subscriptions https:\/\/uri.paypal.com\/services\/applications\/webhooks\",\r\n\"<span style=\"color: #0000ff;\">access_token<\/span>\": \"<span style=\"color: #993366;\"><em>AYYYYYYYYYYWmTopNAjV__Yuk_6AP9RZWQpzxxxxxxxxxxxxxx1ifvHLHrE6RW_Zqjbieo3jcZr9999999999999999lyDA<\/em><\/span>\",\r\n\"token_type\": \"Bearer\",\r\n\"app_id\": \"APP-XYXYXYXYXYXYCCCC\",\r\n\"<span style=\"color: #0000ff;\">expires_in<\/span>\": <em><span style=\"color: #993366;\">32400<\/span><\/em>,\r\n\"nonce\": \"2021-06-18T16:42:YUKJUKJHTGTYJKHGRRFHFHFGFGBFBG-spy-N9iguUHTJbTgVjht\"\r\n\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Request URL https:\/\/api-m.paypal.com\/v1\/oauth2\/token Method Post Headers Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\u00a0 \/\/ xxxxxxxxxxxxxxxx\u00a0 is base64 encoded Client ID:Secret\u00a0 \/\/ base64_encode(client_id_string:client_secret_string) &#8211; note the colon in between Body grant_type:client_credentials Return { &#8220;scope&#8221;: &#8220;https:\/\/uri.paypal.com\/services\/invoicing https:\/\/uri.paypal.com\/services\/disputes\/read-buyer https:\/\/uri.paypal.com\/services\/payments\/realtimepayment https:\/\/uri.paypal.com\/services\/disputes\/update-seller https:\/\/uri.paypal.com\/services\/payments\/payment\/authcapture openid https:\/\/uri.paypal.com\/services\/disputes\/read-seller https:\/\/uri.paypal.com\/services\/payments\/refund https:\/\/api.paypal.com\/v1\/vault\/credit-card https:\/\/api.paypal.com\/v1\/payments\/.* https:\/\/uri.paypal.com\/payments\/payouts https:\/\/api.paypal.com\/v1\/vault\/credit-card\/.* https:\/\/uri.paypal.com\/services\/subscriptions https:\/\/uri.paypal.com\/services\/applications\/webhooks&#8221;, &#8220;access_token&#8221;: &#8220;AYYYYYYYYYYWmTopNAjV__Yuk_6AP9RZWQpzxxxxxxxxxxxxxx1ifvHLHrE6RW_Zqjbieo3jcZr9999999999999999lyDA&#8221;, &#8220;token_type&#8221;: &#8220;Bearer&#8221;, &#8220;app_id&#8221;: &#8220;APP-XYXYXYXYXYXYCCCC&#8221;, &#8220;expires_in&#8221;: 32400, &#8220;nonce&#8221;: &#8220;2021-06-18T16:42:YUKJUKJHTGTYJKHGRRFHFHFGFGBFBG-spy-N9iguUHTJbTgVjht&#8221; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3],"tags":[317,318],"class_list":["post-854","post","type-post","status-publish","format-standard","hentry","category-miscellaneous","category-php","tag-paypal","tag-paypal-rest-api","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/comments?post=854"}],"version-history":[{"count":2,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/854\/revisions"}],"predecessor-version":[{"id":860,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/854\/revisions\/860"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}