SDK

Overview

Merchants can use the following documentation to learn how to implement Rapid with our supported SDKs.

Option 2 - SDK

SDK

  1. Share payer events with Rapid
    Sharing major events that a payer makes throughout their lifecycle on your website prior to them making a purchase will allow us to collect more information about them and improve your approval rates.
    curl --request POST \
         --url https://api-sandbox.coinflow.cash/api/events \
         --header 'Authorization: YOUR_API_KEY' \
         --header 'content-type: application/json' \
         --data '
    {
      "eventType": "SignUp",
      "customerId": "user-123-abc",
      "country": "US",
      "username": "therock72",
      "email": "[email protected]",
      "firstName": "Dwayne",
      "lastName": "Johnson"
    }
    '
    curl --request POST \
         --url https://api-sandbox.coinflow.cash/api/events \
         --header 'Authorization: YOU_API_KEY' \
         --header 'content-type: application/json' \
         --data '
    {
      "eventType": "SignIn",
      "customerId": "user-123-abc",
      "country": "US",
      "email": "[email protected]"
    }
    '
    curl --request POST \
         --url https://api-sandbox.coinflow.cash/api/events \
         --header 'Authorization: YOUR_API_KEY' \
         --header 'content-type: application/json' \
         --data '
    {
      "eventType": "SignInFailure",
      "customerId": "user-123-abc",
      "country": "US",
      "email": "[email protected]",
      "failureReason": "Password Failed"
    }
    '
    curl --request POST \
         --url https://api-sandbox.coinflow.cash/api/events \
         --header 'Authorization: YOUR_API_KEY' \
         --header 'content-type: application/json' \
         --data '
    {
      "eventType": "BuyerChallenge",
      "type": "thirdPartyKyc",
      "status": "successfullyFulfilled",
      "customerId": "user-123-abc",
      "country": "US",
      "email": "[email protected]"
    }
    '

  2. Install Coinflow package
    npm i @coinflowlabs/react
    npm i @coinflowlabs/react-native
  3. Generate a session key for the payer.
    curl --request GET \
         --url https://api-sandbox.coinflow.cash/api/auth/session-key \
         --header 'Authorization: YOUR_API_KEY' \
         --header 'accept: application/json' \
         --header 'x-coinflow-auth-user-id: user123'
    {
      "key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkIjoidXNlcjEyMyIsIm1lcmNoYW50SWQiOiJ0ZXN0dGVzdCIsImlhdCI6MTc0MTgwNTk3MywiZXhwIjoxNzQxODkyMzczfQ.mau9HPQXZQ040-bkQ0tMg57N9IVTbEQZMtV4O9kgkjg"
    }
  • 🚧

    Session keys are valid for 24 hours and must be refreshed afterwards

  1. Implement the Checkout Component.
<CoinflowPurchase
  sessionKey={'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkIjoidXNlcjEyMyIsIm1lcmNoYW50SWQiOiJ0ZXN0dGVzdCIsImlhdCI6MTc0MTgwNTk3MywiZXhwIjoxNzQxODkyMzczfQ.mau9HPQXZQ040-bkQ0tMg57N9IVTbEQZMtV4O9kgkjg'}
  merchantId={'YOUR_MERCHANT_ID'} // Replace with your own merchantId
  env={'sandbox'}
  onSuccess={(...args) => {
    console.log('Purchase Success', args); // Pass your own func after a successful purchase
  }}
  settlementType={SettlementType.USDC}
  subtotal={{ cents: 300, currency: Currency.USD }} // Predefined purchase amount
  webhookInfo={{
    itemName: "Gold Coins", 
    price: "10.99",
    quantity: 1000,
    currency: "USD",
    gamePlatform: "Sweepstakes Game"
  }} // Pass webhook data you want to receive
  email={'[email protected]'} // Payer's email address
  chargebackProtectionData={[{
    productName: 'Gold Coins',
    productType: "gameOfSkil", // Ensure this matches Coinflow's accepted types
    quantity: 1000,
    rawProductData: {
      productID: "gold_coins_1000",
      productDescription: "Virtual gold coins for use in various sweepstakes games.",
      productCategory: "Virtual Currency",
      platform: "Sweepstakes Game",
      redemptionMethod: "In-game balance",
      expiration: "Never",
      issuer: "Sweepstakes Platform Inc."
    },
  }]}
/>
  1. Customize the UI on your dashboard
❗️

Before going live, ensure you've added the chargeback protection script to EVERY PAGE of your site!

To learn how to add the script, see this document here .