Creating payment Intents
Payment Intents are the recommended way to accept payments with bamotf. They represent your customer's intent to pay you for goods or services and they are confirmed once the payment is complete.
You can create payment intents by using the SDKs and libraries we provide or by calling the API directly
Creating a payment intent using libraries
To create a payment intent with the libraries, you need to call the create
method on the PaymentIntent
class which may vary depending on the language
you're using. Here's an example:
Make sure you have the bamotf Node library installed. See the installation guide for more information.
import {Bamotf} from '@bamotf/node'
// TODO: Replace with your API key
const bamotf = new Bamotf('my-key')
const pi = await bamotf.paymentIntents.create({
amount,
address,
currency: 'USD',
confirmations: 6,
description: 'Donation',
tolerance: 0.02,
})
Creating a payment intent using the API
To create a payment intent with the API, you need to make a POST
request to
the /api/payment-intents
endpoint. Here's an example:
curl -X POST 'https://localhost:21000' \
-H 'Content-Type: application/json' \
-d '{
"address": "your_address",
"amount": 100_000_000,
"confirmations": 6,
"currency": "BTC",
"description": "your_optional_description_value"
}'
More information about the parameters can be found in the API reference.