buxdotph 0.0.6 copy "buxdotph: ^0.0.6" to clipboard
buxdotph: ^0.0.6 copied to clipboard

outdated

A dart client for bux.ph api. This client makes it simple for developers to start accepting payment with bux.ph

Bux.ph Dark SDK #

Checkout API #

  • Allows you to checkout

All the parameters that can be used on Checkout Api in JSON

{
"req_id": "TEST123d",
"client_id": "0000001", // Set this up in your .env
"amount": "50",
"description": "test",
"expiry": 2,
"email": "test@example.ph",
"contact": "9161234567",
"name": "Juan Dela Cruz",
"notification_url": "https://example.ph/bux_notif/",
"redirect_url": "https://example.ph/sample_redirect/",
"param1": "referral link",
"param2": "delivery address"
}

Usage #

  1. Set up .env

for production use set BUX_SANDBOX to false

BUX_API_KEY=api_key
BUX_SANDBOX=true
BUX_CLIENT_ID=0000000001
BUX_API_SECRET=secret

Initialize dotenv on your main function

import 'package:dotenv/dotenv.dart';

Future<void> main() async {
  load();
  runApp(MyApp());
}

Add to Your pubspec.yaml

flutter:
  assets:
    - .env
  1. Create CheckoutPayload
import 'package:buxdotph/buxdotph';
import 'package:dotenv/dotenv.dart';
...


final CheckoutPayload payload = CheckoutPayload(
    amount: 1000,
    req_id: 'uuid_from_backend',
    client_id: env['BUX_CLIENT_ID']!,
    description: 'subscription',
    notification_url: 'https://google.com',
    expiry: 2,
    email: 'dummy@gmail.com',
    contact: '09155555555',
    name: 'John Dela Cruz',
    redirect_url: 'https://goldcoders.dev',
    param1: 'username',
    param2: 'address',
  );
  • Pass the Payload to Bux.checkout()
import 'package:buxdotph/buxdotph.dart';

...
await Bux.checkout(payload);

the returned response is a String? type , you can json_encode it if there is no errors

2
likes
0
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

A dart client for bux.ph api. This client makes it simple for developers to start accepting payment with bux.ph

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, dartz, dotenv, equatable, http

More

Packages that depend on buxdotph