# 페이팔

{% hint style="warning" %}
**Deprecated**

이 문서는 더 이상 관리되지 않습니다.

[PortOne 개발자센터](https://developers.portone.io/)를 이용해주세요.
{% endhint %}

{% hint style="danger" %}
Paypal Express checkout 신규 신청 및 신규 연동이 불가합니다. 페이팔 연동을 원하는 경우, [페이팔 SPB(Smart Payment Buttons) 연동 방법](/docs/pg/payment-gateway/spb.md)으로 진행 바랍니다.
{% endhint %}

### 1. 페이팔 PG 설정하기

[**페이팔 설정**](/docs/ready/2.-pg/payment-gateway/undefined-3.md) 페이지의 내용을 참고하여 PG 설정을 진행합니다.

![](/files/hfODwwQvDw9xi4f3JpUT)

### 2.결제 요청하기

[JavaScript SDK](/docs/sdk/javascript-sdk-old.md) IMP.**request\_pay**(param, callback)을 호출하여 페이팔 결제창을 호출할 수 있습니다. **결제결과**는 **PC / 모바일** 모두 <mark style="color:red;">**m\_redirect\_url**</mark> 리디렉션됩니다.

{% tabs %}
{% tab title="인증결제창 요청" %}
{% code title="Javascript SDK" %}

```javascript
IMP.request_pay({
    pg : 'paypal.{API 사용자 이름}',
    pay_method : 'card',
    merchant_uid: "order_no_0001", // 상점에서 관리하는 주문 번호
    name : '주문명:결제테스트',
    amount : 14.20,
    currency : 'USD', // 기본값: USD(원화 KRW는 페이팔 정책으로 인해 지원하지 않음)
    buyer_email : 'test@portone.io',
    buyer_name : '구매자이름',
    buyer_tel : '010-1234-5678',
    buyer_addr : '서울특별시 강남구 삼성동',
    buyer_postcode : '123-456',
    m_redirect_url : '{결제 완료 후 리디렉션 될 URL}' 
}, function(rsp) { // callback 로직
	//* ...중략... *//
});
```

{% endcode %}

**주요 파라미터 설명**

**`pg` \***<mark style="color:green;">**string**</mark>

**PG사 구분코드**

**`paypal`** 로 지정하면 됩니다.

**`pay_method`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**string**</mark>

**결제수단 구분코드**

* card (신용카드)

**`merchant_uid`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**string**</mark>

**`주문번호`**

매번 고유하게 채번되어야 합니다.

**`amount`** <mark style="color:red;">**\***</mark> <mark style="color:purple;">**`integer`**</mark>

**결제금액**

<mark style="color:green;">**string**</mark> 이 아닌점에 유의하세요

**`currency`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>

**결제통화코드**

지원 가능한 모든 통화는 [페이팔 공식 문서](https://developer.paypal.com/docs/api/reference/currency-codes/#paypal-account-payments)를 참고해주세요

**`m_redirect_url`** <mark style="color:red;">**\***</mark> <mark style="color:green;">**`string`**</mark>

**결제결과 수신 URL**

PC환경 모바일 환경 모두 해당 값을 필수로 설정해야 결과를 받아볼수 있습니다.
{% endtab %}
{% endtabs %}

### 추가 기능 <a href="#additional-features" id="additional-features"></a>

Paypal에서는 고위험업종(게임, 디지털 콘텐츠) 가맹점의 경우 판매자 보호 및 더 높은 수준의 위험관리를 위해 STC API(SetTransactionContext API)를 제공합니다.

고위험거래를 안전하게 요청하기 위해서는 거래를 증명할 추가적인 정보(STC API로 전달할 정보)가 필요하며, 아래 예제와 같이 `request_pay`에 파라미터를 추가하여 고위험거래를 요청할 수 있습니다.

```javascript
IMP.request_pay({
  /* 요청 객체 */
  // Paypal 전용 파라미터로 결제요청 파라미터 문서에 존재하지 않습니다.
  optional: {
    "use_stc_api": true,
    "stc_data": {
      // Paypal과 협의한 STC(SetTransactionContext) 데이터를 넣어주세요.
      "sender_account_id": "A12345N343"
    }
  }
});
```

고위험거래인 경우에만 해당 파라미터가 제공될 수 있도록 사용에 유의해주세요.

자세한 내용은 [Paypal Transaction Risk](https://developer.paypal.com/limited-release/raas/) 문서를 참고해주세요.

{% hint style="info" %}
STC API를 사용하기 위해서는 **Paypal과의 STC 데이터 협의**가 필요하며, **포트원 지원팀(<support@portone.io>)을 통해 요청**해주시면 협의 프로세스를 안내해드리고 있습니다.

연동을 원하시는 경우 원활한 연동절차를 위해 요청 전 **아래 pdf의 Create REST API Application 섹션을 완료**해주세요.
{% endhint %}

{% file src="/files/buS7GOcYscPicOlOZyzu" %}

{% hint style="warning" %}
**참고사항**

포트원은 페이팔 정기결제를 지원하지 않습니다.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://portone.gitbook.io/docs/pg/payment-gateway/paypal.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
