⚛️ React Environment Properties
Environmental settings that determine how the checkout process functions
Property | Required | Description |
---|---|---|
wallet | Y | Set the Solana wallet adapter |
blockchain | Y | The blockchain for the purchase (solana) |
merchantId | Y | The merchant identifier - the target of the checkout (Contact Coinflow support for this) |
connection | Y | The Solana connection |
env | N | The environment - defaults to prod , for testing set it to staging |
onSuccess | N | Specify a function to run when the checkout process succeeds |
transaction | N | Transaction for the user to run which redeems their credits with your smart contract. Create this transaction just like you would for a normal user who has USDC in their account. |
partialSigners | N | Keypairs of Partial Signers to sign the transaction with, this is necessary when initializing new accounts as the new account Keypair must sign the transaction. |
debugTx | N | Setting this to true will sign the transaction with the wallet, and send the transaction with no preflight checks allowing for easier debug of any issues. |
token | N | The token to use for the purchase. Defaults to USDC. Currently only supported for the Solana Blockchain. |
planCode | N | When a subscription is being purchased, the code of the subscription plan |
settlementType | N | The settlement method to use for the proceeds of a purchase. (Credits, USDC, or Bank) |
amount | N | Fix the amount of the purchase |
webhookInfo | N | Product or transaction based information that you want transmitted when you receive webhooks regarding the purchase (See example) |
N | Set the default email to use in email entry fields | |
chargebackProtectionData | N | Information to formulate the chargeback protection logic (See example) |
disableApplePay | N | Ability to disable Apple Pay |
disableGooglePay | N | Ability to disable Google Pay |
customerInfo | N | Additional information about the customer (See example) |
supportsVersionedTransactions | N | Instruct the system that you support versioned transactions |
rent | N | Specify the blockchain rent amount to add to the total (See example) |
origins | N | If rendering the Coinflow component within multiple nested iframes, all ancestors in the chain must be provided as a comma-separated list. |
Usage
Base
import {useWallet} from '@solana/wallet-adapter-react';
const wallet = useWallet();
const connection = useConnection();
<CoinflowPurchase wallet={wallet} merchantId='<YOUR MERCHANT ID>' env='prod|sandbox|staging' connection={connection} />;
Webhook Info
// This is only an example - this is merchant defined
const webhookInfo = {
productId: 'N421',
code: 'PX8242342',
}
Chargeback Protection
const chargebackProtection = [
{
productName: 'Widget',
productType: 'computingContract',
quantity: 1,
rawProductData: {
description: 'Market best widgets'
}
}
]
The product type settings:
inGameProduct
gameOfSkill
dataStorage
computingResources
sportsTicket
eSportsTicket
musicTicket
conferenceTicket
virtualSportsTicket
virtualESportsTicket
virtualMusicTicket
virtualConferenceTicket
alcohol
DLC
subscription
fundACause
realEstate
computingContract
digitalArt
topUp
The raw product data is optional but can be used to provide additional information to assist in the chargeback protection decision.
Customer Info
// All the fields are optional
const custonmerInfo = {
name: 'Suzy Customer',
verificationId: '123',
displayName: 'Suzy',
address: '123 Main St'
city: 'Somewhereville',
state: 'AK',
zip: '99546',
country: 'US',
ip: '172.10.0.1'
lat: '58.2005N',
lng: '152.2100W'
}
Rent
const rent = { lamports: 100000 }
Updated 3 months ago