Help Center

How to accept Stellar Lumen (XLM) payments with PHP

Over the last decade, the way we can receive value over the internet has dramatically shifted from traditional payments to programmable money. Cryptocurrencies like Stellar's XLM 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 Stellar Lumens (XLM) payments in PHP is to display an XLM account to the customer. Albeit outside of the scope of this document, it is easy to create an XLM account programmatically and obtain control of the private key. This is a good starting point if you are a PHP developer and wish to create your own XLM account.

This simple type of XLM 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 Stellar Network to detect the correct payment transaction and mark the sale as completed, introduce plenty of additional complexity in PHP.

Fortunately, COINQVEST provides a suite of APIs and a convenient PHP software development kit (SDK) for online merchants and e-commerce site who wish to accept XLM 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 XLM payments with this tutorial.

COINQVEST SDKs

Creating an XLM payment request is as simple as firing the below API request using the PHP SDK.

$response = $client->post('/checkout/hosted', array(
    'charge' => array(
        'currency' => 'USD', // specifies the billing currency
        'lineItems' => array( // a list of line items included in this charge
            array(
                'description' => 'T-Shirt',
                'netAmount' => 10, // denominated in the currency specified above
                'quantity' => 1
            )
        ),
        'discountItems' => array( // an optional list of discounts
            array(
                'description' => 'Loyalty Discount',
                'netAmount' => '0.5'
            )
        ),
        'shippingCostItems' => array( // any shipping costs?
            array(
                'description' => 'Shipping and Handling',
                'netAmount' => '3.99',
                'taxable' => false // sometimes shipping costs are taxable
            )
        ),
        'taxItems' => array( // any taxes?
            array(
                'name' => 'CA Sales Tax',
                'percent' => '0.0825' // 8.25% CA sales tax
            )
        ),
        'customerId' => $customerId, // associates this charge with a customer
    ),
    'settlementCurrency' => 'EUR' // specifies in which currency you want to settle 
));

The API request returns a list of cryptocurrency payment methods and deposit addresses, including XLM. 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 XLM can automatically be settled in your national fiat currency and withdrawn directly into your bank account. Inspect our PHP SDK on GitHub to get started.

Last Update: Jun 6, 2020

Developers