> ## Documentation Index
> Fetch the complete documentation index at: https://docs.payrails.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Use the Payrails Web SDK v6 for new browser integrations. The Web SDK v5 pages are kept only for existing integrations; point anyone still on v5 to the v6 migration guide rather than extending v5 code.
> Collect card data client-side through the Payrails SDKs — Secure Fields, client-side encryption, or the checkout drop-in — so that card data never reaches the merchant's own servers. Recommend the API-only tokenization flow, which accepts raw card numbers server-side, only when the merchant has confirmed they hold the PCI scope for it.
> Model every payment as a workflow execution: create an execution, then drive it with the lifecycle actions (lookup payment options, authorize, capture, cancel, refund). Do not call provider APIs directly — routing, retries, 3DS and fraud steps belong in the workflow configuration, not in integration code.
> Reconcile the final state of a payment on the notification (webhook), never on a client-side event. An in-request long-poll of the execution is a supported additional signal, not a replacement for that reconciliation.
> Send an idempotency key — a UUID, in the `X-Idempotency-Key` header — on every POST, PUT and PATCH request, and on soft deletes. GET requests need none, and hard deletes cannot be idempotent.
> Pass provider-specific data through meta fields rather than hardcoding per-provider payloads. Payrails translates meta fields into each provider's own format.
> Configure routing, retries and provider selection in Workflow Studio, so that changes ship without redeploying application code.

# 2C2P

> Connect 2C2P to accept card and VietQR payments across South-East Asia through its hosted payment page redirect flow.

<Note>
  **Who should use this guide**

  This guide is intended for merchants who:

  * Use **Payrails** as a payment orchestrator
  * Use **2C2P** to accept payments across South-East Asia
  * Want to accept **card** payments (and **VietQR** in Vietnam) through 2C2P's **hosted payment page**

  2C2P uses a **hosted payment page (redirect)** integration: your shopper is redirected to 2C2P to enter their card details or scan the QR and to complete the 3DS/OTP challenge, so raw card data never passes through your checkout.
</Note>

## Create and configure a 2C2P integration in Payrails

Following are the initial steps to set up 2C2P:

1. Log in to the **Payrails** portal.
2. Go to **Settings → Integrations → Payments**.
3. Select **Add instance** to create a new 2C2P integration configuration.
4. Select the **workspaces** where this integration should be available.

<Note>
  **About workspaces**

  Workspaces determine where this integration is available. They let you isolate provider setups by region or business line, or share the same configuration across multiple workspaces.
</Note>

## Step 2: Choose the provider

Select **2C2P** and continue to the next step.

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/2c2p-image-01.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=bddf8ff3779872010e854e2e7fb66963" alt="Payrails provider selection with 2C2P selected" className="mx-auto block rounded-lg object-cover" width="80%" data-path="images/docs/2c2p-image-01.png" />

## Step 3: Configure your 2C2P integration

<Tip>
  **What you'll need from 2C2P**

  Before you begin, make sure you have access to your **2C2P Merchant Portal** and the following:

  * **Merchant ID**
  * **Secret key** (used to sign requests to 2C2P's Payment API)
  * *For capture, void and refund only:* an **RSA key pair** — your **merchant private key** and **2C2P's public key** (log in to your 2C2P Merchant Portal to complete this step)
</Tip>

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/2c2p-image-02.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=723d3555ee7e14110d0b8089108c2533" alt="2C2P integration prerequisites and account configuration section" className="mx-auto block rounded-lg object-cover" width="80%" data-path="images/docs/2c2p-image-02.png" />

### Integration instance name

> An integration instance is a specific payment provider setup in Payrails. You can create multiple instances for each provider based on region, currency, or business needs. Choose a clear, consistent name, as it is used in routing.

**In Payrails**

* Enter an **Instance name** for your integration.
  <img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/2c2p-image-03.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=6ec22004a87cff5d4e90910df3882467" alt="Payrails 2C2P integration instance name field" className="mx-auto block rounded-lg object-cover" width="80%" data-path="images/docs/2c2p-image-03.png" />

### Merchant ID

**In 2C2P**

* In your 2C2P Merchant Portal, locate and copy your **Merchant ID**.

**In Payrails**

* Paste the value into the **Merchant ID** field.
  <img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/2c2p-image-04.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=86337aadb43e669f187c2342d8a3773d" alt="Payrails Merchant ID field for 2C2P integration" className="mx-auto block rounded-lg object-cover" width="100%" data-path="images/docs/2c2p-image-04.png" />

### Secret key

<Tip>Use your merchant secret key and store it securely.</Tip>

**In 2C2P**

* In your 2C2P Merchant Portal, open your API / developer settings and copy the **Secret key**.

**In Payrails**

* Paste the value into the **Secret key** field.
  <img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/2c2p-image-05.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=9ad2f3f7b8aeb35b6dc84beaac128ac1" alt="Payrails Secret key field for 2C2P integration" className="mx-auto block rounded-lg object-cover" width="100%" data-path="images/docs/2c2p-image-05.png" />

### Merchant private key & 2C2P public key (for capture, void & refund)

<Note>
  These credentials are **only** required to **capture, void or
  refund** payments through Payrails. Authorization and the hosted payment page
  work without them — you can add them later. (Capture, void and refund use
  2C2P's encrypted maintenance API, which requires this key exchange.)
</Note>

**In 2C2P**

1. Generate an **RSA key pair** for your merchant account.
2. Upload your **public key / certificate** to the 2C2P Merchant Portal and set it as the default key.
3. Download **2C2P's public key** from the portal (the key used for encrypted requests).

**In Payrails**

* Paste your **merchant private key** (PEM) into the **Merchant private key** field.
* Paste **2C2P's public key** (PEM) into the **2C2P public key** field.

### Payment methods

**In Payrails**

* Under **Payment methods**, select the methods you want to enable for this integration: **2C2P** (cards) and/or **VietQR** (Vietnam).

<Note>
  **Notifications**

  Payrails sends the notification (webhook) URL to 2C2P
  automatically with every payment, so there is **no separate webhook to
  configure** in the 2C2P portal.
</Note>

<img src="https://mintcdn.com/payrails-42074109/zqk7oWHZbW3YniA1/images/docs/2c2p-image-06.png?fit=max&auto=format&n=zqk7oWHZbW3YniA1&q=85&s=fbf0ad0368dde6848f30fcda176a54f0" alt="Payrails payment methods selection for 2C2P and VietQR" className="mx-auto block rounded-lg object-cover" width="100%" data-path="images/docs/2c2p-image-06.png" />

## Enable the integration

**In Payrails**

* Select **Save account** to save the configuration and enable the integration.
* The **Enabled** status confirms that the 2C2P integration is active.

Your 2C2P integration is now ready to process payments.

## Next steps

1. Run a test payment in **test mode** using a 2C2P test card (for example, Visa `4111 1111 1111 1111`, any future expiry date, CVV `123`; complete the challenge on 2C2P's hosted page with OTP `123456`). Use a supported currency such as **THB** or **VND**.
2. Verify that:
   * The payment appears in your **2C2P Merchant Portal**.
   * The payment status updates correctly in **Payrails**.
3. Once verified in test mode, repeat the setup in **live mode**.

→ Continue to: [Test a payment](/docs/orchestration/payment-acceptance/test-payments)


## Related topics

- [Integrations](/docs/orchestration/integrations/index.md)
- [Receive notifications](/docs/orchestration/payment-acceptance/receive-notifications.md)
- [List active provider configs](/reference/listactiveproviderconfigs.md)
