How To: Implement Chargeback Protection
How To: Implement Chargeback Protection
Overview
Coinflow provides multiple ways to protect merchant accounts against fraud. Learn more about fraud prevention methods before you start implementing chargeback protection.
How to Add Chargeback Protection
When merchants opt in for chargeback protection, they need to install Coinflow Purchase Protection across every page of their site. This integration gathers device and session signals during the customer’s shopping experience so Coinflow can score the purchase for fraud and chargeback risk. Depending on your implementation method, select from the options below for setup instructions:
React
- Add the <CoinflowPurchaseProtection> component to every page on your site.
- Add your
merchantIdas a property to the <CoinflowPurchaseProtection> component. - In every <CoinflowPurchase> component, add the
chargebackProtectionDataproperty and input information about each purchase made via Coinflow. See Getting the Device ID if you call Coinflow APIs directly.
React Native
Coinflow provides a mobile module for both iOS and Android that exposes a getDeviceId method. Coinflow’s integrations team will share the module, sample diff files, and the application credentials needed to initialize it on sandbox and production.
Implementation
- Install the mobile module Coinflow provides and follow the README to wire it into your iOS and Android builds.
- Initialize the module on app launch using the application credentials supplied by Coinflow. The same credentials are used in sandbox and production.
- Call the module’s
getDeviceIdmethod to retrieve the device ID. - In
{"<CoinflowPurchase>"}add thechargebackProtectionDataproperty and add information about every purchase that is being made via Coinflow, and pass thedeviceIdthrough to the component. See Getting the Device ID below.
iOS (Native)
For native iOS apps that call Coinflow’s APIs directly (not through React Native), Coinflow uses nSure’s iOS SDK to gather device and session signals.
Implementation
-
Install the SDK using Swift Package Manager or CocoaPods:
Swift Package Manager — in Xcode, select File > Add Package Dependencies, enter
https://github.com/nsure-ai/ios-sdk, and choose version1.3.17or later.CocoaPods
-
Initialize the SDK on app launch using the
appIdandpartnerIdCoinflow’s integrations team provides. The same credentials are used on sandbox and production. -
In
{"<CoinflowPurchase>"}(or your direct API calls), add thechargebackProtectionDataproperty and pass the retrieveddeviceIdthrough. See Getting the Device ID below.
API
- Add the following code to the
<head>of every page on your site — not just the checkout page. After completing the chargeback protection questionnaire, Coinflow will provide your productionpartnerId. UseCOINFTESTon sandbox.
📘 This script gathers information about the user’s device, how they interact with your website, and other signals that let Coinflow’s models predict the risk of fraud or chargeback for this particular user.
- To each of your API calls, add the
x-device-idheader. Pass the value returned by callingwindow?.nSureSDK?.getDeviceId()on your website. See Getting the Device ID below.
This
deviceIdis how Coinflow ties an individual request back to the device and session signals collected by the script you installed above.
- In the Checkout Endpoint and the Redeem Transaction Endpoint, pass the
chargebackProtectionData.
📘 This information describes what is being purchased, which lets Coinflow’s models determine the risk of chargeback for this particular purchase.
Getting the Device ID
When chargeback protection is enabled, pass the device ID in the x-device-id header on checkout, redeem, and subscription API calls. How you retrieve it depends on your integration:
API
After the protection script has loaded and initialized on the page, read the device ID before making your Coinflow API request:
React
Mount <CoinflowPurchaseProtection> on every page, then use the useCoinflowProtectionHeaders hook from @coinflowlabs/react:
If you use <CoinflowPurchase>, the device ID is sent automatically — you only need to retrieve it manually when calling Coinflow APIs directly from your backend-for-frontend or custom checkout flow.
React Native
Coinflow provides a native module for iOS and Android. Initialize it on app launch using the credentials Coinflow supplies, then call getDeviceId and pass the result to <CoinflowPurchase> or your API layer:
Contact Coinflow’s integrations team for the module, sample diff files, and initialization credentials.
iOS (Native)
After initializing the SDK, read the device ID:
Pass this value to your merchant server so it can be included as the x-device-id header on Coinflow API requests.
What to pass into chargebackProtectionData
Merchants that opt-in for chargeback protection are required to pass chargebackProtectionData as a prop to the <CoinflowPurchase> component or to our card checkout, saved card checkout, ach checkout , and redeem transaction endpoints.
🚧 The more information that you pass here the better the authorization rates will be, so it is in your best interest to supply as much information as possible
Example of chargebackProtectionData data structure
Travel bookings
Merchants selling flights and hotel reservations should declare each booking with a travel-specific itemClass so the purchase is evaluated with travel-specific fraud signals — itinerary, lodging, PNR, trip, and flight details — instead of being treated as a generic product. Choose the item class that matches what is being sold:
itemClass is omitted, the cart item is treated as a generic product and travel-specific fraud signals are not evaluated, which can reduce approval rates for travel transactions.Travel package data structure (itemClass: 'travel')
Flight-only bookings (itemClass: 'flightTicket')
For a flight ticket sold without lodging, use itemClass: 'flightTicket'. It has the same required pnr, trip, and firstFlight fields as the travel package above, but no lodging:
Flight upgrades (itemClass: 'flightUpgrade')
For add-ons to an existing flight booking — seat selection, extra baggage, fare changes, or travel insurance — use itemClass: 'flightUpgrade':
Hotel-only bookings (itemClass: 'lodging')
For a hotel reservation sold without flights, use itemClass: 'lodging'. The reservation fields sit at the top level of the item (the same fields as the lodging object of the travel package):

