PayPal Paid refund Refund Getaccesstoken

Source: Internet
Author: User
Tags curl

This is just to repeat the PHP code of PayPal's restful API curl way:


The following paragraph is the PayPal official given command line under the Get Access_token Curl method:

Curl Https://api.sandbox.paypal.com/v1/oauth2/token-H "Accept:application/json" \ H "Accept-language:en_us" \ U "E Oj2s-z6oon_le_ks1d75wsz6y0sfdvsy9183ivxfyzp:eclusmeuk8e9ihi7zdvlf5cz6y0sfdvsy9183ivxfyzp "\ d" grant_type=client _credentials "

Ps:-h is actually the header,

-U is the user name and password

-D is the data data that requires post

         $ch  = curl_init ();          $clientId  =  $this->client_id;        $ secret =  $this->secret;                 curl_setopt ($ch, curlopt_url,  "https://api.sandbox.paypal.com/v1/oauth2/ Token ");         curl_setopt ($ch,  curlopt_header, false);         curl_setopt ($ch,  curlopt_ssl_verifypeer, false);         curl_setopt ($ch,  curlopt_post, true);         curl_setopt ($ch,  curlopt_returntransfer, true);          curl_setopt ($ch, curlopt_userpwd,  $clientId. ":". $secret);       &nBsp; curl_setopt ($ch, curlopt_postfields,  "Grant_type=client_credentials");                  $result  = curl_exec ($ CH);                 if (Empty ($ Result) Die ("Error: no response.");         else        {              $json  = json_decode ($result);             print_r ($json);         }                 curl_close ($ch);d ie;

Okay, it's ready!

PS: About the code inside the client_id and secret is needed to create a PayPal developer site to create an app will have, not many statements, attached to the PayPal Developer's website: https://developer.paypal.com/docs/api/

This article from "for the Future" blog, declined reprint!

PayPal Paid refund Refund Getaccesstoken

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.