Li
Delete
Are you sure you want to delete this?
PaypalModel
-
Date
-
20210114
-
Target
-
c_000
-
Title
-
Paypal
-
Contents
-
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"