Li
Delete
Are you sure you want to delete this?
PaypalModel
-
Date
-
20211101
-
Target
-
C_031
-
Title
-
Demo 두 가지 - Standard(Client Side)
-
Contents
-
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"
}
과정이 일어났다고 설명하고 있다.
창