0 purchases
coinbase commerce
coinbase_commerce #
A dart library that connects to interact with the Coinbase Commerce API.
Enables projects to connect seamlessly to coinbase and receive payments!
For more details visit Coinbase API docs.
To start using library, you need to register on Coinbase Commerce and get your API_KEY from user settings.
Next create a Coinbase object for interacting with the API:
the object contains links to an dart Class representations of the API resources Checkout, Charge and Invoice.
Each request returns a CoinbaseResponseObject.
Every CoinbaseResponseObject matches the API response Jsons and casts them as models.
Features #
Create Charges
Cancel Charges
View Charges
List Charges
View The Status of Charges
Create Invoices
View Invoices
List Invoices
Create Checkouts
Delete Checkouts
View Checkouts
List Checkouts
See also:
The official Coinbase Commerce API documentation.
Usage #
To create a new instance of a coinbase_commerce object you have to supply your API as generated from the coinbase commerce settings page.
Coinbase coinbase=Coinbase('YOUR API KEY HERE',debug:true);
copied to clipboard
Charges #
To create a new charge
ChargeObject charge = await coinbase.createCharge(
name: 'Coffee Charge',
description: '3 cups of Coffee',
currency: CurrencyType.usd,
pricingType: PricingType.fixedPrice,
amount: 40);
copied to clipboard
To view the status of Your previously created charge
StatusObject status = StatusCheck().checkChargeStatus(image);
copied to clipboard
Charges can either be (NEW, PENDING, COMPLETED, EXPIRED,
UNRESOLVED, RESOLVED, CANCELED, REFUND PENDING, REFUNDED,NONE)
In the case where it returns a status of none it implies that no record of the charge was seen.
To view the information concerning a particular charge
ChargeObject charge = await coinbase.viewCharge('YOUR CHARGE ID HERE');
copied to clipboard
To cancel a charge
ChargeObject charge= await coinbase.cancelCharge('YOUR CHARGE ID HERE');
copied to clipboard
To list all charges assoiciated with an account
List<ChargeObject> charge = await coinbase.retrieveAllCharges;
copied to clipboard
Checkouts #
To create a new checkout
CheckoutObject checkout = await coinbase.createCheckout(
description: 'description',
name: 'name',
pricingType: PricingType.noPrice,
currency: CurrencyType.usd);
copied to clipboard
To view the information concerning a particular checkout
CheckoutObject charge = await coinbase.viewCheckout('YOUR CHECKOUT ID HERE');
copied to clipboard
To update a previously created checkout, supply the id and the new information,
CheckoutObject checkout = await coinbase.updateCheckout(
checkoutID: 'c4357d83-42d4-4d7b-bc44-d0262b1efd25',
name: 'New Name here');
copied to clipboard
To delete a checkout
CheckoutObject checkout= await coinbase.deleteCheckout('YOUR CHECKOUT ID HERE');
copied to clipboard
To List all charges assoiciated with an account
List<CheckoutObject> checkoutList = await coinbase.retrieveAllCheckouts;
copied to clipboard
Invoices #
To create a new invoice
InvoiceObject invoice = await coinbase.createInvoice(
businessName: 'businessName',
customerEmail: '[email protected]',
customerName: 'Onuoha Silver',
currency: CurrencyType.usd,
amount: 20,
);
copied to clipboard
To view an invoice
InvoiceObject invoice = await coinbase
.viewInvoice('2a4aeb3e-a12b-4728-9c88-297dea5d2adb');
copied to clipboard
To retrieve all Invoices
List<InvoiceObject> invoice =await coinbase.retrieveAllInvoices;
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.