How To: Implement PayPal Payments
How To: Implement PayPal Payments
Overview
This guide covers the three ways to accept PayPal with Coinflow:
- Prebuilt Checkout UI (iframe) — PayPal appears automatically inside Coinflow’s hosted checkout.
CoinflowPayPalButtonSDK component — Embed the PayPal button in your own checkout UI.- Direct API + PayPal SDK — Render PayPal’s own SDK and call Coinflow’s checkout endpoints directly.
Before using any of these options, PayPal must be enabled on your Coinflow account. Contact your Coinflow integrations team to have PayPal configured.
Option 1: Prebuilt Checkout UI (iframe)
This is the simplest path. If you already embed Coinflow’s hosted checkout, there is nothing to build — once PayPal is enabled on your account, the PayPal button automatically appears alongside your other payment methods in the checkout iframe.
If you have not yet integrated the hosted checkout, see Implement Checkout for how to embed the CoinflowPurchase component.
Option 2: CoinflowPayPalButton SDK Component
Use the CoinflowPayPalButton component when you have built your own checkout UI but want Coinflow to manage the PayPal order creation, approval overlay, and settlement. You render a single React component where you want the PayPal button to appear, and Coinflow handles the rest inside a secure iframe.
Component Props
In addition to the standard Coinflow purchase props (env, merchantId, sessionKey, subtotal, handleHeightChange, etc.), the CoinflowPayPalButton accepts the following:
The button requires at least one customer identifier — email, phoneNumber, or token. Until one is provided, the button renders disabled.
Option 3: Direct API + PayPal SDK
This is the most flexible path. You render PayPal’s own button using the PayPal JS SDK and call Coinflow’s PayPal checkout endpoints to create the order. Use this when you need full control over the PayPal experience.
Fetch your PayPal merchant ID and client ID
Call the public Merchant View endpoint, GET /merchant/view/v2/{merchantId}, and read both merchant.paypalMerchantId and merchant.paypalClientId from the response. These are passed to the PayPal SDK as the merchant-id and client-id respectively. This is the same endpoint Coinflow’s hosted checkout uses to load your configuration, so no authentication is required — only your merchantId.
Response (truncated):
paypalMerchantId is unique to your account and is set when the integrations team enables PayPal. paypalClientId is the PayPal client ID for the environment you are calling. The values above are examples only — read the real values from the API response.
The sandbox API (https://api-sandbox.coinflow.cash) returns the sandbox paypalClientId, and the production API (https://api.coinflow.cash) returns the production paypalClientId. Reading it from the API means there is no value to hard-code or hand off manually.
Initialize the PayPal SDK
Load the PayPal JS SDK using your paypalMerchantId as the merchant-id and your paypalClientId as the client-id. Initialize with intent=authorize, and set the partner attribution ID (BN code) to CoinflowLabsLimited_PSP via the data-partner-attribution-id attribute on the script tag.
You must pass the data-partner-attribution-id (BN code) CoinflowLabsLimited_PSP when loading the SDK. This identifies the integration as processed through Coinflow — payments will not be attributed correctly without it.
Create the order via Coinflow
Render the PayPal button and, in its createOrder callback, call the PayPal New Checkout endpoint. Coinflow creates the order and returns a paymentId.
Response:
The paymentId returned by Coinflow is the PayPal order ID. Return it directly from your createOrder callback so the PayPal SDK uses it as the order ID — do not create a separate order with PayPal.
For customers paying with a previously saved PayPal account, call the PayPal Saved Checkout endpoint instead and pass the saved token.
Confirm settlement with webhooks
Configure your webhook endpoint to listen for Settled events. This is the recommended way to confirm a payment has completed.
Important Notes
Account Configuration: PayPal must be enabled on your account by the Coinflow integrations team before any of these options will work.
Sandbox vs. Production: The
paypalClientIdreturned by the API is scoped to the environment you call — the sandbox API returns the sandbox client ID and the production API returns the production client ID. When going live, switch to the production API base URL (https://api.coinflow.cash) and use thepaypalClientIdit returns.
Settlement: Regardless of which integration path you choose, funds are delivered to your configured settlement location, and the recommended way to confirm completion is by listening for
Settledwebhook events.

