{"id":111,"date":"2023-02-21T09:09:49","date_gmt":"2023-02-21T09:09:49","guid":{"rendered":"https:\/\/blessingcr.com\/?p=111"},"modified":"2023-02-21T09:09:52","modified_gmt":"2023-02-21T09:09:52","slug":"%e5%8f%82%e8%80%83%e7%94%a8","status":"publish","type":"post","link":"https:\/\/blessingcr.com\/?p=111","title":{"rendered":"\u53c2\u8003\u7528"},"content":{"rendered":"\n<figure class=\"wp-block-embed\"><div class=\"wp-block-embed__wrapper\">\nhttps:\/\/demo.paypal.com\/us\/demo\/go_platform\/pcRestServerV2\/product\n<\/div><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"wiz-toc-1-1348383274\">\u63a5\u5165\u987a\u5e8f:<\/h1>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Get Access Token<br>\u540e\u7aef\u505a\uff0c\u62ff\u5230\u670d\u52a1\u7684token<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">POST https:\/\/api.sandbox.paypal.com\/v1\/oauth2\/token<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">header:{  \"PayPal-Request-Id\": \"platform-1670382693555\",  \"Authorization\": \"Basic QVRz****************************************************************************************************************************************************************************************************************akE=\"}<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">body :{<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">grant_type=client_credentials<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">}<\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Create Order<br>\u540e\u7aef\u505a\uff0c\u8ba1\u7b97\u91d1\u989d \u751f\u6210orderId<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">POST https:\/\/api.sandbox.paypal.com\/v2\/checkout\/orders<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">header:{  \"PayPal-Request-Id\": \"platform-1670382693941\",  \"Content-Type\": \"application\/json\",  \"cache-control\": \"no-cache\",  \"Authorization\": \"Bearer A21******************************************************************************************NPWQ\"}<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">body:{  \"intent\": \"CAPTURE\",  \"purchase_units\": [    {      \"reference_id\": \"PU1\",      \"description\": \"Camera Shop\",      \"invoice_id\": \"INV-CameraShop-1670382691590\",      \"custom_id\": \"CUST-CameraShop\",      \"amount\": {        \"currency_code\": \"USD\",        \"value\": 300,        \"breakdown\": {          \"item_total\": {            \"currency_code\": \"USD\",            \"value\": 300          }        }      },      \"items\": [        {          \"name\": \"DSLR Camera\",          \"description\": \"Black Camera - Digital SLR\",          \"sku\": \"sku01\",          \"unit_amount\": {            \"currency_code\": \"USD\",            \"value\": 300          },          \"quantity\": \"1\",          \"category\": \"PHYSICAL_GOODS\"        }      ]    }  ]}<\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Order Details<br>\u53ef\u9009<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">GET https:\/\/api.sandbox.paypal.com\/v2\/checkout\/orders\/2LS61083EB930562C<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">header:{  \"PayPal-Request-Id\": \"platform-1670382702710\",  \"Content-Type\": \"application\/json\",  \"Authorization\": \"Bearer A21******************************************************************************************NPWQ\"}<\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Patch Order<br>\u524d\u7aef\u505a \u7528\u6237\u6388\u6743<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">PATCH https:\/\/api.sandbox.paypal.com\/v2\/checkout\/orders\/2LS61083EB930562C<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">header: {  \"PayPal-Request-Id\": \"platform-1670382703115\",  \"Content-Type\": \"application\/json\",  \"Authorization\": \"Bearer A21******************************************************************************************NPWQ\"}<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">body:[  {    \"op\": \"replace\",    \"path\": \"\/purchase_units\/@reference_id=='PU1'\/amount\",    \"value\": {      \"currency_code\": \"USD\",      \"value\": 350,      \"breakdown\": {        \"item_total\": {          \"currency_code\": \"USD\",          \"value\": 300        },        \"shipping\": {          \"currency_code\": \"USD\",          \"value\": 20        },        \"tax_total\": {          \"currency_code\": \"USD\",          \"value\": 30        }      }    }  }]<\/pre>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Immediate Capture<br>\u540e\u7aef\u6536\u94b1<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">POST https:\/\/api.sandbox.paypal.com\/v2\/checkout\/orders\/2LS61083EB930562C\/capture\/<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">header:{  \"PayPal-Request-Id\": \"platform-1670382706795\",  \"Content-Type\": \"application\/json\",  \"Authorization\": \"Bearer A21******************************************************************************************NPWQ\"}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u63a5\u5165\u987a\u5e8f: POST https:\/\/api.sandbox.paypal.com\/v1\/oauth2\/tok [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[58],"class_list":["post-111","post","type-post","status-publish","format-standard","hentry","category-paypal","tag-paypal"],"_links":{"self":[{"href":"https:\/\/blessingcr.com\/index.php?rest_route=\/wp\/v2\/posts\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blessingcr.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blessingcr.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blessingcr.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blessingcr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111"}],"version-history":[{"count":1,"href":"https:\/\/blessingcr.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/blessingcr.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/blessingcr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blessingcr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blessingcr.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}