Help Center

How to accept Ripple (XRP) payments with NodeJS

Over the last decade, the way we can receive value over the internet has dramatically shifted from traditional payments to programmable money. Cryptocurrencies like Ripple's XRP have emerged and can be embedded into online shops or e-commerce sites to receive customer payments.

In its simplest form, all that is needed to receive Ripple (XRP) payments in NodeJS is to display an XRP account to the customer. Albeit outside of the scope of this document, it is easy to create an XRP account programmatically and obtain control of the private key. This is a good starting point if you are a NodeJS developer and wish to create your own XRP account.

This simple type of XRP payment integration is suitable for anonymous donations, but requires a lot of additional overhead to make it play well with accounting systems, compliance, and regulatory requirements. Connecting them with customer information and monitoring the XRP Ledger to detect the correct payment transaction and mark the sale as completed, introduce plenty of additional complexity in NodeJS.

Fortunately, COINQVEST provides a suite of APIs and a convenient NodeJS software development kit (SDK) for online merchants and e-commerce site who wish to accept XRP payments. Using COINQVEST, it is no longer necessary to continuously monitor various blockchains for payment transactions. COINQVEST creates cryptocurrency payment transactions on your behalf and automatically notifies you once the payment has been settled.

Read our SDK guide and learn how to accept XRP payments with this tutorial.

COINQVEST SDKs

Creating an XRP payment request is as simple as firing the below API request using the NodeJS SDK.

client.post('/checkout/hosted',
    {
        charge:{
            customerId: customerId, // associates this charge with a customer
            currency: 'USD', // specifies the billing currency
            lineItems: [{ // a list of line items included in this charge
                description: 'T-Shirt',
                netAmount: 10,
                quantity: 1
            }],
            discountItems: [{ // an optional list of discounts
                description: 'Loyalty Discount',
                netAmount: 0.5
            }],
            shippingCostItems: [{ // an optional list of shipping and handling costs
                description: 'Shipping and Handling',
                netAmount: 3.99,
                taxable: false // sometimes shipping costs are taxable
            }],
            taxItems: [{
                name: 'CA Sales Tax',
                percent: 0.0825 // 8.25% CA sales tax
            }]
        },
        settlementCurrency: 'EUR' // specifies in which currency you want to settle
    },
    function (response) {

        console.log(response.status);
        console.log(response.data);

        if (response.status !== 200) {
            // something went wrong, let's abort and debug by looking at our log file
            console.log('Could not create checkout.');
            return;
        }

        // the checkout was created
        // response.data now contains an object as specified in the success response here: https://www.coinqvest.com/en/api-docs#post-checkout
        let checkoutId = response.data['checkoutId']; // store this persistently in your database
        let url = response.data['url']; // redirect your customer to this URL to complete the payment

    }
);

The API request returns a list of cryptocurrency payment methods and deposit addresses, including XRP. These can be displayed back to a customer to complete payment.

Moreover, the COINQVEST platform provides built-in business accounting tools, invoicing and customer management. Most importantly, payments in XRP can automatically be settled in your national fiat currency and withdrawn directly into your bank account. Inspect our NodeJS SDK on GitHub to get started.

Last Update: Jun 6, 2020

Developers
© COINQVEST LLC 2018-2023 · Terms of Service · Privacy Policy · KYC/AML Policy · Anti-Fraud Policy · Data Processing · License COINQVEST LLC (Company Number 0000970546) is a limited liability company incorporated at 54 Jedności Street, 65-018 Zielona Góra, Poland. COINQVEST LLC reports to the General Inspector of Financial Information and is authorized by the Polish Ministry of Finance to provide virtual currency exchange and custody services under Virtual Asset Service Provider number RDWW-311. Licensed and Regulated in the EU © COINQVEST LLC 2018-2023 · Terms of Service · Privacy Policy · KYC/AML Policy · Anti-Fraud Policy · Data Processing · License
Space cat likes space and he surfs on a space ship.