<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Omolade Ekpeni</title>
    <description>The latest articles on DEV Community by Omolade Ekpeni (@omolade11).</description>
    <link>https://dev.to/omolade11</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F715767%2F6c7075f4-a8b6-483a-a933-fd5972eed6d4.jpg</url>
      <title>DEV Community: Omolade Ekpeni</title>
      <link>https://dev.to/omolade11</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omolade11"/>
    <language>en</language>
    <item>
      <title>Integrating Cryptocurrency as a Payment Option with API</title>
      <dc:creator>Omolade Ekpeni</dc:creator>
      <pubDate>Sat, 16 Oct 2021 17:13:00 +0000</pubDate>
      <link>https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-with-api-31f8</link>
      <guid>https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-with-api-31f8</guid>
      <description>&lt;p&gt;Continuous evolvement of cryptocurrency as a means of payment drives the need for multicurrency payment options on payment gateways. In this article, &lt;a class="mentioned-user" href="https://dev.to/tkings"&gt;@tkings&lt;/a&gt; and I will be sharing a great solution that works for implementing cryptocurrency payment with API. &lt;/p&gt;

&lt;p&gt;An example of how you can implement cryptocurrency in your project using CoinForBarter is below:&lt;/p&gt;

&lt;p&gt;Sending an API post request to &lt;a href="https://api.coinforbarter.com/v1/payments"&gt;https://api.coinforbarter.com/v1/payments&lt;/a&gt; with the required payload will generate a payment object that you can work with.&lt;/p&gt;

&lt;p&gt;Example in javascript using axios is shown below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
*
 * @returns a CoinForBarter payment object
 */
const createPaymentObject = async () =&amp;gt; {
  try {
    const url = "https://api.coinforbarter.com/v1/payments";
    const requestPayload = {
      txRef: "RX1",
      amount: 10,
      currency: "BTC",
      currencies: [],
      meta: {
        consumer_id: 23,
      },
      customer: "example@gmail.com",
      customerPhoneNumber: "+234xxxxxx",
      customerFullName: "John Doe",
    };
    const secretKey = "xxxxxxxxxxxxxxxxxxx";
    const headers = {
      Authorization: `Bearer ${secretKey}`,
    };
    const { data } = await axios.post(url, requestPayload, { headers });
    return data;
  } catch (error) {
    // console.log(error)
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will receive a response like below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "status": "success",
    "data": {
        "payment": {
            "id": "613a1067500d0f0020adf882",
            "_id": "613a1067500d0f0020adf882",
            "status": "in progress",
            "description": "Payment from Dayne_OKon@gmail.com",
            "txRef": "hrgyuur743784",
            "redirectUrl": "",
            "amount": 0,
            "nairaValue": 0,
            "dollarValue": 0,
            "baseAmount": 0.01,
            "baseCurrency": "BTC",
            "currencies": [
                "BTC",
                "DOGE",
                "ETH",
                "USDT",
                "USDC",
                "BUSD",
                "DAI",
                "PAX",
                "BCH",
                "WBTC"
            ],
            "expiresBy": 0,
            "transactionFees": 0,
            "totalDue": 0,
            "customer": "Dayne_OKon@gmail.com",
            "customerDetails": {
                "email": "Dayne_OKon@gmail.com",
                "fullName": ""
            },
            "addressSentFrom": [],
            "transactionTimeLog": [
                {
                    "time": "2021–09–09T13: 47: 19.098Z",
                    "type": "event",
                    "event": "Started transaction"
                }
            ],
            "isCurrencyLocked": false,
            "createdAt": "2021–09–09T13: 47: 19.100Z"
        },
        "url": "https: //coinforbarter-checkout.herokuapp.com/v1/api-pay/6109aa97-ad5bab00–1b913f89–613a1067–500d0f00–20adf882"
    },
    "message": "payment created"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two modes in which this payment object can be used to process a full payment,&lt;br&gt;
• CoinForBarter hosted.&lt;br&gt;
• Self hosted.&lt;/p&gt;
&lt;h3&gt;
  
  
  CoinForBarter Hosted
&lt;/h3&gt;

&lt;p&gt;You can simply redirect your customer to the &lt;code&gt;data.url&lt;/code&gt; field to complete the payment. This is referred to as the CoinForBarter Standard. You can read more from the &lt;a href="https://developers.coinforbarter.com/docs/integration-options-coinforbarter-standard/"&gt;CoinForBarter Standard Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It will open a payment gateway like below for the customer to complete the payment.&lt;/p&gt;

&lt;p&gt;You can provide a redirectUrl to the request payload to redirect the customer to that url when the payment ends.&lt;br&gt;
You can also provide a &lt;a href="https://developers.coinforbarter.com/docs/overview-webhook/"&gt;webhook as seen here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Self Hosted
&lt;/h3&gt;

&lt;p&gt;For the self hosted, you can have your own interface shown to the customer all through the payment process.&lt;/p&gt;

&lt;p&gt;The payment process has the following cycle.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select currency and network&lt;/li&gt;
&lt;li&gt;Lock currency&lt;/li&gt;
&lt;li&gt;Get address and amount the customer is to pay with from selected currency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An example is shown below using Javascript axios&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 *
 * @param {string} paymentId the payment id gotten from data.id
 * @param {string} currency the selected currency to process the payment in eg BTC
 * @param {string} network the selected blockchain network of the currency eg. BEP20
 * @returns an updated payment object containing extra information based on selected currency and network
 */
const setCurrency = async (paymentId, currency, network) =&amp;gt; {
  try {
    const url = `https://api.coinforbarter.com/v1/payments/${paymentId}/currency/set/${currency}/${network}`;
    const secretKey = "xxxxxxxxxxxxxxxxxxx";
    const headers = {
      Authorization: `Bearer ${secretKey}`,
    };
    const { data } = await axios.patch(url, {}, { headers });
    return data;
  } catch (error) {
    // console.log(error)
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A list of &lt;a href="https://developers.coinforbarter.com/docs/overview-introduction/"&gt;supported currencies and their networks to choose from can be found here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After selecting a currency, the returned payload will look like below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "status": "success",
    "data": {
        "id": "60d461fe6410f43ce05be378",
        "status": "in progress",
        "description": "Payment from Jody_Wolff21@hotmail.com",
        "txRef": "hrgyuur743784",
        "fee": 0.00030047,
        "currency": "BTC",
        "currencyNetwork": "bitcoin",
        "amount": 0.01030047,
        "baseAmount": 0.01,
        "baseCurrency": "BTC",
        "currencies": [],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "Jody_Wolff21@hotmail.com",
        "customerDetails": {
            "email": "Jody_Wolff21@hotmail.com"
        },
        "addressInformation": {
            "address": "19xqUGJ5Keo1LjDfatShxfHcKQT6HV24x3",
            "network": "bitcoin",
            "id": "60c7ca61ef2a380a447ed864"
        },
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021–06–24T10:44:14.787Z",
                "type": "event",
                "event": "Started transaction"
            },
            {
                "time": "2021–06–24T10:44:54.905Z",
                "type": "event",
                "event": "set currency to BTC, bitcoin"
            },
            {
                "time": "2021–06–24T10:45:40.482Z",
                "type": "event",
                "event": "locked currency"
            }
        ],
        "isCurrencyLocked": true,
        "createdAt": "2021–06–24T10:44:14.788Z"
    },
    "message": "currency locked"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The object above contains &lt;code&gt;data.currency&lt;/code&gt; and &lt;code&gt;data.currencyNetwork&lt;/code&gt;. This confirms that a currency has been selected. &lt;br&gt;
 &lt;code&gt;data.amount&lt;/code&gt; is the amount to be paid now in the selected currency.&lt;/p&gt;

&lt;p&gt;The next step will be to confirm that the transaction is to be made in our selected currency.&lt;/p&gt;

&lt;p&gt;An example is below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 *
 * @param {string} paymentId paymentId the payment id gotten from data.id
 * @returns an updated payment object containing extra information based on the locked currency and network
 */
const lockCurrency = async (paymentId) =&amp;gt; {
  try {
    const url = `https://api.coinforbarter.com/v1/payments/${paymentId}/currency/lock`;
    const secretKey = "xxxxxxxxxxxxxxxxxxx";
    const headers = {
      Authorization: `Bearer ${secretKey}`,
    };
    const { data } = await axios.patch(url, {}, { headers });
    return data;
  } catch (error) {
    // console.log(error)
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The data returned above is similar to this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; {
    "status": "success",
    "data": {
        "id": "60d461fe6410f43ce05be378",
        "status": "in progress",
        "description": "Payment from Jody_Wolff21@hotmail.com",
        "txRef": "hrgyuur743784",
        "fee": 0.00030047,
        "currency": "BTC",
        "currencyNetwork": "bitcoin",
        "amount": 0.01030047,
        "baseAmount": 0.01,
        "baseCurrency": "BTC",
        "currencies": [],
        "transactionFees": 0,
        "totalDue": 0,
        "customer": "Jody_Wolff21@hotmail.com",
        "customerDetails": {
            "email": "Jody_Wolff21@hotmail.com"
        },
        "addressInformation": {
            "address": "19xqUGJ5Keo1LjDfatShxfHcKQT6HV24x3",
            "network": "bitcoin",
            "id": "60c7ca61ef2a380a447ed864"
        },
        "addressSentFrom": [],
        "transactionTimeLog": [
            {
                "time": "2021–06–24T10: 44: 14.787Z",
                "type": "event",
                "event": "Started transaction"
            },
            {
                "time": "2021–06–24T10: 44: 54.905Z",
                "type": "event",
                "event": "set currency to BTC, bitcoin"
            },
            {
                "time": "2021–06–24T10: 45: 40.482Z",
                "type": "event",
                "event": "locked currency"
            }
        ],
        "isCurrencyLocked": false,
        "createdAt": "2021–06–24T10: 44: 14.788Z"
    },
    "message": "currency locked"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The object above contains &lt;code&gt;data.isCurrencyLocked&lt;/code&gt; This confirms that the transaction has been locked for the selected currency. &lt;br&gt;
 &lt;code&gt;data.addressInformation&lt;/code&gt; shows the address and network the amount is to be sent to.&lt;/p&gt;

&lt;p&gt;The final step is to get notified and verify when a payment has been received.&lt;/p&gt;

&lt;p&gt;You can use the CoinForBarter Webhooks to get notified.&lt;/p&gt;

&lt;p&gt;Then verify the transaction by checking the &lt;code&gt;data.amountReceived&lt;/code&gt; to be equal to &lt;code&gt;data.amount&lt;/code&gt; with the following endpoint.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 *
 * @param {string} paymentId paymentId paymentId the payment id gotten from data.id
 * @returns the present state of the payment object
 */
const verifyPayment = async (paymentId) =&amp;gt; {
  try {
    const url = `https://api.coinforbarter.com/v1/payments/${paymentId}`;
    const secretKey = "xxxxxxxxxxxxxxxxxxx";
    const headers = {
      Authorization: `Bearer ${secretKey}`,
    };
    const { data } = await axios.patch(url, {}, { headers });
    return data;
  } catch (error) {
    // console.log(error)
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can get your secret key on your &lt;a href="https://coinforbarter.com/"&gt;CoinForBarter's&lt;/a&gt; dashboard.&lt;/p&gt;

&lt;p&gt;You can also use the &lt;code&gt;data.status&lt;/code&gt; to be &lt;code&gt;success&lt;/code&gt; if payment was successful, &lt;code&gt;error&lt;/code&gt; if payment failed, &lt;code&gt;inProgress&lt;/code&gt; if payment is in progress or &lt;code&gt;cancelled&lt;/code&gt; if payment was cancelled.&lt;/p&gt;

&lt;p&gt;In this article, we learnt how to integrate cryptocurrency as a payment option with APIs. &lt;a class="mentioned-user" href="https://dev.to/tkings"&gt;@tkings&lt;/a&gt; and I wrote it. We previously wrote about how to implement cryptocurrency as a means of payment using &lt;a href="https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-html-352i"&gt;html&lt;/a&gt; and &lt;a href="https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-javascript-1jad"&gt;javascript&lt;/a&gt;. In the future, we will be writing on implementing it using React and React Native. We will appreciate your comments, and if you have any questions, do not hesitate to hit either &lt;a href="https://twitter.com/tkings_"&gt;Kingsley&lt;/a&gt; or &lt;a href="https://twitter.com/OmoladeEkpeni"&gt;me&lt;/a&gt; up on Twitter.&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>javascript</category>
      <category>api</category>
      <category>payment</category>
    </item>
    <item>
      <title>Integrating Cryptocurrency as a Payment Option: Javascript</title>
      <dc:creator>Omolade Ekpeni</dc:creator>
      <pubDate>Tue, 05 Oct 2021 20:52:32 +0000</pubDate>
      <link>https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-javascript-1jad</link>
      <guid>https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-javascript-1jad</guid>
      <description>&lt;p&gt;Considering the extent to which cryptocurrency as a medium of payment has evolved, Soon enough your employers will start requesting to integrate multi-currency as a payment option in their platforms or they already did 😏. In this article, &lt;a class="mentioned-user" href="https://dev.to/tkings"&gt;@tkings&lt;/a&gt; and I will be sharing a great solution that works for implementing cryptocurrency payment on javascript.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkf457gzh6p8mjjxyq2bq.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkf457gzh6p8mjjxyq2bq.jpeg" alt="Payment Process Flowchart"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The diagram above shows the flow of how the implementation will serve the merchant and customer . The steps are outlined in the &lt;a href="https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-html-352i"&gt;previous article&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implementation
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://coinforbarter.com" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; gives developers a seamless experience, and they support 11 currencies across multiple chains for customers. To proceed, you will need to &lt;a href="https://dashboard.coinforbarter.com/login" rel="noopener noreferrer"&gt;sign up&lt;/a&gt; with them and &lt;a href="https://dashboard.coinforbarter.com/settings/api" rel="noopener noreferrer"&gt;generate an API KEY&lt;/a&gt; from &lt;a href="https://coinforbarter.com" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt;. &lt;a href="https://coinforbarter.com" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; like Flutterwave or Stripe provides an implementation method for JavaScript.&lt;/p&gt;

&lt;p&gt;An example of how you can implement cryptocurrency in your javascript is below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form&amp;gt;
&amp;lt;script src="https://checkout.coinforbarter.com/v1/script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;button type="button" onClick="makePayment()"&amp;gt;Pay Now&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;script&amp;gt;
        function makePayment() {
            CoinForBarterCheckout({
                publicKey: "xxxxxxxxxxxxxxxxxxxxxxx",
                txRef: "RX1",
                amount: 10,
                currency: "BTC",
                redirectUrl: "http://example.com",
                currencies: [], //accept all currencies if you leave it empty
                meta: {
                    consumer_id: 23,
                },
                customer: "example@gmail.com",
                customerPhoneNumber: "+234xxxxxx",
                customerFullName: "John Doe",
                customizations: {
                    title: "My store",
                    description: "Payment for items in cart",
                    logo: "https://assets.example.com/logo.png",
                },
                onError: (data) =&amp;gt; {
                    console.log(data);
                    alert(data.message)
                },
                onSuccess: (data) =&amp;gt; {
                    console.log(data);
                }
            });
        }
    &amp;lt;/script&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an &lt;a href="https://github.com/coinforbarter/examples/tree/main/inline-implementation/php" rel="noopener noreferrer"&gt;example implementation for php&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Input Names and Description
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;publicKey&lt;/strong&gt;: You can get your publicKey from your CoinForBarter dashboard. It helps identify your transaction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;customer&lt;/strong&gt;: The email address of the customer to make that payment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;customerPhoneNumber&lt;/strong&gt;: This is the phone number of the customer. It is an optional field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;customerFullName&lt;/strong&gt;: This is the full name of the customer. It is an optional field.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;txRef&lt;/strong&gt;: This is a random string to help you remember this transaction.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;amount&lt;/strong&gt;: The amount to charge your customer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;currency&lt;/strong&gt;: The currency that you have set the amount in.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;customizations&lt;/strong&gt;: An object to display the title and description to be displayed on the payment page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;redirectUrl&lt;/strong&gt;: A url to redirect the customer to when the transaction ends. This is optional.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;currencies&lt;/strong&gt;: You can have multiple of these fields. It will be a list of the currencies you want to accept for this transaction. It is optional, and if left empty, the customer will pay in any supported currency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;onError&lt;/strong&gt;: A function to handle the data sent back if transactions fails or is cancelled. If provided, it overrides the redirectUrl.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;onSuccess&lt;/strong&gt; : A function to handle the data sent back if transactions is successful. If provided, it overrides the redirectUrl.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Having inserted a user's public key (Tochukwu's) into the above JavaScript code, the 'Pay Now' button leads to this screen below on your website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fukdq4sx62563527rx4jl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fukdq4sx62563527rx4jl.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqmnz17s3txvhda8tfgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqmnz17s3txvhda8tfgv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://coinforbarter.com" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; has a long list of supported currencies and &lt;a href="https://dashboard.coinforbarter.com/payouts/settings" rel="noopener noreferrer"&gt;helps you get settled in your local bank account automatically&lt;/a&gt;. The list of supported currencies can be viewed in the note section of the &lt;a href="https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-html-352i"&gt;previous article&lt;/a&gt;.&lt;br&gt;
In this article, we learnt how to integrate cryptocurrency as a payment option with Javascript. &lt;a class="mentioned-user" href="https://dev.to/tkings"&gt;@tkings&lt;/a&gt; and I wrote it. In the future, we will be writing on implementing it using React, React Native and API. We will appreciate your comments, and if you have any questions, do not hesitate to hit either &lt;a href="https://twitter.com/tkings_" rel="noopener noreferrer"&gt;Kingsley&lt;/a&gt; or &lt;a href="https://twitter.com/OmoladeEkpeni" rel="noopener noreferrer"&gt;me&lt;/a&gt; up on Twitter.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>payment</category>
      <category>cryptocurrency</category>
    </item>
    <item>
      <title>Integrating Cryptocurrency as a Payment Option: HTML </title>
      <dc:creator>Omolade Ekpeni</dc:creator>
      <pubDate>Wed, 29 Sep 2021 16:48:01 +0000</pubDate>
      <link>https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-html-352i</link>
      <guid>https://dev.to/omolade11/integrating-cryptocurrency-as-a-payment-option-html-352i</guid>
      <description>&lt;p&gt;Developers face a new challenge when matching the growing demand to learn the skills needed to meet their clients demand by integrating cryptocurrency as a means of payment into the platform of businesses. Without further ado, let's dive into how you can integrate this payment option for your client.&lt;/p&gt;

&lt;p&gt;The following are the basic steps showing how the process works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: A customer places their order and then presses the Submit or Checkout button, or its equivalent button, on your website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: Once this happens, the website or the e-commerce platform takes the customer to a payment gateway to enter all the relevant information needed for the transaction. &lt;br&gt;
The payment gateway then takes the user directly to the page to make a secured payment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Once the payment gateway gets a new transaction, the payment gateway sends a message to the merchant accordingly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: The payment gateway settles the money with the merchant.&lt;/p&gt;

&lt;p&gt;Once this process completes, the customer gets a confirmation message of the order they placed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fortixzc0evuhwksyodmd.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fortixzc0evuhwksyodmd.jpeg" alt="Payment Process Flowchart"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Integration Process
&lt;/h3&gt;

&lt;p&gt;We will be using &lt;a href="https://coinforbarter.com/" rel="noopener noreferrer"&gt;&lt;strong&gt;CoinForBarter&lt;/strong&gt;&lt;/a&gt; for this tutorial, &lt;a href="https://coinforbarter.com/" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; gives developers a seamless experience, and they support 11 currencies across multiple chains for customers. To proceed, you will need to &lt;a href="https://dashboard.coinforbarter.com/login" rel="noopener noreferrer"&gt;sign up&lt;/a&gt; with them and &lt;a href="https://dashboard.coinforbarter.com/settings/api" rel="noopener noreferrer"&gt;generate an API KEY&lt;/a&gt; from &lt;a href="https://coinforbarter.com/" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt;. You can integrate &lt;a href="https://coinforbarter.com/" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; in a bare HTML file.&lt;/p&gt;

&lt;p&gt;An example of how you can implement the HTML is below(of course, yours should look better 😉):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form method="POST" action="https://checkout.coinforbarter.com/v1"&amp;gt;
&amp;lt;input type="hidden" name="publicKey" value="xxxxxxxxxxxxxxxxxxxxxxxxxx" /&amp;gt;
&amp;lt;input type="hidden" name="customer" value="jessepinkman@walterwhite.org" /&amp;gt;
&amp;lt;input type="hidden" name="customerPhoneNumber" value="0900192039940" /&amp;gt;
&amp;lt;input type="hidden" name="customerFullName" value="Jesse Pinkman" /&amp;gt;
&amp;lt;input type="hidden" name="txRef" value="bitethtx-019203" /&amp;gt;
&amp;lt;input type="hidden" name="amount" value="3400" /&amp;gt;
&amp;lt;input type="hidden" name="currency" value="DOGE" /&amp;gt;
&amp;lt;input type="hidden" name="currencies[]" value="BTC" /&amp;gt;
&amp;lt;input type="hidden" name="currencies[]" value="DOGE" /&amp;gt;
&amp;lt;input type="hidden" name="customizations[title]" value="Miss TryPad" /&amp;gt;
&amp;lt;input type="hidden" name="customizations[description]" value="Buy try pads" /&amp;gt;
&amp;lt;input type="hidden" name="redirectUrl" value="https://example.com/" /&amp;gt;
&amp;lt;button type="submit"&amp;gt;CoinForBarter CHECKOUT&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;see &lt;a href="https://github.com/coinforbarter/examples/tree/main/html-checkout" rel="noopener noreferrer"&gt;this&lt;/a&gt; to fully customize the html checkout button&lt;/p&gt;

&lt;h3&gt;
  
  
  Input Names and Description
&lt;/h3&gt;

&lt;p&gt;• publicKey: You can get your publicKey from your &lt;a href="https://coinforbarter.com/" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; dashboard. It helps identify your transaction.&lt;/p&gt;

&lt;p&gt;• customer: The email address of the customer to make that payment.&lt;/p&gt;

&lt;p&gt;• customerPhoneNumber: This is the phone number of the customer. It is an optional field.&lt;/p&gt;

&lt;p&gt;• customerFullName: This is the full name of the customer. It is an optional field.&lt;/p&gt;

&lt;p&gt;• txRef: This is a random string to help you remember this transaction.&lt;/p&gt;

&lt;p&gt;• amount: The amount to charge your customer&lt;/p&gt;

&lt;p&gt;• currency: The currency that you have set the amount in.&lt;/p&gt;

&lt;p&gt;• customizations[title]: The title you will prefer to show on the payment page. This is an optional field.&lt;/p&gt;

&lt;p&gt;• customizations[description]: The description you will prefer to show on the payment page. This is optional.&lt;/p&gt;

&lt;p&gt;• redirectUrl: A url to redirect the customer to when the transaction ends. This is optional&lt;/p&gt;

&lt;p&gt;• currencies[] : You can have multiple of these fields. It will be a list of the currencies you want to accept for this transaction. It is optional, and if left empty, the customer will pay in any supported currency.&lt;/p&gt;

&lt;p&gt;Having inserted a user's public key (Tochukwu's) with the above HTML code, the 'CoinForBarter CHECKOUT' button leads to the page below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frrr2au8rh2g8alzs8t68.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frrr2au8rh2g8alzs8t68.png" alt="image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  NOTE
&lt;/h3&gt;

&lt;p&gt;• &lt;a href="https://coinforbarter.com/" rel="noopener noreferrer"&gt;CoinForBarter&lt;/a&gt; helps you get settled in your local bank account automatically. &lt;a href="https://dashboard.coinforbarter.com/payouts/settings" rel="noopener noreferrer"&gt;Click here to set that&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;• This is a list of supported currencies - BTC, DOGE, ETH, USDT, USDC, BUSD, DAI, PAX, BCH, WBTC.&lt;/p&gt;

&lt;p&gt;• This is a list of currencies you can set in for the currency field above - USD, NGN, BTC, DOGE, ETH, USDT, USDC, BUSD, DAI, PAX, BCH, WBTC. NGN is only available in Nigeria.&lt;/p&gt;

&lt;p&gt;In this article, we learnt how to integrate cryptocurrency as a payment option with HTML. &lt;a class="mentioned-user" href="https://dev.to/tkings"&gt;@tkings&lt;/a&gt;  and I wrote it. In the future, we will be writing on implementing it using JavaScript, React, React Native and API. We will appreciate your comments, and if you have any questions, do not hesitate to hit either &lt;a href="https://twitter.com/tkings_" rel="noopener noreferrer"&gt;Kingsley&lt;/a&gt; or &lt;a href="https://twitter.com/OmoladeEkpeni" rel="noopener noreferrer"&gt;me&lt;/a&gt; up on Twitter.&lt;/p&gt;

</description>
      <category>html</category>
      <category>cryptocurrency</category>
      <category>payment</category>
      <category>gateway</category>
    </item>
  </channel>
</rss>
