### Setup Module After Installation Source: https://docs.clover.com/dev/docs/installing-magento Run these commands after installing the module to upgrade the Adobe Commerce setup, flush the cache, and clean the cache. ```bash $ bin/magento setup:upgrade $ bin/magento cache:flush $ bin/magento cache:clean ``` -------------------------------- ### Install Test App with Script Source: https://docs.clover.com/dev/docs/setting-up-an-android-emulator Use this script to install your test Android app on the emulator after initial setup. Ensure the emulator is running and accessible. ```shell ./install_apps.py Getting installed versions... Getting current app data... Updating package: your.package.name from version: ?, to version: 1... ``` -------------------------------- ### Get All Authorizations (Node.js) Source: https://docs.clover.com/dev/reference/paygetauthorizations This Node.js example demonstrates how to fetch all authorizations for a merchant. It shows how to set up the request and handle the response. ```javascript const https = require('https'); const options = { hostname: 'apisandbox.dev.clover.com', port: 443, path: '/v3/merchants/{mId}/authorizations', method: 'GET', headers: { 'accept': 'application/json', 'Authorization': 'Bearer YOUR_ACCESS_TOKEN' } }; const req = https.request(options, (res) => { console.log('statusCode:', res.statusCode); let data = ''; res.on('data', (chunk) => { data += chunk; }); res.on('end', () => { console.log(JSON.parse(data)); }); }); req.on('error', (error) => { console.error(error); }); req.end(); ``` -------------------------------- ### Get a Single Payment (Node.js) Source: https://docs.clover.com/dev/reference/paygetpayment This Node.js example demonstrates how to fetch a single payment using the Clover SDK. Ensure you have the SDK installed and configured with your API credentials. ```javascript const clover = require('remote-pay-api'); const merchantId = 'YOUR_MERCHANT_ID'; const paymentId = 'YOUR_PAYMENT_ID'; clover.payments.get(merchantId, paymentId, { expand: ['tender', 'lineItemPayments'] }) .then(payment => { console.log('Payment details:', payment); }) .catch(error => { console.error('Error fetching payment:', error); }); ``` -------------------------------- ### Example Activity Setup for Payment Connector Source: https://docs.clover.com/dev/docs/take-a-payment-with-payment-connector Initializes the PaymentConnector, sets up the activity layout, and adds a button listener to trigger a sale. Ensure the PaymentConnector is initialized with a listener before use. ```java public class ExampleActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_simple_example); // Initialize the PaymentConnector with a listener final PaymentConnector paymentConnector = initializePaymentConnector(); Button saleButton = findViewById(R.id.saleButton); saleButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Set up a SaleRequest SaleRequest saleRequest = setupSaleRequest(); paymentConnector.sale(saleRequest); } }); } ``` -------------------------------- ### Get Credit Refunds (Node.js) Source: https://docs.clover.com/dev/reference/paygetcreditrefunds-3 This Node.js example demonstrates how to fetch credit refunds using the Clover SDK. Ensure you have the SDK installed and configured with your access token. ```javascript const clover = require('remote-pay-api'); const merchantId = '{mId}'; const accessToken = ''; clover.init({ clientId: 'YOUR_CLIENT_ID', clientSecret: 'YOUR_CLIENT_SECRET' }); clover.payments.getCreditRefunds(merchantId, accessToken) .then(refunds => { console.log('Credit Refunds:', refunds); }) .catch(err => { console.error('Error fetching credit refunds:', err); }); ``` -------------------------------- ### Initiate Payment from Activity (Java) Source: https://docs.clover.com/dev/docs/android-payments-api-payment-tutorial Sets up the activity layout and a button click listener to build and start a payment request. Requires `activity_main.xml` and a `paymentButton` ID. ```Java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button payButton = findViewById(R.id.paymentButton); payButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = buildPaymentRequestIntent(); startActivityForResult(intent, PAYMENT_REQUEST_CODE); } }); } ``` -------------------------------- ### Get Merchant Details (Node.js) Source: https://docs.clover.com/dev/reference/merchantgetmerchant This Node.js example demonstrates how to fetch a single merchant's information. Ensure you have the necessary libraries installed and replace placeholders with your actual values. ```javascript const axios = require('axios'); const merchantId = '{mId}'; // Replace with the actual merchant ID const accessToken = ''; // Replace with your access token const userAgent = 'YourAppName'; // Replace with your application name axios.get(`https://apisandbox.dev.clover.com/v3/merchants/${merchantId}`, { headers: { 'Authorization': `Bearer ${accessToken}`, 'User-Agent': userAgent } }) .then(response => { console.log('Merchant details:', response.data); }) .catch(error => { console.error('Error fetching merchant details:', error); }); ``` -------------------------------- ### Initiate Payment from Activity (Kotlin) Source: https://docs.clover.com/dev/docs/android-payments-api-payment-tutorial Sets up the activity layout and a button click listener to build and start a payment request. Requires `activity_main.xml` and a `paymentButton` ID. ```Kotlin override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val payButton = findViewById