Paypal

새글쓰기

Paypal
Build Modern Commerce with PayPal Get an Access-Token and Go on payment Client ID와 Secret를 적용한 질의 > -H "Accept-Language: en_US" \ > -u "Aaa6bBAPUZTOPAWLJy1E28dcVXA6a7v-MfajSO_o8v-JBZV76v67wjzE2-rB:EB4OYhCD2-TreOX8_oWtk2aJsgySeiXlln_Mevmm1NikSbQg5JtwgaT6p7HP" \ > -d "grant_type=client_credentials" 응답을 통해 Access-Token 취득 {"scope":"https://api.paypal.com/v1/payments/.* https://uri.paypal.com/services/invoicing openid https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks https://api.paypal.com/v1/vault/credit-card","access_token":"A21AAInC_vEsh3zjuo9akCVJ6EgA0Mazimmmu9GWqGkz3-FmXelU4j1wlHPPOHaWbj44qCdzM8E6eQ9ipyVPOzOWfnvB4hNQw","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":32400,"nonce":"2021-10-14T13:08:20ZdvWAwLoi6VFt9cPfIATAKCuUTNOcvjwY1CL3zpLkq50"}BYUNGILs-Mac-mini:~ byungillee$ clear Access-Token을 적용한 질의 curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AAInC_vEsh3zjuo9akCVJ6EgA0Mazimmmu9GWqGkz3-FmXelU4j1wlHPPOHaWbj44qCdzM8E6eQ9ipyVPOzOWfnvB4hNQw" \ -d '{ "intent": "CAPTURE", "purchase_units": [ { "amount": { "currency_code": "USD", "value": "100.00" } } ] }' 응답 : id와 주소 {"id":"48A25269886843243","status":"CREATED","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/48A25269886843243","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=48A25269886843243","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/48A25269886843243","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/48A25269886843243/capture","rel":"capture","method":"POST"}]} Payment Expereience Web Profiles API 질의 curl -v -X GET https://api-m.sandbox.paypal.com/v1/payment-experience/web-profiles \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AAInC_vEsh3zjuo9akCVJ6EgA0Mazimmmu9GWqGkz3-FmXelU4j1wlHPPOHaWbj44qCdzM8E6eQ9ipyVPOzOWfnvB4hNQw" 응답 : id가 보인다 [{"id":"XP-KEAG-24QY-BUTA-CGCH","name":"20b886e6-22e7-43ab-98e9-6a2348addd2a","temporary":false,"input_fields":{"no_shipping":1,"address_override":0},"presentation":{"brand_name":"PayPal .NET SDK","logo_image":"https://raw.githubusercontent.com/wiki/paypal/PayPal-NET-SDK/images/homepage.jpg","locale_code":"US"}},{"id":"XP-8DW2-JDHW-ET8K-9WNY","name":"cc247090-1dc8-4df7-b6c6-b2b4cb4fe65c","temporary":false,"input_fields":{"no_shipping":1,"address_override":0},"presentation":{"brand_name":"PayPal .NET SDK","logo_image":"https://raw.githubusercontent.com/wiki/paypal/PayPal-NET-SDK/images/homepage.jpg","locale_code":"US"}},{"id":"XP-W6UW-A4LV-Z2YT-NA3E","name":"1c51b59a-9260-4356-b061-06b49186d8af","temporary":false,"input_fields":{"no_shipping":1,"address_override":0},"presentation":{"brand_name":"PayPal .NET SDK","logo_image":"https://raw.githubusercontent.com/wiki/paypal/PayPal-NET-SDK/images/homepage.jpg","locale_code":"US"}},{"id":"XP-2Z9G-3FHQ-6NN8-3LHV","name":"7b32845d-f828-4c85-84f7-bcb2747f6e20","temporary":false,"input_fields":{"no_shipping":1,"address_override":0},"presentation":{"brand_name":"PayPal .NET SDK","logo_image":"https://raw.githubusercontent.com/wiki/paypal/PayPal-NET-SDK/images/homepage.jpg","locale_code":"US"}}] 질의:위 id를 PayPal-Request-Id에 넣는다 curl -v -X POST https://api-m.sandbox.paypal.com/v1/payment-experience/web-profiles/ \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AAInC_vEsh3zjuo9akCVJ6EgA0Mazimmmu9GWqGkz3-FmXelU4j1wlHPPOHaWbj44qCdzM8E6eQ9ipyVPOzOWfnvB4hNQw" \ -H "PayPal-Request-Id: XP-KEAG-24QY-BUTA-CGCH" \ -d '{ "name": "exampleProfile", "presentation": { "logo_image": "https://example.com/logo_image/" }, "input_fields": { "no_shipping": 1, "address_override": 1 }, "flow_config": { "landing_page_type": "billing", "bank_txn_pending_url": "https://example.com/flow_config/" } }' 응답 : 그에 대한 응답이 왔다. {"id":"XP-9WZU-Q782-UCAH-SPHR","name":"exampleProfile","temporary":false,"flow_config":{"landing_page_type":"billing","bank_txn_pending_url":"https://example.com/flow_config/"},"input_fields":{"no_shipping":1,"address_override":1},"presentation":{"logo_image":"https://example.com/logo_image/"}} curl -v -X DELETE https://api-m.sandbox.paypal.com/v1/payment-experience/web-profiles/XP-KEAG-24QY-BUTA-CGCH \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AAInC_vEsh3zjuo9akCVJ6EgA0Mazimmmu9GWqGkz3-FmXelU4j1wlHPPOHaWbj44qCdzM8E6eQ9ipyVPOzOWfnvB4hNQw"

[?]PayPal결제 - 어떤 결제 방법을 쓸 것인가? Checkout Express or DirectPayment or Express Checkout via Braintree SDK Credentials
Generate Braintree SDK Credentials To test your PayPal Checkout integration in the sandbox, use the Braintree SDK and our set up instructions. To go live follow these steps. ×CloseYou cannot generate Braintree SDK sandbox access tokens because you do not have a sandbox Business account in a supported country. To generate a Braintree SDK sandbox access token, create a sandbox Business account in one of the following countries: AU,CA,GB,FR,IT,SG,JP,DE,US,IN,C2,HK,BE,CY,CZ,ES,FI,GR,HU,IL,NL,RU,AE,BH,EG,IE,JO,KE,KW,MA,MU,OM,PL,PT,QA,SA,SE,SN,ZA,AD,AE,AL,AT,BA,BG,BW,CH,DK,DZ,EE,FO,GE,GF,GI,GL,GP,HR,ID,IS,KZ,LI,LS,LT,LU,LV,MC,MD,MQ,MT,MW,MY,MZ,NC,NO,PF,PH,RE,RO,RS,SC,SI,SK,SM,TH,TW,VN,FJ,NZ,PW,KR,AG,AR,BS,BB,BZ,BM,KY,CL,CO,CR,DM,DO,EC,SV,GD,GT,HN,JM,NI,PA,PE,KN,LC,TT,TC,UY,VE,BR,MX 드디어 KR이 있다. 따라서 Braintree SDK Credentials를 할 수 있다.

Create a business sandbox account
sandbox business account create Log in to the Developer Dashboard and navigate to the Sandbox>>Accounts page. Click Create Account. Set the Account Type to Business. Select a Country. Click Create Account. First name: John Last name: Doe Email ID: sb-nmhah6142486@business.example.com System Generated Password: 96?k6*PP Password: Change password Note: If your system generated password is changed, your new password will not be displayed because of one-way password encryption. Phone Number: 8272375577 Account type: Business Account ID: KPRJE5YFCHGGS Status: Verified Country: KR Notes: --- First name: Peter Last name: Lee Email ID: peter@barreinabag.com System Generated Password: 96?k6*PP Password: Aa1352~2! Change password Note: If your system generated password is changed, your new password will not be displayed because of one-way password encryption. Phone Number: 8272375577 Account type: Business Account ID: KPRJE5YFCHGGS Status: Verified Country: KR Notes: --- Username: sb-nmhah6142486_api1.business.example.com Password: S5F6DF5PYQXMJS95 Signature: Amj11P-ZiEOuMtfH3Yq6xrOXDMBmA7qeOHQoxdTDbkvqqjyd9sI7BEsz Bank Account Account Number: 957281800894 Routing Number: 21 Credit Card Credit Card Number: 4119048124648030 Credit Card Type: VISA Expiration Date: 06/2026 PayPal Balance: 5000.00 USD

[?] Bearer Access-Token of REST APIs / API Requests
https://developer.paypal.com/docs/api/reference/get-an-access-token/ Your access token authorizes you to use the PayPal REST API server. To call a REST API in your integration, exchange your client ID and secret for an access token in an OAuth 2.0 token call. While there are a few ways to get a token, here are examples using both the Postman app and a cURL command. METHOD cURL curl -v https://api-m.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "client_id:secret" \ -d "grant_type=client_credentials" Client ID Aaa6bBAPUZTOPAWLJy1E28dcVXA6a7v-MfajSO_o8v-JBZV76v67wjzE2-rB Secret EB4OYhCD2-TreOX8_oWtk2aJsgySeiXlln_Mevmm1NikSbQg5JtwgaT6p7HP Client ID ASwXbvgN0cHc5Gzp7kQkThmid2cp33HSdbsq9Q8N2HvhsGlqIjy-cNfr2XVQPa1u1Z8yq3Irq6yPoDKA:ECy0eAVjNcotJUTumywnC5JYqWgvOXbyh07scX4zu8XxkrOxyV0FK7vj-x7zDQeRsL-G4gk32qVwOWtI Secret ECy0eAVjNcotJUTumywnC5JYqWgvOXbyh07scX4zu8XxkrOxyV0FK7vj-x7zDQeRsL-G4gk32qVwOWtI curl -v https://api-m.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "ASwXbvgN0cHc5Gzp7kQkThmid2cp33HSdbsq9Q8N2HvhsGlqIjy-cNfr2XVQPa1u1Z8yq3Irq6yPoDKA:ECy0eAVjNcotJUTumywnC5JYqWgvOXbyh07scX4zu8XxkrOxyV0FK7vj-x7zDQeRsL-G4gk32qVwOWtI " \ -d "grant_type=client_credentials"

[?] nonce
Payment Method Nonces A payment method nonce is a secure, one-time-use reference to payment information. It's the key element that allows your server to communicate sensitive payment information to Braintree without ever touching the raw data.

[성공] Get an access token in C# / paypal get access token c#
[1] 검색어 paypal access token in C#로 구글링해 아래 주소를 얻고 https://stackoverflow.com/questions/48838108/c-sharp-paypal-acess-token-does-not-return-anything-although-connection-is-ok 코드 HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://api.sandbox.paypal.com/v1/oauth2/token"); request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(clientId + ":" + clientSecret)); request.Accept = "application/json"; request.Headers.Add("Accept-Language", "en_US"); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.Timeout = 10000; byte[] postBytes = Encoding.ASCII.GetBytes("grant_type=client_credentials"); Stream postStream = request.GetRequestStream(); postStream.Write(postBytes, 0, postBytes.Length); postStream.Flush(); postStream.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 에서 request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(clientId + ":" + clientSecret)); 를 힌트로 얻어 [2] https://developer.paypal.com/docs/business/get-started/ Get API credentials for an access token cURL방법에서 curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "CLIENT_ID:SECRET" \ -d "grant_type=client_credentials" 를 [3] Converting - Convert Curl to Http Request at the site [https://reqbin.com/req/csharp/c-w7oitglz/convert-curl-to-http-request] var url = "https://api-m.sandbox.paypal.com/v1/oauth2/token"; var httpRequest = (HttpWebRequest)WebRequest.Create(url); httpRequest.Method = "POST"; httpRequest.Accept = "application/json"; httpRequest.Headers["Accept-Language"] = "en_US"; httpRequest.ContentType = "application/x-www-form-urlencoded"; httpRequest.Headers["Authorization"] = "Basic Q0xJRU5UX0lEOlNFQ1JFVA=="; var data = "grant_type=client_credentials"; using (var streamWriter = new StreamWriter(httpRequest.GetRequestStream())) { streamWriter.Write(data); } var httpResponse = (HttpWebResponse)httpRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); } Console.WriteLine(httpResponse.StatusCode); 를 얻고 [1]에서 얻은 힌트를 Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(clientId + ":" + clientSecret));를 [Converting] 한 httpRequest.Headers["Authorization"] = "Basic Q0xJRU5UX0lEOlNFQ1JFVA=="; 에 httpRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(clientId + ":" + clientSecret)); 와 같이 적용한 후 이것을 코딩한 페이지 paypalGetAccessToken, https://www.tanz.co.kr/PaymentMethod/paypal/paypalGetAccessToken.aspx 를 실행하고 [4] 응답 아래 {"scope":"https://api.paypal.com/v1/payments/.* https://uri.paypal.com/services/invoicing openid https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks https://api.paypal.com/v1/vault/credit-card","access_token":"A21AALEjJfzsP2I_4bDmfnEPDvGUIiGr2RUtyZualjU3goTnMODZN318Fu-nTqCA52Y-2tDl4h66Clr9M4jAjECkYMHTA1-9A","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":31506,"nonce":"2021-10-29T01:04:20Zb0S6HInaHpplfDEeBbH-fWUFmR3T5pDfqopOUPaoJ7o"}OK 와 같은 결과값을 얻었다. 성공이다. [이전의 과정들] Access Token을 얻는다는 것이 무언지, 그리고 Access Token 이전에 [1]PayPal에 비지니스 계정으로 가입해 내 쇼핑몰에 페이발 구매하기 버튼을 달려면 사전에 [2]Get API credentials해야하고 그 후 이 [3] credentials로 Exchange your API credentials for an access token 하고 그 다음에 드디어 [4] access payments and make payments를 하게 된다는 전체 과정에 대한 개요를 감잡았다. [1]과정에서 얻은 credentials이다. CLIENT_ID : Aaa6bBAPUZTOPAWLJy1E28dcVXA6a7v-MfajSO_o8v-JBZV76v67wjzE2-rB SECRET : EB4OYhCD2-TreOX8_oWtk2aJsgySeiXlln_Mevmm1NikSbQg5JtwgaT6p7HP [2]과정 Get an access token POSTMAN과 cURL 두 가지 다 해 보았다. 그 결과 Access Token을 확인할 수 있었다. Your access token authorizes you to use the PayPal REST API server. To call a REST API in your integration, exchange your client ID and secret for an access token in an OAuth 2.0 token call. While there are a few ways to get a token, here are examples using both the Postman app and a cURL command. In the Postman app, complete the following: Set the verb to POST. Enter https://api-m.sandbox.paypal.com/v1/oauth2/token as the request URL. Select the Authorization tab. From the TYPE list, select Basic Auth. In the Username field, enter your client ID. In the Password field, enter your secret. Select the Body tab. Select the x-www-form-urlencoded option. In the KEY field, enter grant_type. In the VALUE field, enter client_credentials. Select Send. cURL Copy the following code and modify it. curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "CLIENT_ID:SECRET" \ -d "grant_type=client_credentials" curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "Aaa6bBAPUZTOPAWLJy1E28dcVXA6a7v-MfajSO_o8v-JBZV76v67wjzE2-rB:EB4OYhCD2-TreOX8_oWtk2aJsgySeiXlln_Mevmm1NikSbQg5JtwgaT6p7HP" \ -d "grant_type=client_credentials" Change CLIENT_ID to your client ID. Change SECRET to your secret. [?]이건언제사용하는건지모르겠다. access_token$sandbox$yppkcfhk4cbcjt2m$0ed54ec481244716c0db469f70b3e601 아래는 또 다른 앱의 credential(CLIENT_ID, SECRET) A21AALxfHGstIcMrmL7uHh4TdubPt_cpJIhtfhrkYYDrHJTl-VlL4KSStkYhWe0jDREu6Yd6hkiSZVRuJ5tR2QFN7pFy5J_nQ A21AAJRMWHPvnlwONNDOOKjZHWPmB9N7qdih2MqdDZvwKuM3ZAuYKPlm5UT6bYVCh1UEt_dc81MbO8GfAeDw0ahTdF_Pev_Hg Make REST API calls In REST API calls, include the URL to the API service for the environment: Sandbox: https://api-m.sandbox.paypal.com Live: https://api-m.paypal.com [3] Access Token 얻은 값 생략 ( 위 [4] 참고) [4] access payments and make payments 하는 코드다 Bearer 뒤에 붙은 것이 ACCESS TOKEN이다 [1], [2] 과정으로 얻은 curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AALxfHGstIcMrmL7uHh4TdubPt_cpJIhtfhrkYYDrHJTl-VlL4KSStkYhWe0jDREu6Yd6hkiSZVRuJ5tR2QFN7pFy5J_nQ" \ -d '{ "intent": "CAPTURE", "purchase_units": [ { "amount": { "currency_code": "USD", "value": "100.00" } } ] }'

sandbox.paypal.com
SANDBOX Accounts personal tanzkorea-buyer@gmail.com a13~2 tanzkorea-personal@gmail.com Aa13~2! 이 두 개의 계정으로 물건 사는 것 테스트하고 sandbox.paypal.com으로 가서 결과를 볼 것

Access payments and make payments
Access Token을 적은 payment REST API를 날리자!

Return JSON 값 이해
paypalGetAccessToken 얻기 {"scope":"https://api.paypal.com/v1/payments/.* https://uri.paypal.com/services/invoicing openid https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks https://api.paypal.com/v1/vault/credit-card","access_token":"A21AALEjJfzsP2I_4bDmfnEPDvGUIiGr2RUtyZualjU3goTnMODZN318Fu-nTqCA52Y-2tDl4h66Clr9M4jAjECkYMHTA1-9A","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":29331,"nonce":"2021-10-29T01:04:20Zb0S6HInaHpplfDEeBbH-fWUFmR3T5pDfqopOUPaoJ7o"}OK paypalPay 결제 {"scope":"https://api.paypal.com/v1/payments/.* https://uri.paypal.com/services/invoicing openid https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/applications/webhooks https://api.paypal.com/v1/vault/credit-card","access_token":"A21AALrHdQKtVqR1m5sVacZezqRxU8qVYo7Ic_fe_cRUGhcgw8Dilh5qzK4AJx7MB-j7lB4THgsRFLLcM-aBuNNXFSaf5qfjg","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":32162,"nonce":"2021-10-29T02:09:21ZEKtcBJFqmj_LEcMXFtRjmwRendcbuBfb6SLxvOQi67o"}{"id":"10T9658889238383V","status":"CREATED","links":[{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/10T9658889238383V","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=10T9658889238383V","rel":"approve","method":"GET"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/10T9658889238383V","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v2/checkout/orders/10T9658889238383V/capture","rel":"capture","method":"POST"}]}Created

[질문]상점으로 최종 리턴하는 페이지 설정은? https://www.sandbox.paypal.com/businessmanage/preferences/website
Return URL- Users are redirected to this URL after live transactions. Allow up to three hours for the change to take effect. https://www.tanz.co.kr/PaymentMethod/paypal/paypalCompleted.aspx 웹사이트 결제 시 자동 돌아가기 웹사이트 결제 시 자동 돌아가기를 설정하면 결제가 완료된 직후 구매자에게 웹사이트가 다시 표시됩니다. 자동 돌아가기는 "바로 구매" 결제, 기부, 정기결제, 쇼핑 카트 결제 등 PayPal 웹사이트 결제 시 적용됩니다. 돌아가기 URL 요건: 결제 후 고객을 리디렉션하는 데 사용할 URL을 입력하세요. 이 URL은 아래 설명된 지침을 충족해야 합니다. 사용자 계약에 따라, 돌아가기 URL로 표시되는 페이지에서 결제가 이루어졌고 거래가 완료되었음을 구매자에게 설명해야 합니다. 돌아가기 URL로 표시되는 페이지에서 결제 거래 세부정보를 구매자에게 이메일로 보낸다는 것을 설명해야 합니다. 예: 결제해 주셔서 감사합니다. 거래가 완료되었으며 이메일로 구매 영수증을 보냈습니다. 거래 세부정보를 보려면 PayPal 계정에 로그인하세요. 자동 돌아가기 참고: 자동 돌아가기를 끄면 결제 데이터 전송 기능이 비활성화됩니다. 사용 돌아가기 URL https://www.tanz.co.kr/PaymentMethod/paypal/paypalCompleted.aspx

한국에서 페이팔 결제 연동 테스트
페이팔 가맹점입니다. 쇼핑몰 구축하고 페이팔 checkout 결제연동 중입니다. access_token 으로 Make REST API calls 를 하여 id, status, links를 받고 links에서 approve주소를 redirect해 결제창을 띠운 후 sandbox personal account로 결제를 진행하고 있는데 continue가 되지 않습니다. 결제창까지 떴는데 최종 결제가 이루어지지 않고 그냥 그 결제창으로 되돌아가는 이유가 무언가요?

[WHY?] I have a situation, not solved. I still have tried workaround with no success, same loop returning to same form in the PayPal website. I see the button is CONTINUE instead of PAY NOW. Is it maybe a clue?
search key word, paypal continue button redirect same address https://stackoverflow.com/questions/64346150/paypal-authorization-link-redirects-user-nowhere-and-keeps-a-loop-in-the-same-pa pay now버튼이 보이지 않고 continue 버튼이 보인다. 그리고 그 버튼이 계속된다. 결제는 되지 않고 왜지? 0 If you are redirecting the user over to the approval_url, then your original API request should have included a return_url, so PayPal knows where to return the customer. A return from the approval is required, so that you can capture the order, otherwise there will be no payment. The best integration uses no redirects whatsoever. In place of sending the browser to the approval URL, all you need is to create the order and get back its id value. Then use that to show a button that gives an in-context checkout experience, keeping your site loaded in the background (no redirect away). Once the buyer gives their approval, you'll then do the API call to capture the order. Here is the demo code: https://developer.paypal.com/demo/checkout/#/pattern/server It's actually very simple/straightforward, most of the stuff at the end is some pointers about post-capture error handling 답을 주긴 했다만 도움이 안된다. auto return 기능을 살펴보자 밥먹고와서 혹시 Return URL- Users are redirected to this URL after live transactions. Allow up to three hours for the change to take effect. 가 답일지도 모르겠다. https://www.sandbox.paypal.com/businessmanage/preferences/website Auto return Note: Turning OFF Auto Return will disable Payment Data Transfer feature. On Return URL https://www.tanz.co.kr/PaymentMethod/paypal/paypalCompleted.aspx 가 있다. 안녕하세요 페이팔 연동 중입니다. 한국내에서는 결제가 안된다고 하던데 혹시 그 때문인가요? 저의 문제는 페이팔 가맹점입니다. 쇼핑몰 구축하고 페이팔 checkout 결제연동 중입니다. access_token 으로 Make REST API calls 를 하여 id, status, links를 받고 links에서 approve주소를 redirect해 결제창을 띠운 후 sandbox personal account로 결제를 진행하고 있는데 continue가 되지 않습니다. 결제창까지 떴는데 최종 결제가 이루어지지 않고 그냥 그 결제창으로 되돌아가는 이유가 무언가요? sandbox account로 작업중입니다. 가능하면 010 3660 8471 로 기술 지원 담당자의 연락 부탁드립니다. 테스트 중인 주소는 https://www.tanz.co.kr/PaymentMethod/paypal/paypalPay.aspx 입니다. https://www.tanz.co.kr//PaymentMethod/paypal/payPal.aspx?amount=200 으로 파람쿼리가 추가됐습니다. https://www.tanz.co.kr/PaymentMethod/paypal/paypalPay.aspx?amount=200 으로 파람쿼리가 추가됐습니다. 5:43 PM ZE 안녕하세요, PayPal로 연락주셔서 감사합니다. 상담원 Zoe입니다. 5:53 PM - Zoe ZE 우선 말씀하신대로 한국국내간의 거래는 지원이 안되기 때문에 결제를 받는 계정과 결제하는 계정 모두 한국 계정인 경우 테스트 결제라고 하더라도 결제가 불가능합니다. 5:54 PM - Zoe ZE 기타 기술 문제는 저희 기술팀으로 직접 문의해 주시기 바랍니다. 5:55 PM - Zoe ZE 기술팀으로 문의하는 방법은 다음과 같습니다. 5:55 PM - Zoe ZE 1.Go to www.paypal-support.com. 2.Click "Contact us" near the end of the page. 3.Click Login with PayPal. 4.Enter the required information and click Create Account. You can use any valid email address for this account. 5:55 PM - Zoe ZE 답변이 도움이 되었기를 바랍니다. 추가 문의사항이 없으시다면 "종료" 버튼을 클릭해주시면 됩니다. 회신은 하지 않으셔도 됩니다. PayPal에 소중한 시간을 내주어서 감사합니다. 좋은 하루 되세요. ^^

sandbox business 계정에 회사 이미지와 모토 입력은 어디서?

다시 tanzkorea-facilitator@gmail.com으로 Aa1~2!
My Apps : Tanz, barreinabag Sandbox Accounts Business peter@barreinabag.com, tanzkorea-faciltator@gmail.com, tanzkorea-developer@gmail.com Personal byungil@example.com, tanzkorea-buyer@gmail.com, tanzkorea-personal@gmail.com 이 복잡한 것을 다 바꾸는 것이 좋을 듯하다. Tanz -> peter@barreinabag.com barreinabag -> tanzkorea-facilitator@gmail.com Client ID Aaa6bBAPUZTOPAWLJy1E28dcVXA6a7v-MfajSO_o8v-JBZV76v67wjzE2-rB Secret EB4OYhCD2-TreOX8_oWtk2aJsgySeiXlln_Mevmm1NikSbQg5JtwgaT6p7HP Payment data transfer (optional) Payment data transfer allows you to receive notification of successful payments as they are made. The use of payment data transfer depends on your system configuration and your Return URL. Please note that in order to use payment data transfer, you must turn on auto return. Identity Token: mlVBwJkqRIB1yfjgcNnBKNn-vneuqTlXMOXFHbvPLif3XEs-68sJ74YDyt8 도돌이되는 주소 https://www.sandbox.paypal.com/webapps/hermes?flow=1-P&ulReturn=true&token=1TJ3590376017925K&rcache=2&cookieBannerVariant=1&country.x=US&locale.x=en_US auto return 을 설정한 것은 의미 없는 것으로 판명되었다. 현재 Tanz와barreinabag, 두 개의 app을 생성하였다.

PayPal 기술팀 문의 - www.paypal-support.com
1.Go to www.paypal-support.com. 2.Click "Contact us" near the end of the page. 3.Click Login with PayPal. 4.Enter the required information and click Create Account. You can use any valid email address for this account.

Webhook is the hint for CONTINUE LOOP PROBLEM
REST APIs Webhooks are HTTP callbacks that receive notification messages for events. To create a webhook in PayPal, merchants configure a webhook listener and subscribe it to events. A webhook listener is a server that listens at a specific URL for incoming HTTP POST notification messages that are triggered when events occur. PayPal signs each notification message that it delivers to your webhook listener. The PayPal REST APIs use webhooks for event notification API CURRENT Webhooks are HTTP callbacks that receive notification messages for events. To create a webhook at PayPal, users configure a webhook listener and subscribe it to events. A webhook listener is a server that listens at a specific URL for incoming HTTP POST notification messages that are triggered when events occur. PayPal signs each notification message that it delivers to your webhook listener. Webhook event names API CURRENT Last updated: October 7th 2021, @ 11:10:14 am PayPal supports these webhook events. Authorized and captured payments Batch payouts Billing plans and agreements Log in with PayPal Disputes Checkout buyer approval Invoicing Marketplaces and Platforms Merchant onboarding Orders Payment orders Referenced payouts Sales Subscriptions Vault Matching CHECKOUT.ORDER.APPROVED with PAYMENT.CAPTURE.COMPLETED Options djslim djslim Contributor Contributor Posted on ‎Apr-04-2020 08:07 PM Hi, I'm completely new to the PayPal API. I'm using the smart button with a web hook to capture the payment & shipping information. I thought I'd get the shipping info with the event CHECKOUT.ORDER.APPROVED then when I get the PAYMENT.CAPTURE.COMPLETED event I'll be sure the payment is fully processed. I noticed that the transaction ID for both are different. so I have no way of matching the two. Is there a way to match the two that I'm missing? Or can I just assume CHECKOUT.ORDER.APPROVED is enough to trust that everything is good and ignore PAYMENT.CAPTURE.COMPLETED? We would always recommend waiting for the "Payment.Capture.Completed" webhook for each transaction. The webhook for "Checkout.Order.Approved" was actually intended to be used to notify your system to attempt Payment Capture. In other words, some capture immediately and really don't need the Approved webhook since just the Completed one would suffice. But some choose to authorize, then capture later, checking to make sure they got an Approved webhook before initiating the capture. That's just a glimpse into the original intent. I believe you can add your own order id called an "invoice_id". You can pass this in the "purchase_units" object when creating the transaction. Then, when you receive the checkout.order.approved webhook, you can look at the details of the transaction to find the invoice_id. Then, when capturing the transaction, that same invoice ID will be attributed to the captured ID as well. I hope that helps! Options IDislikThisGame IDislikThisGame Member Member ‎Aug-01-2021 11:15 AM This is the reality of PayPal in 2021. You cant pass data to PAYMENT.CAPTURE.COMPLETED for whatever reason and you can't match CHECKOUT.ORDER.APPROVED that contains the relevant data to the right COMPLETED. Using PayPal feels like fighting against PayPal not like using it Options MarcoT999 MarcoT999 Contributor Contributor ‎Sep-23-2021 01:29 PM This is a serious problem for us. There is no way to attribute `CHECKOUT.ORDER.APPROVED` with a `PAYMENT.CAPTURE.COMPLETED` since anything within the purchase_units don't show up in the latter webhook. Aaron... help us out man. -Aaron I did find a way by analyzing the JSON payload in the webhook. I was able to match the checkout with the successful payment using: req.body.resource.supplementary_data.related_ids.order_id

After you configure a listener.. WHAT MEANS? [HOw to use the webhooks simulator] [The PayPal REST APIs can use webhooks for event notification.]
SAMPLE curl -v -X POST https://api-m.sandbox.paypal.com/v1/notifications/webhooks \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AAKzA17dknWxrzAG4LLXB7LdURQx2LiYXeBOlvd1bXViyaESQmYRmmm_jjv9C7zRQmBTRFHFsGF87Vhq9MGRr9YPf9OqGA" \ -d '{ "url": "https://www.tanz.co.kr/PaymentMethod/paypal", "event_types": [ { "name": "PAYMENT.AUTHORIZATION.CREATED" }, { "name": "PAYMENT.AUTHORIZATION.VOIDED" } ] }' 00 903 100 705 100 198 896 251 --:--:-- --:--:-- --:--:-- 1147{"id":"3XJ1309575982815H","url":"https://www.tanz.co.kr/PaymentMethod/paypal","event_types":[{"name":"PAYMENT.AUTHORIZATION.CREATED","description":"A payment authorization is created, approved, executed, or a future payment authorization is created."},{"name":"PAYMENT.AUTHORIZATION.VOIDED","description":"A payment authorization is voided."}],"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/3XJ1309575982815H","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/3XJ1309575982815H","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/3XJ1309575982815H","rel":"delete","method":"DELETE"}]} * Connection #0 to host api-m.sandbox.paypal.com left intact curl -v -X GET https://api-m.sandbox.paypal.com/v1/notifications/webhooks \ -H "Content-Type: application/json" \ -H "Authorization: Bearer A21AAKzA17dknWxrzAG4LLXB7LdURQx2LiYXeBOlvd1bXViyaESQmYRmmm_jjv9C7zRQmBTRFHFsGF87Vhq9MGRr9YPf9OqGA" 100 1336 100 1336 0 0 2424 0 --:--:-- --:--:-- --:--:-- 2424{"webhooks":[{"id":"3XJ1309575982815H","url":"https://www.tanz.co.kr/PaymentMethod/paypal","event_types":[{"name":"PAYMENT.AUTHORIZATION.CREATED","description":"A payment authorization is created, approved, executed, or a future payment authorization is created.","status":"ENABLED"},{"name":"PAYMENT.AUTHORIZATION.VOIDED","description":"A payment authorization is voided.","status":"ENABLED"}],"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/3XJ1309575982815H","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/3XJ1309575982815H","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/3XJ1309575982815H","rel":"delete","method":"DELETE"}]},{"id":"06886315AP805045Y","url":"https://www.tanz.co.kr/PaymentMethod/paypal/paypalPay.aspx","event_types":[{"name":"CHECKOUT.ORDER.APPROVED","description":"An order has been approved by buyer.","status":"ENABLED"}],"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/06886315AP805045Y","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/06886315AP805045Y","rel":"update","method":"PATCH"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks/06886315AP805045Y","rel":"delete","method":"DELETE"}]}]} * Connection #0 to host api-m.sandbox.paypal.com left intact

[?]PayPal-Request-Id : 이것은 임의로 만들어 보내고 서버에 저장해서 사용할 수 있는건가?
PayPal-Request-Id Optional. Contains a unique user-generated ID that the server stores for a period of time. Use this header to enforce idempotency on REST API POST calls. You can make these calls any number of times without concern that the server creates or completes an action on a resource more than once. You can retry calls that fail with network timeouts or the HTTP 500 status code. You can retry calls for as long as the server stores the ID. For example, a user calls refund captured payment with the PayPal-Request-Id header that contains a unique user-provided ID. The user can make the call again with the same ID in the PayPal-Request-Id header for up to 45 days because the server stores this ID for this long for this call. If the initial call fails with the HTTP 500 status code but the server has already refunded the payment, the caller does not need to worry that the server will refund the payment again.

links array - To complete payer approval, use the approve link to redirect the payer
Order로 받은 Response { "id": "5O190127TN364715T", "status": "CREATED", "links": [ { "href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T", "rel": "self", "method": "GET" }, { "href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T", "rel": "approve", "method": "GET" }, { "href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T", "rel": "update", "method": "PATCH" }, { "href": "https://api-m.paypal.com/v2/checkout/orders/5O190127TN364715T/capture", "rel": "capture", "method": "POST" } ] } To complete payer approval, use the approve link to redirect the payer linksarray (contains the link_description object) An array of request-related HATEOAS links. To complete payer approval, use the approve link to redirect the payer. The API caller has 3 hours (default setting, this which can be changed by your account manager to 24/48/72 hours to accommodate your use case) from the time the order is created, to redirect your payer. Once redirected, the API caller has 3 hours for the payer to approve the order and either authorize or capture the order. If you are not using the PayPal JavaScript SDK to initiate PayPal Checkout (in context) ensure that you include application_context.return_url is specified or you will get "We're sorry, Things don't appear to be working at the moment" after the payer approves the payment. If you are not using the PayPal JavaScript SDK to initiate PayPal Checkout (in context) ensure that you include application_context.return_url is specified or you will get "We're sorry, Things don't appear to be working at the moment" after the payer approves the payment. return url을 특정하여야 한다는 내용에 대한 내용 참고출처 - https://stackoverflow.com/questions/55450116/paypal-checkout-redirecturl-after-createorder

REST API 전개 순서, https://demo.paypal.com/us/demo/go_platform/pcRestServerV2/cart
REST API integration supports instant capture, authorize capture, refunds, and transaction reporting. Plus, it provides more ways for buyers to pay. 1. Get Access Token 2. Creat Order 3. Order Details 4. Patch Order 5.Immediate Capture 1. Get Access Token POST https://api.sandbox.paypal.com/v1/oauth2/token POST https://api.sandbox.paypal.com/v1/oauth2/token { "PayPal-Request-Id": "platform-1635604319366", "Authorization": "Basic QVRz*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​akE=" } grant_type=client_credentials 2. Creat Order POST https://api.sandbox.paypal.com/v2/checkout/orders { "PayPal-Request-Id": "platform-1635604319697", "Content-Type": "application/json", "cache-control": "no-cache", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​h4-Q" } { "intent": "CAPTURE", "purchase_units": [ { "reference_id": "PU1", "description": "Camera Shop", "invoice_id": "INV-CameraShop-1635604326993", "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" } ] } ] } 3. Order Details GET https://api.sandbox.paypal.com/v2/checkout/orders/7P5139080N115310D { "PayPal-Request-Id": "platform-1635604337916", "Content-Type": "application/json", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​h4-Q" } 4. Patch Order PATCH https://api.sandbox.paypal.com/v2/checkout/orders/7P5139080N115310D { "PayPal-Request-Id": "platform-1635604338236", "Content-Type": "application/json", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​h4-Q" } [ { "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 } } } } ] 5. Immediate Capture POST https://api.sandbox.paypal.com/v2/checkout/orders/7P5139080N115310D/capture/ POST https://api.sandbox.paypal.com/v2/checkout/orders/7P5139080N115310D/capture/ { "PayPal-Request-Id": "platform-1635604341011", "Content-Type": "application/json", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​h4-Q" }

@reference_id - 언제 어디에 필요
https://developer.paypal.com/docs/api/orders/v2/#orders_patch Updates an order with a CREATED or APPROVED status. You cannot update an order with the COMPLETED status. To make an update, you must provide a reference_id. If you omit this value with an order that contains only one purchase unit, PayPal sets the value to default which enables you to use the path: "/purchase_units/@reference_id=='default'/{attribute-or-object}". Sample Request curl -v -X PATCH https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T \ -H "Content-Type: application/json" \ -H "Authorization: Bearer Access-Token" \ -d '[ { "op": "replace", "path": "/purchase_units/@reference_id=='PUHF'/shipping/address", "value": { "address_line_1": "123 Townsend St", "address_line_2": "Floor 6", "admin_area_2": "San Francisco", "admin_area_1": "CA", "postal_code": "94107", "country_code": "US" } } ]' Sample Response 204 No Content

배송비 산출 , What is the code of country of customer?
고객 국가 코드를 알고 배송비를 산출 1. 고객의 국가코드와 2. 고객이 선택한 상품과 3. 고객이 선택한 배송 방법에 의해 4. 배송비 가 정해진다. Customer's country code Customer's choice of products DeliveryMethod DeliveryPrice

Auto Return Page https://www.paypal.com/us/smarthelp/article/how-do-i-use-paypal's-auto-return-feature-to-redirect-customers-back-to-my-website-faq3651
How do I use PayPal's Auto Return feature to redirect customers back to my website? *The feature is only available for Business accounts. The Auto Return feature for PayPal Payments Standard redirects the buyer back to your website after completing the payment. This feature replaces the PayPal-hosted Payment Done page with a page hosted on your website. Here's how to enable Auto Return: Click Settings. Click Website payments under "Product & Services" on the left of the page. Click Update next to "Website preferences." Click On under "Auto return." In the Return URL field, enter the URL where you want to send your payer after payment is complete. The Return URL is applied to all Auto Return payments unless otherwise specified within the payment button or link. Click Save. When you specify a Return URL for Auto Return, the target page must meet the following requirements of the PayPal User Agreement. The text must help the buyer understand that the payment was made and the transaction was completed. The text must explain that the buyer will receive an email containing details about the payment transaction. The page must provide a good user experience for your customers. This includes, but is not limited to: Visual consistency with the rest of your merchant site. No request for any PayPal account information details. Example: "Thank you for your payment. Your transaction has completed, and we are sending you an email containing the receipt for your purchase. Click here to log in to your account and view details of this transaction."

Website Payments Pro - US & UK, CA, AU 만 현재 가능 20211031

data-client-token
https://developer.paypal.com/docs/business/checkout/advanced-card-payments/integrate/ 2. Generate client token A client token is required to uniquely identify your buyer. The following request generates a client token that you'll use for data-client-token when you integrate the JavaScript SDK script in Step 3. Copy the following code and modify it. Sample client token request curl -X POST https://api-m.sandbox.paypal.com/v1/identity/generate-token -H 'Content-Type: application/json' -H 'Authorization: Bearer A21AAIfXjOnhFKezT4zSNUUkr0MzPYapGDritspUPbW5gGFef1wHoY0ux-L9GvBwGJSTHPJ7cGBeVQKZevD8CsG3UwbvpiGlA -H 'Accept-Language: en_US' A21AAIfXjOnhFKezT4zSNUUkr0MzPYapGDritspUPbW5gGFef1wHoY0ux-L9GvBwGJSTHPJ7cGBeVQKZevD8CsG3UwbvpiGlA curl -X POST https://api-m.sandbox.paypal.com/v1/identity/generate-token \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ACCESS-TOKEN' \ -H 'Accept-Language: en_US' \ Modify the code Copy the sample request code. Change ACCESS_TOKEN to your access token. Sample client token response [Get access token] curl -v POST https://api-m.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "CLIENT_ID:SECRET" \ -d "grant_type=client_credentials" {"client_token":"eyJicmFpbnRyZWUiOnsiYXV0aG9yaXphdGlvbkZpbmdlcnByaW50IjoiMDVkMjlhODJjZDE4OThjNjM5ZDNhMmU3OTBjNDdiNjZjNWQ4YjIyMDNlZDc3NTY1NDNmZmZiMjRmNGM2NTFlYXxtZXJjaGFudF9pZD1yd3dua3FnMnhnNTZobTJuJnB1YmxpY19rZXk9NjNrdm4zN3Z0MjlxYjRkZiZjcmVhdGVkX2F0PTIwMjEtMTEtMDFUMDU6NTU6NTIuNTkzWiIsInZlcnNpb24iOiIzLXBheXBhbCJ9LCJwYXlwYWwiOnsiaWRUb2tlbiI6ImV5SnJhV1FpT2lKbE5EQTJOakE0WWpVMFlUazBORGd4WWprMVl6YzFOREkwT0dOak1USXpaaUlzSW5SNWNDSTZJa3BYVkNJc0ltRnNaeUk2SWxKVE1qVTJJbjAuZXlKcGMzTWlPaUpvZEhSd2N6b3ZMMkZ3YVM1ellXNWtZbTk0TG5CaGVYQmhiQzVqYjIwaUxDSmhZM0lpT2xzaVkyeHBaVzUwSWwwc0ltRjFaQ0k2SWtGaFlUWmlRa0ZRVlZwVVQxQkJWMHhLZVRGRk1qaGtZMVpZUVRaaE4zWXRUV1poYWxOUFgyODRkaTFLUWxwV056WjJOamQzYW5wRk1pMXlRaUlzSW5KdmJHVWlPaUpOUlZKRFNFRk9WQ0lzSW1GMWRHaGZkR2x0WlNJNk1UWXpOVGMwTmpFMU1pd2lZWG9pT2lKblkzQXVjMnhqSWl3aVpYaHdJam94TmpNMU56UTNNRFV6TENKelpYTnphVzl1WDJsdVpHVjRJam9pVTJGeFVIVTRRbkZ5TUU5aGEyMUlaWEJLUW1oWmRUZEViV2hQSWl3aWFXRjBJam94TmpNMU56UTJNVFV6TENKcWRHa2lPaUpWTWtGQlNVMVVkbXRqYVhaVloxaGhhV0ZPT0U1aWIycHphMWgwZG5sU2NrdHZYMnRXWkZoclNVODBNMVJDTkhoVFdtRjNRMjEzY1doQlJqSnVTMUJUUW5sUGFURTNNRzFPTUZwM2RUUkRSVmxLYWpGeGMzVjBjRkJwUm5GSVUzZzVSMDA0UjE5UWRUWnhSME53VjBWUmJuQXpaakJGU1hJM1dUWnZiSFY1ZHlJc0ltTnNhV1Z1ZEY5cFpDSTZJa0ZoWVRaaVFrRlFWVnBVVDFCQlYweEtlVEZGTWpoa1kxWllRVFpoTjNZdFRXWmhhbE5QWDI4NGRpMUtRbHBXTnpaMk5qZDNhbnBGTWkxeVFpSjkuQ2poNkxKazBFelhzaHRKcFlMSGpmU2VzTDF6cDJhVFRvZFhteXVrQlRpd2o3clVSem8tTnpGMWV0YVVIU0o5b2hWUV9DU1hhV2JEVWhUamp6ZC1FcXNockg0QTBFRU1CMnc5ZFRYclNUYUlTRkFacHJEVnhVd2F6Tlg5VVBTX0dqcWRaVkdxSEs4SE9IajkzYzNaNjd1MlJFYloyVkFzQjVOeE9nUGdFc292MDMxdHFGYmtwejBZWmdicVdqM0FOS3Bid0tld0VJTGV5b1ZSWDN5aF9PSk9qeFhQX1d1UFlhZ21rYTlDMVVteEF2MHBBOGN6ODFSX2k1TU9RNnZvVkFXTTZnNy00RkZBR2dqRms4RDB5NkZTSHpaUUtwczBPdGtybWlvYTBoWFNfZ01FU2ZtaVhXaEgtUlBoUG1rd18yajJCd0ZWckNXOC1JS1M4MElsVWZ3IiwiYWNjZXNzVG9rZW4iOiJBMjFBQUlJbWo2RWhRYTkyM3lEc19xNTNJcUxwQzFiT01RWGI1bG9wcVlkb3FYRTZxLWRiYk9BS1hKa3c2V1lxbEdHZ010ZzNlZzdTQVVMYUs0VElzRVM1ZFp0WlNqSlZ3In19","id_token":"eyJraWQiOiJlNDA2NjA4YjU0YTk0NDgxYjk1Yzc1NDI0OGNjMTIzZiIsInR5cCI6IkpXVCIsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJodHRwczovL2FwaS5zYW5kYm94LnBheXBhbC5jb20iLCJhY3IiOlsiY2xpZW50Il0sImF1ZCI6IkFhYTZiQkFQVVpUT1BBV0xKeTFFMjhkY1ZYQTZhN3YtTWZhalNPX284di1KQlpWNzZ2Njd3anpFMi1yQiIsInJvbGUiOiJNRVJDSEFOVCIsImF1dGhfdGltZSI6MTYzNTc0NjE1MiwiYXoiOiJnY3Auc2xjIiwiZXhwIjoxNjM1NzQ3MDUzLCJzZXNzaW9uX2luZGV4IjoiU2FxUHU4QnFyME9ha21IZXBKQmhZdTdEbWhPIiwiaWF0IjoxNjM1NzQ2MTUzLCJqdGkiOiJVMkFBSU1UdmtjaXZVZ1hhaWFOOE5ib2pza1h0dnlScktvX2tWZFhrSU80M1RCNHhTWmF3Q213cWhBRjJuS1BTQnlPaTE3MG1OMFp3dTRDRVlKajFxc3V0cFBpRnFIU3g5R004R19QdTZxR0NwV0VRbnAzZjBFSXI3WTZvbHV5dyIsImNsaWVudF9pZCI6IkFhYTZiQkFQVVpUT1BBV0xKeTFFMjhkY1ZYQTZhN3YtTWZhalNPX284di1KQlpWNzZ2Njd3anpFMi1yQiJ9.Cjh6LJk0EzXshtJpYLHjfSesL1zp2aTTodXmyukBTiwj7rURzo-NzF1etaUHSJ9ohVQ_CSXaWbDUhTjjzd-EqshrH4A0EEMB2w9dTXrSTaISFAZprDVxUwazNX9UPS_GjqdZVGqHK8HOHj93c3Z67u2REbZ2VAsB5NxOgPgEsov031tqFbkpz0YZgbqWj3ANKpbwKewEILeyoVRX3yh_OJOjxXP_WuPYagmka9C1UmxAv0pA8cz81R_i5MOQ6voVAWM6g7-4FFAGgjFk8D0y6FSHzZQKps0Otkrmioa0hXS_gMESfmiXWhH-RPhPmkw_2j2BwFVrCW8-IKS80IlUfw","expires_in":3600} 한시간후 체크할 것

Prefer: return=representation
REST API Order단계에서 If you require the complete order resource representation, you must pass the Prefer: return=representation request header. This header value is not the default. 라는 문구가 있다. 이 때 Prefer: return=representation 가 나온다.

PATCH / v2/checkout/orders/{id}
To make a REST API request, you combine the HTTP GET, POST, PUT, PATCH, or DELETE method, the URL to the API service, the URI to a resource to query, submit data to, update, or delete, and one or more HTTP request headers. Create Order POST /v2/checkout/orders -------------------------------------------- Sample Request curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders \ -H "Content-Type: application/json" \ -H "Authorization: Bearer Access-Token" \ -d '{ "intent": "CAPTURE", "purchase_units": [ { "amount": { "currency_code": "USD", "value": "100.00" } } ] }' Update Order PATCH /v2/checkout/orders/{id} --------------------------------------------------------- Show order Details GET /v2/checkout/orders/{id} --------------------------------------------------------- Sample Request curl -v -X GET https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T \ -H "Content-Type: application/json" \ -H "Authorization: Bearer Access-Token" Authorize payment for order POST /v2/checkout/orders/{id}/authorize ------------------------------------------------------------ Sample Request curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T/authorize \ -H "Content-Type: application/json" \ -H "Authorization: Bearer Access-Token" \ -H "PayPal-Request-Id: 7b92603e-77ed-4896-8e78-5dea2050476a" Capture payment for order POST /v2/checkout/orders/{id}/capture ---------------------------------------------------------------- Sample Request curl -v -X POST https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T/capture \ -H "Content-Type: application/json" \ -H "Authorization: Bearer Access-Token" \ -H "PayPal-Request-Id: 7b92603e-77ed-4896-8e78-5dea2050476a"

HATEOAS links
Hypermedia as the Engine of Application State (HATEOAS) is a constraint of the REST application architecture that distinguishes it from other network application architectures.

[ YOUTUBE SOLUTION ] PayPal REST API Setup, Get Access Token and Make PayPal Payment API Using Server Side https://www.youtube.com/watch?v=tkN4EQt1P6I
실행 후 결제 완료 하고 받은 답 https://temp.tanz.co.kr/PaymentMethod/paypal/paypalCompleted.aspx?paymentId=PAYID-MF742MQ77F1778824525521U&token=EC-6FX85965BV3355443&PayerID=MAPXM3AETFFZL

PAYOUTS API
Use the Payouts API to make payments to multiple PayPal or Venmo recipients. The Payouts API is a fast, convenient way to send commissions, rebates, rewards, and general disbursements. You can send up to 15,000 payments per call. If you integrated the Payouts API before September 1, 2017, you receive transaction reports through Mass Payments Reporting. Otherwise, view reports from your PayPal Business account. The Payouts API uses the ISO 8601 Internet date and time format.

PAYMENTS REST API PayPal Payments
https://developer.paypal.com/docs/integration/direct/payments/paypal-payments/ postman cs@tanz.co.kr로 들어가면 Tanz_App 이 있다. Tanz_AccessToken -> payment ->exceutSuccess의 삼 단계 과정으로 성공하였다. Sandbox app, Tanz 의 peter@barreinabag.com business계정과 tanzkorea-buyer@gmail.com personal계정에서 성공하였다.

Demo 두 가지 - Standard(Client Side)
Standard (Client Side) using PayPal JavaScript SDK https://demo.paypal.com/us/demo/go_platform/pcRestClientV2/home https://demo.paypal.com/us/demo/go_platform/pcRestClientV2/product https://demo.paypal.com/us/demo/go_platform/pcRestClientV2/cart 떠있는 페이팔 결제 창 - 결제하면 모달 처럼 떠 있던 페이팔 결제 창이 사라지고 https://demo.paypal.com/us/demo/go_platform/pcRestClientV2/cart 페이지로 돌아간다. SAVE버튼을 클릭하면 https://demo.paypal.com/us/demo/go_platform/checkoutGroup/home Standard (Server Side) REST using Orders v2 APIs and PayPal JavaScript SDK https://demo.paypal.com/us/demo/go_platform/pcRestServerV2/home https://demo.paypal.com/us/demo/go_platform/pcRestServerV2/product https://demo.paypal.com/us/demo/go_platform/pcRestServerV2/cart 떠있는 페이팔 결제 창 - 결제하면 모달 처럼 떠 있던 페이팔 결제 창이 사라지고 https://demo.paypal.com/us/demo/go_platform/pcRestServerV2/cart 로 가는데 PLACE ORDER 버튼이 보인다. 클릭하면 API HISTORY 모달이 뜬다. 여기서 Get Access Token POST https://api.sandbox.paypal.com/v1/oauth2/token { "PayPal-Request-Id": "platform-1635777338257", "Authorization": "Basic QVRz*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​akE=" } grant_type=client_credentials Create Order POST https://api.sandbox.paypal.com/v2/checkout/orders { "PayPal-Request-Id": "platform-1635777338550", "Content-Type": "application/json", "cache-control": "no-cache", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​AWCA" } { "intent": "CAPTURE", "purchase_units": [ { "reference_id": "PU1", "description": "Camera Shop", "invoice_id": "INV-CameraShop-1635777344539", "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" } ] } ] } Response { "content-type": "application/json", "content-length": "501", "connection": "close", "date": "Mon, 01 Nov 2021 14:35:39 GMT", "application_id": "APP-80W284485P519543T", "cache-control": "max-age=0, no-cache, no-store, must-revalidate", "caller_acct_num": "LBWJA5E8YLKA8", "paypal-debug-id": "b49ae1a3b49a2", "strict-transport-security": "max-age=31536000; includeSubDomains" } { "id": "1TP17279PE973962V", "status": "CREATED", "links": [ { "href": "https://api.sandbox.paypal.com/v2/checkout/orders/1TP17279PE973962V", "rel": "self", "method": "GET" }, { "href": "https://www.sandbox.paypal.com/checkoutnow?token=1TP17279PE973962V", "rel": "approve", "method": "GET" }, { "href": "https://api.sandbox.paypal.com/v2/checkout/orders/1TP17279PE973962V", "rel": "update", "method": "PATCH" }, { "href": "https://api.sandbox.paypal.com/v2/checkout/orders/1TP17279PE973962V/capture", "rel": "capture", "method": "POST" } ] } Order Details GET https://api.sandbox.paypal.com/v2/checkout/orders/1TP17279PE973962V { "PayPal-Request-Id": "platform-1635777349747", "Content-Type": "application/json", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​AWCA" } Patch Order PATCH https://api.sandbox.paypal.com/v2/checkout/orders/1TP17279PE973962V { "PayPal-Request-Id": "platform-1635777350065", "Content-Type": "application/json", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​AWCA" } [ { "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 } } } } ] Immediate Capture POST https://api.sandbox.paypal.com/v2/checkout/orders/1TP17279PE973962V/capture/ { "PayPal-Request-Id": "platform-1635777389789", "Content-Type": "application/json", "Authorization": "Bearer A21*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​*​AWCA" } 과정이 일어났다고 설명하고 있다. 창

https://developer.paypal.com/docs/regional/th/checkout/integrate/ again PayPal